Skip to main content

engiNIR-OPCUA

PyPI Python CI Interoperability Documentation License: LGPL-3.0-or-later

An OPC UA client and server for Python, built on asyncio and secure from the first line.

engiNIR-OPCUA implements OPC UA (IEC 62541, OPC 10000 v1.05) for Python 3.12 and newer: clients, servers, subscriptions, events, alarms and conditions, history, methods, file transfer, redundancy, certificate management and experimental PubSub, with a synchronous API and a command line program on top. Encrypted connections, certificate trust and user roles are switched on by default, and every one of them can be set up in a few lines. Every change is tested against the OPC Foundation's reference stack.

It is a fork of opcua-asyncio 2.1.0. The import package is enginir_opcua and the commands start with enginir-opcua, so it can be installed next to asyncua; the migration guide lists what changed.

Installation

uv add enginir-opcua

or pip install enginir-opcua. The command line program on its own:

uv tool install enginir-opcua

Quick start

A server and a client with a secure channel between them, in one process. Both create a PKI directory with a self-signed certificate. Nothing is trusted automatically, so each side copies the other's certificate into its trusted/certs folder (enginir-opcua pair does the same on the command line).

import asyncio
import shutil

from enginir_opcua import Client, Server


async def main() -> None:
    url = "opc.tcp://127.0.0.1:4840/enginir-opcua/server/"
    server = Server.quickstart(url, pki="server-pki")
    client = Client.quickstart(url, pki="client-pki")
    await server.init()
    await client.init_pki()
    shutil.copy("client-pki/own/certs/application.der", "server-pki/trusted/certs/client.der")
    shutil.copy("server-pki/own/certs/application.der", "client-pki/trusted/certs/server.der")

    idx = await server.register_namespace("urn:example:quickstart")
    temperature = await server.nodes.objects.add_variable(idx, "Temperature", 21.5)
    async with server, client:
        print(await client.get_node(temperature.nodeid).read_value())


asyncio.run(main())

The same with two programs, a users file and the command line is in A Minimal Server and A Minimal Client.

Secure by default

  • Encrypted endpoints. The quick setup offers only SignAndEncrypt with Basic256Sha256, Aes128_Sha256_RsaOaep and Aes256_Sha256_RsaPss. An endpoint without security exists only when you ask for it. Client(url) without a security choice refuses to connect; Client(url, allow_no_security=True) is the explicit request.
  • Profiles. secure is the default; development (this machine only, no security) and legacy (old devices, every policy) are your decision, and every weaker setting is logged at start. See Security Profiles.
  • Explicit trust. Both sides check the peer's certificate at every secure channel, in the order of OPC 10000-4, and trust nobody until a certificate is put into the PKI directory.
  • Users and roles. Anonymous sessions may read, browse and subscribe. Writing, calling methods and changing the address space need a user with the right role; passwords are stored as salted hashes.
  • Hardened. The server is hardened against the attacks known for OPC UA servers, and certificates can be managed from the command line or remotely over OPC UA.
  • Clear errors. A wrong setting raises a ConfigurationError that names it, and a refused certificate is reported with its thumbprint and the command that trusts it.

Command line

Set up the certificates of a server and a client, make them trust each other, start the server and browse it:

enginir-opcua init server srv --endpoint opc.tcp://127.0.0.1:4840/enginir-opcua/server/
enginir-opcua init client cli
enginir-opcua pair srv/pki cli/pki
enginir-opcua server --config srv/server.toml &
enginir-opcua ls -u opc.tcp://127.0.0.1:4840/enginir-opcua/server/ --pki-dir cli/pki -n i=85

enginir-opcua has the subcommands read, write, call, ls, subscribe, history, discover, server, shell and generate-structs, and init, trust, pki, pair and user to set up certificates and users. The client commands need --pki-dir or --security, and --security None asks for a connection without security. The demo server needs --config, --pki-dir or --no-security. See Installation & CLI Tools.

Documentation

The documentation is at https://enginir-opcua.readthedocs.io/en/latest/.

Build the documentation locally with uv run --group docs sphinx-build -b html docs docs/_build/html.

Development

uv sync
git submodule update --init --depth 1 nodeset
uv run pytest -q -m "not slow"
uv run ruff check . && uv run ruff format --check . && uv run mypy enginir_opcua tests

The conventions for code and tests are in AGENTS.md and tests/README.md.

License

LGPL-3.0-or-later; see COPYING, COPYING.GPL and NOTICE. The original library was written by Olivier Roulet-Dubonnet and the opcua-asyncio contributors; this fork was made on 2026-10-25.

Metadata

Release files for enginir-opcua 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enginir-opcua 3.0.0
File Size Uploaded Provenance Actions
enginir_opcua-3.0.0.tar.gz 1.1 MB With provenance Details for enginir_opcua-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enginir-opcua 3.0.0
File Interpreter ABI Platform Actions
enginir_opcua-3.0.0-py3-none-any.whl Python 3 none any Details for enginir_opcua-3.0.0-py3-none-any.whl

Total release size: 2.2 MB

Release files / enginir_opcua-3.0.0.tar.gz

Download URL enginir_opcua-3.0.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
64e0c0237573d6472f6c98390cd49337a4c31af2aefec4895fe62b14862a3300
BLAKE2b-256 checksum
How to use checksums
5818a1d3522b96491eb8a95373450483b9410f59d67576ec2c956084c964b374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / enginir_opcua-3.0.0-py3-none-any.whl

Download URL enginir_opcua-3.0.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bde9c2bfc89f2706cf03705f96d7e79b8e6c1b79071bdc7d974c61a5da79edc5
BLAKE2b-256 checksum
How to use checksums
cdf406879bc980242ef684a43a27ff5be8e34743551e50010c2e1e56386966bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for enginir-opcua 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for enginir_opcua-3.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page