diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 2f447de..aa92ddc 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -41,3 +41,6 @@ jobs: run: python -m pylint nmcli - name: Run unit tests run: python -m pytest tests + - name: Test build + if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9' + run: python -m build diff --git a/develop-requirements.txt b/develop-requirements.txt index 640ca00..95e30d2 100644 --- a/develop-requirements.txt +++ b/develop-requirements.txt @@ -1,9 +1,27 @@ -pytest==6.2.5 -wheel==0.38.1 +# Testing +pytest==7.4.4; python_version < "3.10" +pytest==9.0.2; python_version >= "3.10" +pytest-cov==4.1.0; python_version < "3.10" +pytest-cov==7.0.0; python_version >= "3.10" + +# Type checking +# Using mypy 0.930 for all versions to avoid no_implicit_optional incompatibility +# Upgrade to mypy 1.x requires code changes for explicit Optional types mypy==0.930 + +# Linting pylint==2.12.2; python_version < "3.10" pylint==4.0.4; python_version >= "3.10" -twine==3.7.1 -autoflake==1.4 -autopep8==1.6.0 -isort==5.10.1 + +# Code formatting +autoflake==1.7.8; python_version < "3.10" +autoflake==2.3.1; python_version >= "3.10" +autopep8==1.6.0; python_version < "3.10" +autopep8==2.3.2; python_version >= "3.10" +isort==5.11.5; python_version < "3.10" +isort==7.0.0; python_version >= "3.10" + +# Distribution (Python 3.10+ only, per build policy) +wheel==0.45.1; python_version >= "3.10" +twine==6.2.0; python_version >= "3.10" +build==1.3.0; python_version >= "3.10" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e4eb783 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,26 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "nmcli" +version = "1.5.0" +description = "A python wrapper library for the network-manager cli client" +readme = "README.md" +authors = [{name = "ushiboy"}] +license = "MIT" +license-files = ["LICENSE.txt"] +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: POSIX :: Linux" +] + +[project.urls] +Homepage = "https://github.com/ushiboy/nmcli" + +[tool.setuptools.packages.find] +include = ["nmcli*"] + +[tool.setuptools.package-data] +nmcli = ["py.typed"] diff --git a/setup.py b/setup.py index 7b34b26..bd6850d 100755 --- a/setup.py +++ b/setup.py @@ -1,39 +1,6 @@ #!/usr/bin/env python3 +# This file is kept for backwards compatibility. +# All configuration is now in pyproject.toml from setuptools import setup -from setuptools.command.test import test -class PyTest(test): - - def run_tests(self): - import pytest - pytest.main(self.test_args) - -with open('README.md', 'r') as f: - long_description = f.read() - -setup( - name='nmcli', - version='1.5.0', - author='ushiboy', - license='MIT', - license_files = ('LICENSE.txt',), - description='A python wrapper library for the network-manager cli client', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/ushiboy/nmcli', - packages=['nmcli', 'nmcli.data', 'nmcli.dummy'], - package_data={ - 'nmcli': ['py.typed'], - }, - test_suite='tests', - python_requires='>=3.7', - tests_require=[ - 'pytest' - ], - classifiers=[ - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX :: Linux' - ], - cmdclass={'test': PyTest} -) +setup()