Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 3.1.2 instead.
Reason given by maintainers: Security descriptions were inaccurate and input-hardening was incomplete; superseded by 3.1.2.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_snap7-3.1.1.tar.gz (199.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_snap7-3.1.1-py3-none-any.whl (141.2 kB view details)

Uploaded Python 3

File details

Details for the file python_snap7-3.1.1.tar.gz.

File metadata

  • Download URL: python_snap7-3.1.1.tar.gz
  • Upload date:
  • Size: 199.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_snap7-3.1.1.tar.gz
Algorithm Hash digest
SHA256 7f54dac9ac5a3bc55b496f9b2ff2729163cd563efb64ccd1d9fe44c02197cd85
MD5 974ed47b8e3983682b7afb99c7ed1534
BLAKE2b-256 90ee3cdfd78c6141b5855253e7a2355a0bd1cdcaec264eb600fb79761053581d

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_snap7-3.1.1.tar.gz:

Publisher: publish-pypi.yml on gijzelaerr/python-snap7

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_snap7-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: python_snap7-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 141.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_snap7-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6d446dc3f51d2b5f934d624dee374eb25157a412fc1d4a69fec6ba02c8cf322
MD5 0ae09d2c3410e34fdb3a2cfa9144417e
BLAKE2b-256 1a957e8e237b219af0516f972789f59ec77284f2b5415204a562ff66f2cbd1cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_snap7-3.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on gijzelaerr/python-snap7

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page