From c77a40fc9ddbd7958d0c7c9909a4f9f2631f51ef Mon Sep 17 00:00:00 2001 From: ushiboy Date: Sat, 13 Dec 2025 22:40:38 +0900 Subject: [PATCH 1/4] Migrate setup.py configuration to pyproject.toml --- pyproject.toml | 26 ++++++++++++++++++++++++++ setup.py | 39 +++------------------------------------ 2 files changed, 29 insertions(+), 36 deletions(-) create mode 100644 pyproject.toml 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() From 6c8a3aca47c6a35327117c7955a9d49f3890fa2a Mon Sep 17 00:00:00 2001 From: ushiboy Date: Sat, 13 Dec 2025 22:55:28 +0900 Subject: [PATCH 2/4] Add build check for Python 3.10 and newer --- .github/workflows/action.yml | 3 +++ develop-requirements.txt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 2f447de..4ed00c2 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.10' + run: python -m build diff --git a/develop-requirements.txt b/develop-requirements.txt index 640ca00..ece6f7f 100644 --- a/develop-requirements.txt +++ b/develop-requirements.txt @@ -1,4 +1,5 @@ pytest==6.2.5 +pytest-cov==3.0.0 wheel==0.38.1 mypy==0.930 pylint==2.12.2; python_version < "3.10" @@ -7,3 +8,4 @@ twine==3.7.1 autoflake==1.4 autopep8==1.6.0 isort==5.10.1 +build==1.3.0; python_version >= "3.10" From 8c35539dfd74a63914fedb07675d518669eb3db5 Mon Sep 17 00:00:00 2001 From: ushiboy Date: Sat, 13 Dec 2025 23:07:19 +0900 Subject: [PATCH 3/4] Tidy up dependency versions --- develop-requirements.txt | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/develop-requirements.txt b/develop-requirements.txt index ece6f7f..95e30d2 100644 --- a/develop-requirements.txt +++ b/develop-requirements.txt @@ -1,11 +1,27 @@ -pytest==6.2.5 -pytest-cov==3.0.0 -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" From 2294e0414f7b3e6bb05298c24049f8af3d0c44d1 Mon Sep 17 00:00:00 2001 From: ushiboy Date: Sat, 13 Dec 2025 23:13:41 +0900 Subject: [PATCH 4/4] Correct ignored version setting --- .github/workflows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 4ed00c2..aa92ddc 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -42,5 +42,5 @@ jobs: - name: Run unit tests run: python -m pytest tests - name: Test build - if: matrix.python-version >= '3.10' + if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9' run: python -m build