Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 39 additions & 116 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,163 +2,92 @@
# uv pip compile --extra test --extra cli --extra doc --output-file=requirements-dev.txt pyproject.toml
alabaster==0.7.16
# via sphinx
apeye==1.4.1
# via sphinx-toolbox
apeye-core==1.1.5
# via apeye
autodocsumm==0.2.14
# via sphinx-toolbox
babel==2.16.0
babel==2.17.0
# via sphinx
beautifulsoup4==4.12.3
# via sphinx-toolbox
cachecontrol==0.14.0
# via sphinx-toolbox
cachetools==5.5.0
cachetools==6.1.0
# via tox
certifi==2024.8.30
certifi==2025.6.15
# via requests
chardet==5.2.0
# via tox
charset-normalizer==3.4.0
charset-normalizer==3.4.2
# via requests
click==8.1.7
click==8.1.8
# via python-snap7 (pyproject.toml)
colorama==0.4.6
# via tox
cssutils==2.11.1
# via dict2css
dict2css==0.3.0.post1
# via sphinx-toolbox
distlib==0.3.9
# via virtualenv
docutils==0.21.2
# via
# sphinx
# sphinx-prompt
# sphinx-rtd-theme
# sphinx-tabs
# sphinx-toolbox
domdf-python-tools==3.9.0
# via
# apeye
# apeye-core
# dict2css
# sphinx-toolbox
enum-tools==0.12.0
# via python-snap7 (pyproject.toml)
exceptiongroup==1.2.2
exceptiongroup==1.3.0
# via pytest
filelock==3.16.1
filelock==3.18.0
# via
# cachecontrol
# sphinx-toolbox
# tox
# virtualenv
html5lib==1.1
# via sphinx-toolbox
idna==3.10
# via
# apeye-core
# requests
# via requests
imagesize==1.4.1
# via sphinx
importlib-metadata==8.5.0
importlib-metadata==8.7.0
# via sphinx
iniconfig==2.0.0
iniconfig==2.1.0
# via pytest
jinja2==3.1.4
# via
# sphinx
# sphinx-jinja2-compat
jinja2==3.1.6
# via sphinx
markdown-it-py==3.0.0
# via rich
markupsafe==3.0.2
# via
# jinja2
# sphinx-jinja2-compat
# via jinja2
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.5.0
# via cssutils
msgpack==1.1.0
# via cachecontrol
mypy==1.13.0
mypy==1.16.1
# via python-snap7 (pyproject.toml)
mypy-extensions==1.0.0
mypy-extensions==1.1.0
# via mypy
natsort==8.4.0
# via domdf-python-tools
packaging==24.1
packaging==25.0
# via
# pyproject-api
# pytest
# sphinx
# tox
platformdirs==4.3.6
pathspec==0.12.1
# via mypy
platformdirs==4.3.8
# via
# apeye
# tox
# virtualenv
pluggy==1.5.0
pluggy==1.6.0
# via
# pytest
# tox
pygments==2.18.0
pygments==2.19.2
# via
# enum-tools
# pytest
# rich
# sphinx
# sphinx-prompt
# sphinx-tabs
pyproject-api==1.8.0
pyproject-api==1.9.1
# via tox
pytest==8.3.3
pytest==8.4.1
# via python-snap7 (pyproject.toml)
requests==2.32.3
# via
# apeye
# cachecontrol
# sphinx
rich==13.9.4
requests==2.32.4
# via sphinx
rich==14.0.0
# via python-snap7 (pyproject.toml)
ruamel-yaml==0.18.6
# via sphinx-toolbox
ruamel-yaml-clib==0.2.12
# via ruamel-yaml
ruff==0.7.2
ruff==0.12.1
# via python-snap7 (pyproject.toml)
six==1.16.0
# via html5lib
snowballstemmer==2.2.0
snowballstemmer==3.0.1
# via sphinx
soupsieve==2.6
# via beautifulsoup4
sphinx==7.4.7
# via
# python-snap7 (pyproject.toml)
# autodocsumm
# enum-tools
# sphinx-autodoc-typehints
# sphinx-prompt
# sphinx-rtd-theme
# sphinx-tabs
# sphinx-toolbox
# sphinxcontrib-jquery
sphinx-autodoc-typehints==2.3.0
# via sphinx-toolbox
sphinx-jinja2-compat==0.3.0
# via
# enum-tools
# sphinx-toolbox
sphinx-prompt==1.8.0
# via sphinx-toolbox
sphinx-rtd-theme==3.0.1
sphinx-rtd-theme==3.0.2
# via python-snap7 (pyproject.toml)
sphinx-tabs==3.4.5
# via sphinx-toolbox
sphinx-toolbox==3.8.1
# via enum-tools
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==2.0.0
Expand All @@ -173,36 +102,30 @@ sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
tabulate==0.9.0
# via sphinx-toolbox
tomli==2.0.2
tomli==2.2.1
# via
# mypy
# pyproject-api
# pytest
# sphinx
# tox
tox==4.23.2
tox==4.27.0
# via python-snap7 (pyproject.toml)
types-click==7.1.8
# via python-snap7 (pyproject.toml)
types-setuptools==75.2.0.20241025
types-setuptools==80.9.0.20250529
# via python-snap7 (pyproject.toml)
typing-extensions==4.12.2
typing-extensions==4.14.0
# via
# domdf-python-tools
# enum-tools
# exceptiongroup
# mypy
# rich
# sphinx-toolbox
# tox
urllib3==2.2.3
urllib3==2.5.0
# via requests
uv==0.4.29
uv==0.7.19
# via python-snap7 (pyproject.toml)
virtualenv==20.27.1
virtualenv==20.31.2
# via tox
webencodings==0.5.1
# via html5lib
zipp==3.20.2
zipp==3.23.0
# via importlib-metadata
7 changes: 2 additions & 5 deletions snap7/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ def read_area(self, area: Area, db_number: int, start: int, size: int) -> bytear
word_len = WordLen.Byte
type_ = word_len.ctype
logger.debug(
f"reading area: {area.name} db_number: {db_number} start: {start} amount: {size} "
f"word_len: {word_len.name}={word_len}"
f"reading area: {area.name} db_number: {db_number} start: {start} amount: {size} word_len: {word_len.name}={word_len}"
)
data = (type_ * size)()
result = self._lib.Cli_ReadArea(self._s7_client, area, db_number, start, size, word_len, byref(data))
Expand Down Expand Up @@ -1011,9 +1010,7 @@ def as_write_area(self, area: Area, db_number: int, start: int, size: int, word_
"""
type_ = WordLen.Byte.ctype
logger.debug(
f"writing area: {area.name} db_number: {db_number} "
f"start: {start}: size {size}: "
f"word_len {word_len} type: {type_}"
f"writing area: {area.name} db_number: {db_number} start: {start}: size {size}: word_len {word_len} type: {type_}"
)
cdata = (type_ * len(data)).from_buffer_copy(data)
res = self._lib.Cli_AsWriteArea(self._s7_client, area, db_number, start, size, word_len.value, byref(cdata))
Expand Down
2 changes: 1 addition & 1 deletion snap7/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


if platform.system() == "Windows":
from ctypes import windll as cdll # type: ignore
from ctypes import windll as cdll
else:
from ctypes import cdll

Expand Down
2 changes: 1 addition & 1 deletion snap7/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def create(self, active: bool = False) -> None:
:param active: 0
:returns: a pointer to the partner object
"""
self._library.Par_Create.restype = S7Object # type: ignore[attr-defined]
self._library.Par_Create.restype = S7Object
self._pointer = S7Object(self._library.Par_Create(int(active)))

def destroy(self) -> Optional[int]:
Expand Down
2 changes: 1 addition & 1 deletion snap7/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def event_text(self, event: SrvEvent) -> str:
def create(self) -> None:
"""Create the server."""
logger.info("creating server")
self._lib.Srv_Create.restype = S7Object # type: ignore[attr-defined]
self._lib.Srv_Create.restype = S7Object
self._s7_server = S7Object(self._lib.Srv_Create())

@error_wrap(context="server")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def test_check_as_completion(self, timeout: int = 5) -> None:
else:
self.fail(f"TimeoutError - Process pends for more than {timeout} seconds")
if pending_checked is False:
logging.warning("Pending was never reached, because Server was to fast," " but request to server was successfull.")
logging.warning("Pending was never reached, because Server was to fast, but request to server was successfull.")

def test_as_read_area(self) -> None:
amount = 1
Expand Down
15 changes: 10 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
envlist =
mypy,
lint-ruff,
py39
py310
py311
py312
py313
py39,
py310,
py311,
py312,
py313,
docs
isolated_build = true

[testenv]
Expand Down Expand Up @@ -45,3 +46,7 @@ deps = uv
skip_install = true
setenv = CUSTOM_COMPILE_COMMAND='tox -e requirements-dev'
commands = uv pip compile --upgrade --extra test --extra cli --extra doc --output-file=requirements-dev.txt pyproject.toml

[testenv:docs]
basepython = python3.10
commands = sphinx-build -N -bhtml doc/ doc/_build
Loading