Skip to content

Commit f06718d

Browse files
authored
Change to pyproject.toml. (#1805)
1 parent 7e3e9d9 commit f06718d

File tree

6 files changed

+293
-390
lines changed

6 files changed

+293
-390
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
python-version: ${{ matrix.python.version }}
4141
cache: 'pip'
42-
- run: pip install -e . -r requirements.txt
42+
- run: pip install -e ".[all]"
4343
- run: codespell
4444
- run: pylint --recursive=y examples pymodbus test
4545
- run: pre-commit run --all-files
@@ -68,7 +68,7 @@ jobs:
6868
with:
6969
python-version: ${{ matrix.python.version }}
7070
cache: 'pip'
71-
- run: pip install -e . -r requirements.txt
71+
- run: pip install -e ".[all]"
7272

7373
- run: pytest -n0 -v --full-trace --timeout=1200
7474

README.rst

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,39 +142,39 @@ permissions or a virtualenv currently running):
142142

143143
pip install -U pymodbus
144144

145-
This will install a base version of pymodbus.
145+
If you want to use the serial interface:
146+
147+
pip install -U pymodbus[serial]
148+
149+
This will install pymodbus, r
146150

147151
To install pymodbus with options run:
148152

149153
pip install -U pymodbus[<option>,...]
150154

151155
Available options are:
152156

153-
- **repl**, installs pymodbus REPL.
157+
- **repl**, install dependencies needed by pymodbus.repl
154158

155159
- **serial**, installs serial drivers.
156160

161+
- **simulator**, install dependencies needed by pymodbus.simulator
162+
157163
- **documentation**, installs tools to generate documentation.
158164

159165
- **development**, installs development tools needed to enable test/check of pymodbus changes.
160166

161-
162-
Or to install a specific release:
163-
164-
pip install -U pymodbus==X.Y.Z
165-
167+
- **all**, installs all of the above
166168

167169

168170
Installing with github
169171
----------------------
170172

171173
Before cloning the repo, you need to install python3 (preferable 3.11)
172-
and make a virtual environment::
174+
and make and activate a virtual environment::
173175

174176
python3 -m venv /path/to/new/virtual/environment
175177

176-
To activate the virtual environment please do::
177-
178178
source .venv/bin/activate
179179

180180
Clone the source and install from there::
@@ -194,9 +194,7 @@ To get bleeding edge::
194194

195195
Install required development tools::
196196

197-
pip install -r requirements.txt
198-
199-
pip install -e .
197+
pip install -e ".[development]"
200198

201199
pre-commit install
202200

@@ -209,7 +207,6 @@ The repository contains a number of important branches and tags.
209207
* **dev** is where all development happens, this branch is not always stable.
210208
* **master** is where are releases are kept.
211209
* All releases are tagged with **vX.Y.Z** (e.g. v2.5.3)
212-
* All prereleases are tagged with **vX.Y.ZrcQ** (e.g. v3.0.0.0rc1)
213210

214211
If a maintenance release of an old version is needed (e.g. v2.5.4),
215212
the release tag is used to create a branch with the same name,
@@ -233,22 +230,29 @@ solving issues:
233230
* Functional testing against any reference we can find
234231
* The remaining edges of the protocol (that we think no one uses)
235232

233+
There are 2 bigger projects ongoing:
234+
235+
* rewriting the internal part of all clients (both sync and async)
236+
* Make the simulator datastore THE datastore
237+
236238

237239
Development Instructions
238240
------------------------
239241
The current code base is compatible python >= 3.8.
240242
Here are some of the common commands to perform a range of activities
241243

242-
pip install -r requirements.txt install all requirements
243-
244-
pip install -e . source directory is "release", useful for testing
245-
246244
./check_ci.sh run the same checks as CI runs on a pull request.
247245

248246

249247
Generate documentation
250248
----------------------
251249

250+
**Remark** Assumes that you have installed documentation tools:
251+
252+
pip install -e ".[documentation]"
253+
254+
to build do:
255+
252256
cd doc
253257
./build_html
254258

pyproject.toml

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
[build-system]
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pymodbus"
7+
dynamic = ["version"]
8+
license = {text = "BSD-3-Clause"}
9+
authors = [{name = '"Galen Collins'}, {name = 'Jan Iversen"'}]
10+
maintainers = [{name = '"dhoomakethu'}, {name = 'janiversen"'}]
11+
description = "A fully featured modbus protocol stack in python"
12+
keywords = ["modbus", "asyncio", "scada", "client", "server", "simulator"]
13+
readme = "README.rst"
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Environment :: Console",
17+
"Framework :: AsyncIO",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: BSD License",
20+
"Operating System :: POSIX :: Linux",
21+
"Operating System :: Unix",
22+
"Operating System :: MacOS :: MacOS X",
23+
"Operating System :: OS Independent",
24+
"Operating System :: Microsoft",
25+
"Programming Language :: Python :: 3.8",
26+
"Programming Language :: Python :: 3.9",
27+
"Programming Language :: Python :: 3.10",
28+
"Programming Language :: Python :: 3.11",
29+
"Topic :: System :: Networking",
30+
"Topic :: Utilities",
31+
]
32+
requires-python = ">=3.8.0"
33+
34+
[project.urls]
35+
Homepage = "https://github.com/pymodbus-dev/pymodbus/"
36+
"Source Code" = "https://github.com/pymodbus-dev/pymodbus"
37+
"Bug Reports" = "https://github.com/pymodbus-dev/pymodbus/issues"
38+
"Docs: Dev" = "https://pymodbus.readthedocs.io/en/latest/?badge=latest"
39+
Discord = "https://discord.gg/vcP8qAz2"
40+
41+
[project.scripts]
42+
"pymodbus.console" = "pymodbus.repl.client.main:main"
43+
"pymodbus.server" = "pymodbus.repl.server.main:app"
44+
"pymodbus.simulator" = "pymodbus.server.simulator.main:main"
45+
46+
[project.optional-dependencies]
47+
serial = [
48+
"pyserial>=3.5"
49+
]
50+
repl = [
51+
"aiohttp>=3.8.6",
52+
"typer[all]>=0.7.0",
53+
"prompt-toolkit>=3.0.36",
54+
"pygments>=2.15.0",
55+
"click>=8.0.0"
56+
]
57+
simulator = [
58+
"aiohttp>=3.8.6"
59+
]
60+
documentation = [
61+
"recommonmark>=0.7.1",
62+
"Sphinx>=5.3.0",
63+
"sphinx-rtd-theme>=1.1.1"
64+
]
65+
development = [
66+
"codespell>=2.2.2",
67+
"coverage>=7.1.0",
68+
"mypy>=1.3.0",
69+
"pre-commit>=3.1.1",
70+
"pyflakes>=3.0.1",
71+
"pydocstyle>=6.3.0",
72+
"pycodestyle>=2.10.0",
73+
"pylint>=2.17.2",
74+
"pytest>=7.3.1",
75+
"pytest-asyncio>=0.20.3",
76+
"pytest-cov>=4.1.0",
77+
"pytest-timeout>=2.1.0",
78+
"pytest-xdist>=3.3.1",
79+
"ruff>=0.0.287",
80+
"twine>=4.0.2",
81+
"types-Pygments",
82+
"types-pyserial"
83+
]
84+
all = [
85+
# "pymodbus[serial]",
86+
"pyserial>=3.5",
87+
# "pymodbus[repl]",
88+
"aiohttp>=3.8.6",
89+
"typer[all]>=0.7.0",
90+
"prompt-toolkit>=3.0.36",
91+
"pygments>=2.15.0",
92+
"click>=8.0.0",
93+
# "pymodbus[simulator]",
94+
"aiohttp>=3.8.6",
95+
# "pymodbus[documentation]",
96+
"recommonmark>=0.7.1",
97+
"Sphinx>=5.3.0",
98+
"sphinx-rtd-theme>=1.1.1",
99+
# "pymodbus[dev]",
100+
"codespell>=2.2.2",
101+
"coverage>=7.1.0",
102+
"mypy>=1.3.0",
103+
"pre-commit>=3.1.1",
104+
"pyflakes>=3.0.1",
105+
"pydocstyle>=6.3.0",
106+
"pycodestyle>=2.10.0",
107+
"pylint>=2.17.2",
108+
"pytest>=7.3.1",
109+
"pytest-asyncio>=0.20.3",
110+
"pytest-cov>=4.1.0",
111+
"pytest-timeout>=2.1.0",
112+
"pytest-xdist>=3.3.1",
113+
"ruff>=0.0.287",
114+
"twine>=4.0.2",
115+
"types-Pygments",
116+
"types-pyserial"
117+
]
118+
119+
[tool.setuptools]
120+
include-package-data = true
121+
zip-safe = true
122+
platforms = ["'Linux'", "'Mac OS X'", "'Win'"]
123+
124+
[tool.setuptools.exclude-package-data]
125+
pymodbus = [
126+
"examples",
127+
"test",
128+
"doc",
129+
]
130+
131+
[tool.setuptools.package-data]
132+
pymodbus = [
133+
"py.typed",
134+
"server/simulator/setup.json",
135+
"server/simulator/web/**/*"
136+
]
137+
138+
[tool.setuptools.packages.find]
139+
include = ["pymodbus*"]
140+
namespaces = false
141+
142+
[tool.setuptools.dynamic]
143+
version = {attr = "pymodbus.__version__"}
144+
145+
[tool.pylint.main]
146+
ignore-paths = [
147+
"pymodbus/transport/serial_asyncio",
148+
"doc"
149+
]
150+
ignore-patterns = '^\.#'
151+
persistent = "no"
152+
load-plugins = [
153+
"pylint.extensions.bad_builtin",
154+
"pylint.extensions.check_elif",
155+
"pylint.extensions.code_style",
156+
"pylint.extensions.comparison_placement",
157+
"pylint.extensions.confusing_elif",
158+
"pylint.extensions.docparams",
159+
"pylint.extensions.docstyle",
160+
"pylint.extensions.eq_without_hash",
161+
"pylint.extensions.for_any_all",
162+
"pylint.extensions.overlapping_exceptions",
163+
"pylint.extensions.private_import",
164+
"pylint.extensions.set_membership",
165+
"pylint.extensions.typing"
166+
]
167+
jobs = "0"
168+
py-version = "3.8"
169+
170+
[tool.pylint.messages_control]
171+
enable = "all"
172+
disable = [
173+
"duplicate-code", # TBD
174+
"file-ignored", # ONLY to be used with extreme care.
175+
"format", # NOT wanted, handled by black
176+
"locally-disabled", # NOT wanted
177+
"suppressed-message" # NOT wanted"""
178+
]
179+
180+
[tool.pylint.reports]
181+
output-format = "text"
182+
183+
[tool.pylint.logging]
184+
logging-format-style = "new"
185+
186+
[tool.pylint.similarities]
187+
ignore-imports = "no"
188+
ignore-signatures = "no"
189+
190+
[tool.pylint.variables]
191+
dummy-variables-rgx = ""
192+
193+
[tool.pylint.format]
194+
max-module-lines = "2000"
195+
196+
[tool.pylint.basic]
197+
good-names = "i,j,k,rr,fc,rq,fd,x,_"
198+
attr-rgx = "([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$"
199+
method-rgx = "[a-z_][a-zA-Z0-9_]{2,}$"
200+
201+
[tool.pylint.design]
202+
max-args = "10"
203+
max-locals = "25"
204+
max-returns = "11"
205+
max-branches = "27"
206+
max-statements = "100"
207+
max-attributes = "20"
208+
max-public-methods = "25"
209+
210+
[tool.pylint.classes]
211+
valid-metaclass-classmethod-first-arg = "mcs"
212+
213+
[tool.pylint.imports]
214+
deprecated-modules = "regsub,TERMIOS,Bastion,rexec"
215+
216+
[tool.pylint.exceptions]
217+
overgeneral-exceptions = "builtins.Exception"
218+
219+
[tool.pylint.deprecated_builtins]
220+
bad-functions = "map,input"
221+
222+
[tool.mypy]
223+
strict_optional = false
224+
exclude = "pymodbus/client/base.py"
225+
show_error_codes = true
226+
local_partial_types = true
227+
strict_equality = true
228+
warn_incomplete_stub = true
229+
warn_redundant_casts = true
230+
warn_unused_configs = true
231+
warn_unused_ignores = true
232+
enable_error_code = "ignore-without-code, redundant-self, truthy-iterable"
233+
disable_error_code = ["annotation-unchecked"]
234+
strict_concatenate = false
235+
disallow_subclassing_any = true
236+
disallow_untyped_decorators = true
237+
warn_unreachable = true
238+
239+
[tool.distutils]
240+
bdist_wheel = {}
241+
242+
[tool.distutils.egg_info]
243+
tag-svn-revision = false
244+
245+
[tool.distutils.upload_docs]
246+
upload-dir = "build/sphinx/html"
247+
248+
[tool.build-sphinx]
249+
source-dir = "doc/sphinx/"
250+
build-dir = "doc/sphinx/build"
251+
all_files = "1"
252+
253+
[tool.pytest.ini_options]
254+
testpaths = ["test"]
255+
addopts = "-p no:warnings --dist loadscope --numprocesses auto"
256+
asyncio_mode = "auto"
257+
timeout = 40
258+
259+
[tool.coverage.run]
260+
include = [
261+
"examples/",
262+
"pymodbus/",
263+
"test/",
264+
]
265+
omit = ["examples/contrib/"]
266+
267+
[tool.codespell]
268+
skip = "./doc/_build,./doc/source/_static,venv,.venv,.git,htmlcov,CHANGELOG.rst,.mypy_cache"
269+
ignore-words-list = "asend"

0 commit comments

Comments
 (0)