Skip to content

Commit f23c140

Browse files
authored
Merge pull request #80 from ushiboy/chore/modern-build
Chore: modern build
2 parents fc1c98c + 2294e04 commit f23c140

File tree

4 files changed

+56
-42
lines changed

4 files changed

+56
-42
lines changed

.github/workflows/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ jobs:
4141
run: python -m pylint nmcli
4242
- name: Run unit tests
4343
run: python -m pytest tests
44+
- name: Test build
45+
if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9'
46+
run: python -m build

develop-requirements.txt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
pytest==6.2.5
2-
wheel==0.38.1
1+
# Testing
2+
pytest==7.4.4; python_version < "3.10"
3+
pytest==9.0.2; python_version >= "3.10"
4+
pytest-cov==4.1.0; python_version < "3.10"
5+
pytest-cov==7.0.0; python_version >= "3.10"
6+
7+
# Type checking
8+
# Using mypy 0.930 for all versions to avoid no_implicit_optional incompatibility
9+
# Upgrade to mypy 1.x requires code changes for explicit Optional types
310
mypy==0.930
11+
12+
# Linting
413
pylint==2.12.2; python_version < "3.10"
514
pylint==4.0.4; python_version >= "3.10"
6-
twine==3.7.1
7-
autoflake==1.4
8-
autopep8==1.6.0
9-
isort==5.10.1
15+
16+
# Code formatting
17+
autoflake==1.7.8; python_version < "3.10"
18+
autoflake==2.3.1; python_version >= "3.10"
19+
autopep8==1.6.0; python_version < "3.10"
20+
autopep8==2.3.2; python_version >= "3.10"
21+
isort==5.11.5; python_version < "3.10"
22+
isort==7.0.0; python_version >= "3.10"
23+
24+
# Distribution (Python 3.10+ only, per build policy)
25+
wheel==0.45.1; python_version >= "3.10"
26+
twine==6.2.0; python_version >= "3.10"
27+
build==1.3.0; python_version >= "3.10"

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "nmcli"
7+
version = "1.5.0"
8+
description = "A python wrapper library for the network-manager cli client"
9+
readme = "README.md"
10+
authors = [{name = "ushiboy"}]
11+
license = "MIT"
12+
license-files = ["LICENSE.txt"]
13+
requires-python = ">=3.7"
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"Operating System :: POSIX :: Linux"
17+
]
18+
19+
[project.urls]
20+
Homepage = "https://github.com/ushiboy/nmcli"
21+
22+
[tool.setuptools.packages.find]
23+
include = ["nmcli*"]
24+
25+
[tool.setuptools.package-data]
26+
nmcli = ["py.typed"]

setup.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,6 @@
11
#!/usr/bin/env python3
2+
# This file is kept for backwards compatibility.
3+
# All configuration is now in pyproject.toml
24
from setuptools import setup
3-
from setuptools.command.test import test
45

5-
class PyTest(test):
6-
7-
def run_tests(self):
8-
import pytest
9-
pytest.main(self.test_args)
10-
11-
with open('README.md', 'r') as f:
12-
long_description = f.read()
13-
14-
setup(
15-
name='nmcli',
16-
version='1.5.0',
17-
author='ushiboy',
18-
license='MIT',
19-
license_files = ('LICENSE.txt',),
20-
description='A python wrapper library for the network-manager cli client',
21-
long_description=long_description,
22-
long_description_content_type='text/markdown',
23-
url='https://github.com/ushiboy/nmcli',
24-
packages=['nmcli', 'nmcli.data', 'nmcli.dummy'],
25-
package_data={
26-
'nmcli': ['py.typed'],
27-
},
28-
test_suite='tests',
29-
python_requires='>=3.7',
30-
tests_require=[
31-
'pytest'
32-
],
33-
classifiers=[
34-
'Programming Language :: Python :: 3',
35-
'License :: OSI Approved :: MIT License',
36-
'Operating System :: POSIX :: Linux'
37-
],
38-
cmdclass={'test': PyTest}
39-
)
6+
setup()

0 commit comments

Comments
 (0)