Skip to content

Commit 97f1e16

Browse files
Convert setup.py to pyproject.toml (hardbyte#1592)
* Remove files * Update pyproject * Update ci * Fix ci errors * Apply formatter changes * Fix py312 ci * MR feedback Co-authored-by: zariiii9003 <[email protected]> --------- Co-authored-by: zariiii9003 <[email protected]>
1 parent 7918209 commit 97f1e16

File tree

9 files changed

+141
-163
lines changed

9 files changed

+141
-163
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- name: Install dependencies
8585
run: |
8686
python -m pip install --upgrade pip
87-
pip install -r requirements-lint.txt
87+
pip install -e .[lint]
8888
- name: mypy 3.7
8989
run: |
9090
mypy --python-version 3.7 .
@@ -125,7 +125,7 @@ jobs:
125125
- name: Install dependencies
126126
run: |
127127
python -m pip install --upgrade pip
128-
pip install -r requirements-lint.txt
128+
pip install -e .[lint]
129129
- name: Code Format Check with Black
130130
run: |
131131
black --check --verbose .

.github/workflows/format-code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install -r requirements-lint.txt
20+
pip install -e .[lint]
2121
- name: Code Format Check with Black
2222
run: |
2323
black --verbose .

can/interfaces/ixxat/canlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
tseg1_dbr: int = None,
4040
tseg2_dbr: int = None,
4141
ssp_dbr: int = None,
42-
**kwargs
42+
**kwargs,
4343
):
4444
"""
4545
:param channel:
@@ -116,7 +116,7 @@ def __init__(
116116
tseg1_dbr=tseg1_dbr,
117117
tseg2_dbr=tseg2_dbr,
118118
ssp_dbr=ssp_dbr,
119-
**kwargs
119+
**kwargs,
120120
)
121121
else:
122122
if rx_fifo_size is None:
@@ -132,7 +132,7 @@ def __init__(
132132
rx_fifo_size=rx_fifo_size,
133133
tx_fifo_size=tx_fifo_size,
134134
bitrate=bitrate,
135-
**kwargs
135+
**kwargs,
136136
)
137137

138138
super().__init__(channel=channel, **kwargs)

can/interfaces/seeedstudio/seeedstudio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(
6464
operation_mode="normal",
6565
bitrate=500000,
6666
*args,
67-
**kwargs
67+
**kwargs,
6868
):
6969
"""
7070
:param str channel:

can/io/printer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(
2828
self,
2929
file: Optional[Union[StringPathLike, TextIO]] = None,
3030
append: bool = False,
31-
**kwargs: Any
31+
**kwargs: Any,
3232
) -> None:
3333
"""
3434
:param file: An optional path-like object or a file-like object to "print"

pyproject.toml

Lines changed: 133 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,142 @@
11
[build-system]
2-
requires = [
3-
"setuptools >= 40.8",
4-
"wheel",
5-
]
2+
requires = ["setuptools >= 67.7.2"]
63
build-backend = "setuptools.build_meta"
74

5+
[project]
6+
name = "python-can"
7+
dynamic = ["readme", "version"]
8+
description = "Controller Area Network interface module for Python"
9+
authors = [{ name = "python-can contributors" }]
10+
dependencies = [
11+
"wrapt~=1.10",
12+
"packaging >= 23.1",
13+
"setuptools >= 67.7.2",
14+
"typing_extensions>=3.10.0.0",
15+
"msgpack~=1.0.0; platform_system != 'Windows'",
16+
"pywin32>=305; platform_system == 'Windows' and platform_python_implementation == 'CPython'",
17+
]
18+
requires-python = ">=3.7"
19+
license = { text = "LGPL v3" }
20+
classifiers = [
21+
"Development Status :: 5 - Production/Stable",
22+
"Environment :: Console",
23+
"Intended Audience :: Developers",
24+
"Intended Audience :: Education",
25+
"Intended Audience :: Information Technology",
26+
"Intended Audience :: Manufacturing",
27+
"Intended Audience :: Telecommunications Industry",
28+
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
29+
"Natural Language :: English",
30+
"Natural Language :: English",
31+
"Operating System :: MacOS",
32+
"Operating System :: Microsoft :: Windows",
33+
"Operating System :: POSIX :: Linux",
34+
"Programming Language :: Python",
35+
"Programming Language :: Python :: 3.7",
36+
"Programming Language :: Python :: 3.8",
37+
"Programming Language :: Python :: 3.9",
38+
"Programming Language :: Python :: 3.10",
39+
"Programming Language :: Python :: 3.11",
40+
"Programming Language :: Python :: Implementation :: CPython",
41+
"Programming Language :: Python :: Implementation :: PyPy",
42+
"Topic :: System :: Hardware :: Hardware Drivers",
43+
"Topic :: System :: Logging",
44+
"Topic :: System :: Monitoring",
45+
"Topic :: System :: Networking",
46+
"Topic :: Utilities",
47+
]
48+
49+
[project.scripts]
50+
"can_logconvert.py" = "scripts.can_logconvert:main"
51+
"can_logger.py" = "scripts.can_logger:main"
52+
"can_player.py" = "scripts.can_player:main"
53+
"can_viewer.py" = "scripts.can_viewer:main"
54+
55+
[project.urls]
56+
homepage = "https://github.com/hardbyte/python-can"
57+
documentation = "https://python-can.readthedocs.io"
58+
repository = "https://github.com/hardbyte/python-can"
59+
changelog = "https://github.com/hardbyte/python-can/blob/develop/CHANGELOG.md"
60+
61+
[project.optional-dependencies]
62+
lint = [
63+
"pylint==2.16.4",
64+
"ruff==0.0.260",
65+
"black~=23.1.0",
66+
"mypy==1.0.1",
67+
"mypy-extensions==0.4.3",
68+
"types-setuptools"
69+
]
70+
seeedstudio = ["pyserial>=3.0"]
71+
serial = ["pyserial~=3.0"]
72+
neovi = ["filelock", "python-ics>=2.12"]
73+
canalystii = ["canalystii>=0.1.0"]
74+
cantact = ["cantact>=0.0.7"]
75+
cvector = ["python-can-cvector"]
76+
gs_usb = ["gs_usb>=0.2.1"]
77+
nixnet = ["nixnet>=0.3.2"]
78+
pcan = ["uptime~=3.0.1"]
79+
remote = ["python-can-remote"]
80+
sontheim = ["python-can-sontheim>=0.1.2"]
81+
canine = ["python-can-canine>=0.2.2"]
82+
viewer = [
83+
"windows-curses; platform_system == 'Windows' and platform_python_implementation=='CPython'"
84+
]
85+
mf4 = ["asammdf>=6.0.0"]
86+
87+
[tool.setuptools.dynamic]
88+
readme = { file = "README.rst" }
89+
version = { attr = "can.__version__" }
90+
91+
[tool.setuptools.package-data]
92+
"*" = ["README.rst", "CONTRIBUTORS.txt", "LICENSE.txt", "CHANGELOG.md"]
93+
doc = ["*.*"]
94+
examples = ["*.py"]
95+
can = ["py.typed"]
96+
97+
[tool.setuptools.packages.find]
98+
include = ["can*", "scripts"]
99+
100+
[tool.mypy]
101+
warn_return_any = true
102+
warn_unused_configs = true
103+
ignore_missing_imports = true
104+
no_implicit_optional = true
105+
disallow_incomplete_defs = true
106+
warn_redundant_casts = true
107+
warn_unused_ignores = false
108+
exclude = [
109+
"venv",
110+
"^doc/conf.py$",
111+
"^build",
112+
"^test",
113+
"^setup.py$",
114+
"^can/interfaces/__init__.py",
115+
"^can/interfaces/etas",
116+
"^can/interfaces/gs_usb",
117+
"^can/interfaces/ics_neovi",
118+
"^can/interfaces/iscan",
119+
"^can/interfaces/ixxat",
120+
"^can/interfaces/kvaser",
121+
"^can/interfaces/nican",
122+
"^can/interfaces/neousys",
123+
"^can/interfaces/pcan",
124+
"^can/interfaces/serial",
125+
"^can/interfaces/slcan",
126+
"^can/interfaces/socketcan",
127+
"^can/interfaces/systec",
128+
"^can/interfaces/udp_multicast",
129+
"^can/interfaces/usb2can",
130+
"^can/interfaces/virtual",
131+
]
132+
8133
[tool.ruff]
9134
select = [
10-
"F401", # unused-imports
11-
"UP", # pyupgrade
12-
"I", # isort
13-
]
135+
"F401", # unused-imports
136+
"UP", # pyupgrade
137+
"I", # isort
14138

15-
# Assume Python 3.7.
16-
target-version = "py37"
139+
]
17140

18141
[tool.ruff.isort]
19142
known-first-party = ["can"]

requirements-lint.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 35 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)