This commit is contained in:
2025-01-03 15:06:21 +01:00
parent 68a7c9cb0f
commit d91714829d
3441 changed files with 615211 additions and 0 deletions

View File

@@ -0,0 +1 @@
pip

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 l.lefebvre
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,139 @@
Metadata-Version: 2.1
Name: pyModbusTCP
Version: 0.2.0
Summary: A simple Modbus/TCP library for Python
Home-page: https://github.com/sourceperl/pyModbusTCP
Author: Loic Lefebvre
Author-email: loic.celine@free.fr
License: MIT
Platform: any
License-File: LICENSE
.. |badge_tests| image:: https://github.com/sourceperl/pyModbusTCP/actions/workflows/tests.yml/badge.svg?branch=master
:target: https://github.com/sourceperl/pyModbusTCP/actions/workflows/tests.yml
.. |badge_docs| image:: https://readthedocs.org/projects/pymodbustcp/badge/?version=latest
:target: http://pymodbustcp.readthedocs.io/
pyModbusTCP |badge_tests| |badge_docs|
======================================
A simple Modbus/TCP client library for Python.
pyModbusTCP is pure Python code without any extension or external module dependency.
Since version 0.1.0, a server is also available for test purpose only (don't use in project).
Tests
-----
The module is currently test on Python 3.5, 3.6, 3.7, 3.8, 3.9 and 3.10.
For Linux, Mac OS and Windows.
Documentation
-------------
Documentation of the last release is available online at https://pymodbustcp.readthedocs.io/.
Setup
-----
You can install this package from:
PyPI, the easy way:
.. code-block:: bash
# install the last available release (stable)
sudo pip install pyModbusTCP
.. code-block:: bash
# install a specific version (here release v0.1.10)
sudo pip install pyModbusTCP==v0.1.10
From GitHub:
.. code-block:: bash
# install a specific version (here release v0.1.10) directly from github servers
sudo pip install git+https://github.com/sourceperl/pyModbusTCP.git@v0.1.10
Note on the use of versions:
Over time, some things can change. So, it's a good practice that you always use a specific version of a package for
your project, instead of just relying on the default behavior. Without precision, the installation tools will always
install the latest version available for a package, this may have some drawbacks. For example, in pyModbusTCP, the TCP
automatic open mode will be active by default from version 0.2.0. It is not the case with previous versions and it just
doesn't exist before the 0.0.12. This can lead to some strange behaviour of your application if you are not aware of
the change. Look at `CHANGES <https://github.com/sourceperl/pyModbusTCP/blob/master/CHANGES>`_ for details on versions
available.
Usage example
-------------
See examples/ for full scripts.
include (for all samples)
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
from pyModbusTCP.client import ModbusClient
module init (TCP always open)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
# TCP auto connect on first modbus request
c = ModbusClient(host="localhost", port=502, unit_id=1, auto_open=True)
module init (TCP open/close for each request)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
# TCP auto connect on modbus request, close after it
c = ModbusClient(host="127.0.0.1", auto_open=True, auto_close=True)
Read 2x 16 bits registers at modbus address 0 :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
regs = c.read_holding_registers(0, 2)
if regs:
print(regs)
else:
print("read error")
Write value 44 and 55 to registers at modbus address 10 :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
if c.write_multiple_registers(10, [44,55]):
print("write ok")
else:
print("write error")
Know issue with older Python version on Windows
-----------------------------------------------
On windows OS with older Python version (<3), win_inet_pton module is require. This avoid exception "AttributeError:
'module' object has no attribute 'inet_pton'".
install win_inet_pton:
.. code-block:: bash
sudo pip install win_inet_pton
import win_inet_pton at beginning of your code:
.. code-block:: python
import win_inet_pton
from pyModbusTCP.client import ModbusClient

View File

@@ -0,0 +1,17 @@
pyModbusTCP-0.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyModbusTCP-0.2.0.dist-info/LICENSE,sha256=Q-TwRxZ_Hhz-lD3EK2MX1_4yE70R2LsYsWlVkA5ehwc,1077
pyModbusTCP-0.2.0.dist-info/METADATA,sha256=s_G48prmszSpewo_NjN7HBo7ze5KXNVWCucjO9Lye_8,4051
pyModbusTCP-0.2.0.dist-info/RECORD,,
pyModbusTCP-0.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
pyModbusTCP-0.2.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
pyModbusTCP-0.2.0.dist-info/top_level.txt,sha256=KRHQLFpsqJYQ-jdIEWwFlxPCXzZAiVQEFCQCJ6GNnRw,12
pyModbusTCP/__init__.py,sha256=Xp8ER4VG_qI50ojUmNnyWdVMTPAPsxbK8vN461YIt1Y,717
pyModbusTCP/__pycache__/__init__.cpython-311.pyc,,
pyModbusTCP/__pycache__/client.cpython-311.pyc,,
pyModbusTCP/__pycache__/constants.cpython-311.pyc,,
pyModbusTCP/__pycache__/server.cpython-311.pyc,,
pyModbusTCP/__pycache__/utils.cpython-311.pyc,,
pyModbusTCP/client.py,sha256=Lqi2iq4WIIdVQOgUUm8ZQ7xjXkAZaB5Sgbo8phFgF3o,30184
pyModbusTCP/constants.py,sha256=UIG-q8WNSH49jAcOUh_yaa8s5VKhqb3UAiYsbCYFHAg,3806
pyModbusTCP/server.py,sha256=mMZYXfsnI7Z2PObLcBfSqzNoE_OgBEUELvkL_l8U3l4,41133
pyModbusTCP/utils.py,sha256=76P96-uYITF-YEPEnkVSQZmRcBInZRK7tyaXIkuWtG8,8975

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.41.2)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1 @@
pyModbusTCP