diff --git a/Makefile b/Makefile index cbf87e67..e0edf8e7 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,9 @@ export PODMAN_VERSION ?= "5.3.0" .PHONY: podman podman: rm dist/* || : - $(PYTHON) -m pip install --user -r requirements.txt + $(PYTHON) -m pip install -q build PODMAN_VERSION=$(PODMAN_VERSION) \ - $(PYTHON) setup.py sdist bdist bdist_wheel + $(PYTHON) -m build .PHONY: lint lint: tox diff --git a/pyproject.toml b/pyproject.toml index 5361b2fd..a14f40b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,32 +1,125 @@ -[tool.black] -line-length = 100 -skip-string-normalization = true -preview = true -target-version = ["py39"] -include = '\.pyi?$' -exclude = ''' -/( - \.git - | \.tox - | \.venv - | \.history - | build - | dist - | docs - | hack -)/ -''' -[tool.isort] -profile = "black" -line_length = 100 [build-system] -# Any changes should be copied into requirements.txt, setup.cfg, and/or test-requirements.txt -requires = [ - "setuptools>=46.4", -] +requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" + +[project] +name = "podman" +dynamic = ["version"] +description = "Bindings for Podman RESTful API" +readme = "README.md" +license = {file = "LICENSE"} +requires-python = ">=3.9" +authors = [ + { name = "Brent Baude" }, + { name = "Jhon Honce", email = "jhonce@redhat.com" }, + { name = "Urvashi Mohnani" }, + { name = "Nicola Sella", email = "nsella@redhat.com" }, +] +keywords = [ + "libpod", + "podman", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Software Development :: Libraries :: Python Modules", +] +# compatible releases +# ~= with version numbers +dependencies = [ + "requests >=2.24", + "tomli>=1.2.3; python_version<'3.11'", + "urllib3", +] + +[project.optional-dependencies] +progress_bar = [ + "rich >= 12.5.1", +] +docs = [ + "sphinx" +] +test = [ + "coverage", + "fixtures", + "pytest", + "requests-mock", +] + +[project.urls] +"Bug Tracker" = "https://github.com/containers/podman-py/issues" +Homepage = "https://github.com/containers/podman-py" +"Libpod API" = "https://docs.podman.io/en/latest/_static/api.html" + [tool.pytest.ini_options] log_cli = true log_cli_level = "DEBUG" log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" log_cli_date_format = "%Y-%m-%d %H:%M:%S" + +[tool.setuptools] +packages = ["podman"] + +[tool.ruff] +line-length = 100 +src = ["podman"] + +# This is the section where Black is mostly replaced with Ruff +[tool.ruff.format] +exclude = [ + ".git", + ".history", + ".tox", + ".venv", + "build", + "dist", + "docs", + "hack", +] +quote-style = "preserve" + +[tool.ruff.lint] +select = [ + # More stuff here https://docs.astral.sh/ruff/rules/ + "F", # Pyflakes + "E", # Pycodestyle Error + "W", # Pycodestyle Warning + "N", # PEP8 Naming + # TODO "UP", # Pyupgrade + # TODO "ANN", + # TODO "S", # Bandit + # "B", # Bugbear + "A", # flake-8-builtins + "YTT", # flake-8-2020 + "PLC", # Pylint Convention + "PLE", # Pylint Error + "PLW", # Pylint Warning +] +# Some checks should be enabled for code sanity disabled now +# to avoid changing too many lines +ignore = [ + "F821", # TODO Undefined name + "F541", # TODO f-string is missing placeholders + "F401", # TODO Module imported but unused + "F841", # TODO Local variable is assigned to but never used + "E402", # TODO Module level import not at top of file + "E741", # TODO ambiguous variable name + "E722", # TODO do not use bare 'except' + "E501", # TODO line too long + "N818", # TODO Error Suffix in exception name + "N80", # TODO Invalid Name + "ANN10", # Missing type annotation + "PLW2901", # TODO Redefined Loop Name +] +[tool.ruff.lint.flake8-builtins] +builtins-ignorelist = ["copyright", "all"] +[tool.ruff.lint.per-file-ignores] +"podman/tests/*.py" = ["S"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f16a9878..00000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Any changes should be copied into pyproject.toml -requests>=2.24 -setuptools -sphinx -tomli>=1.2.3; python_version<'3.11' -urllib3 -wheel diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 02b60ac5..00000000 --- a/ruff.toml +++ /dev/null @@ -1,50 +0,0 @@ - -line-length = 100 -[format] -exclude = [ - ".git", - ".venv", - ".history", - "build", - "dist", - "docs", - "hack", -] -quote-style = "preserve" -[lint] -select = [ - # More stuff here https://docs.astral.sh/ruff/rules/ - "F", # Pyflakes - "E", # Pycodestyle Error - "W", # Pycodestyle Warning - "N", # PEP8 Naming - # TODO "UP", # Pyupgrade - # TODO "ANN", - # TODO "S", # Bandit - # "B", # Bugbear - "A", # flake-8-builtins - "YTT", # flake-8-2020 - "PLC", # Pylint Convention - "PLE", # Pylint Error - "PLW", # Pylint Warning -] -# Some checks should be enabled for code sanity disabled now -# to avoid changing too many lines -ignore = [ - "F821", # TODO Undefined name - "F541", # TODO f-string is missing placeholders - "F401", # TODO Module imported but unused - "F841", # TODO Local variable is assigned to but never used - "E402", # TODO Module level import not at top of file - "E741", # TODO ambiguous variable name - "E722", # TODO do not use bare 'except' - "E501", # TODO line too long - "N818", # TODO Error Suffix in exception name - "N80", # TODO Invalid Name - "ANN10", # Missing type annotation - "PLW2901", # TODO Redefined Loop Name -] -[lint.per-file-ignores] -"podman/tests/*.py" = ["S"] -[lint.flake8-builtins] -builtins-ignorelist = ["copyright", "all"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d31a2479..00000000 --- a/setup.cfg +++ /dev/null @@ -1,52 +0,0 @@ -[metadata] -name = podman -version = 5.3.0 -author = Brent Baude, Jhon Honce, Urvashi Mohnani, Nicola Sella -author_email = jhonce@redhat.com -description = Bindings for Podman RESTful API -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/containers/podman-py -license = Apache-2.0 -license_files = LICENSE -platforms = any -project_urls = - Bug Tracker = https://github.com/containers/podman-py/issues - Libpod API = https://docs.podman.io/en/latest/_static/api.html -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Developers - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.13 - Topic :: Software Development :: Libraries :: Python Modules -keywords = podman, libpod - -[options] -include_package_data = True -python_requires = >=3.9 -test_suite = -# Any changes should be copied into pyproject.toml -install_requires = - requests >=2.24 - tomli>=1.2.3; python_version<'3.11' - urllib3 - -[options.extras_require] -progress_bar = - rich >= 12.5.1 - -# typing_extensions are included for RHEL 8.5 -# typing_extensions;python_version<'3.8' - -[bdist_wheel] -# python < 3.6 not supported -universal = false - -[sdist] -formats = gztar diff --git a/setup.py b/setup.py deleted file mode 100644 index 01e2dd7a..00000000 --- a/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -import fnmatch - -import setuptools -from setuptools import find_packages -from setuptools.command.build_py import build_py as build_py_orig - -excluded = [ - "podman/tests/*", -] - - -class build_py(build_py_orig): - def find_package_modules(self, package, package_dir): - modules = super().find_package_modules(package, package_dir) - return [ - (pkg, mod, file) - for (pkg, mod, file) in modules - if not any(fnmatch.fnmatchcase(file, pat=pattern) for pattern in excluded) - ] - - -setuptools.setup( - packages=find_packages(), - cmdclass={"build_py": build_py}, -) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 1a70e359..00000000 --- a/test-requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Any changes should be copied into pyproject.toml --r requirements.txt -ruff -coverage -fixtures -pytest -requests-mock >= 1.11.0 -tox