Pure Python S7 communication library for Siemens PLCs
Project description
About
Python-snap7 is a pure Python S7 communication library for interfacing with Siemens S7 PLCs.
The name “python-snap7” is historical — the library originally started as a Python wrapper around the Snap7 C library. As of version 3.0, the C library is no longer used, but the name is kept for backwards compatibility.
Python-snap7 is tested with Python 3.10+, on Windows, Linux and OS X.
The full documentation is available on Read The Docs.
Quick Start
Connect to any S7 PLC:
import snap7
client = snap7.Client()
client.connect("192.168.1.10", 0, 1)
data = client.db_read(1, 0, 4)
client.disconnect()
No native libraries or platform-specific dependencies are required.
Async support:
import asyncio
import snap7
async def main():
async with snap7.AsyncClient() as client:
await client.connect("192.168.1.10", 0, 1)
data = await client.db_read(1, 0, 4)
asyncio.run(main())
What’s New in 3.1
AsyncClient for asyncio support
Tag API – read/write by name: client.read_tag("DB1.DBD0:REAL") with PLC4X and nodeS7 dialect support
Multi-variable read optimizer – merges scattered reads into minimal PDU exchanges
S7 routing – connect to PLCs on remote subnets via a gateway PLC
Heartbeat monitoring and auto-reconnect with exponential backoff
Structured logging with PLC connection context
PROFINET DCP network discovery
CLI tools for PLC interaction (pip install "python-snap7[cli]")
Numerous bug fixes – see CHANGES.md for the full list
Version 3.0 – Pure Python Rewrite
Version 3.0 was a ground-up rewrite of python-snap7. The library no longer wraps the C snap7 shared library – instead, the entire S7 protocol stack (TPKT, COTP, and S7) is implemented in pure Python.
Portability: No more platform-specific shared libraries (.dll, .so, .dylib). Works on any platform that runs Python – including ARM, Alpine Linux, and other environments where the C library was difficult or impossible to install.
Easier installation: Just pip install python-snap7. No native dependencies, no compiler toolchains, no manual library setup.
Easier to extend: New features and protocol support can be added directly in Python.
Installation
Install using pip:
$ pip install python-snap7
No native libraries or platform-specific dependencies are required — python-snap7 is a pure Python package that works on all platforms.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_snap7-3.1.0.tar.gz.
File metadata
- Download URL: python_snap7-3.1.0.tar.gz
- Upload date:
- Size: 198.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdc0fe5e0ddd57ed67e43d1dec41fe678c6d7c7dfac868227fbcd722ed4f99d2
|
|
| MD5 |
a55278a7281795db64c4a6b49cac8ec7
|
|
| BLAKE2b-256 |
c3075d1c5840348f2c93ac2c267fafc7d6ee88f8ba4f72bf19dc390be770a929
|
Provenance
The following attestation bundles were made for python_snap7-3.1.0.tar.gz:
Publisher:
publish-pypi.yml on gijzelaerr/python-snap7
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_snap7-3.1.0.tar.gz -
Subject digest:
cdc0fe5e0ddd57ed67e43d1dec41fe678c6d7c7dfac868227fbcd722ed4f99d2 - Sigstore transparency entry: 2190031808
- Sigstore integration time:
-
Permalink:
gijzelaerr/python-snap7@2cc95336bd522336168b7af035e5b437b9bf5f34 -
Branch / Tag:
refs/tags/3.1.0 - Owner: https://github.com/gijzelaerr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2cc95336bd522336168b7af035e5b437b9bf5f34 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file python_snap7-3.1.0-py3-none-any.whl.
File metadata
- Download URL: python_snap7-3.1.0-py3-none-any.whl
- Upload date:
- Size: 140.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c3760bc4f81b2a063e76d751e0f0c275ecebc0b87d9979b1052f98947d7b8c8
|
|
| MD5 |
7c2083504b16e6ddd904078a5568505a
|
|
| BLAKE2b-256 |
42f2caffbd602aedbd804bf13439a2030aaf64cf222818eb06ed9c737cbd9a66
|
Provenance
The following attestation bundles were made for python_snap7-3.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on gijzelaerr/python-snap7
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_snap7-3.1.0-py3-none-any.whl -
Subject digest:
9c3760bc4f81b2a063e76d751e0f0c275ecebc0b87d9979b1052f98947d7b8c8 - Sigstore transparency entry: 2190031833
- Sigstore integration time:
-
Permalink:
gijzelaerr/python-snap7@2cc95336bd522336168b7af035e5b437b9bf5f34 -
Branch / Tag:
refs/tags/3.1.0 - Owner: https://github.com/gijzelaerr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2cc95336bd522336168b7af035e5b437b9bf5f34 -
Trigger Event:
workflow_dispatch
-
Statement type: