instro-opcua
Synchronous OPC UA client primitives for instro.
Python 3.11 through 3.14 are supported. The API lives under instro.opcua.
Use instro.opcua to discover endpoints and connect to a server.
Connections use anonymous authentication by default. Pass an IdentityToken
to authenticate with a username or certificate.
Username authentication requires password encryption through the channel or the
server's username token policy by default. Set allow_plaintext_creds=True to
permit a plaintext password.
Discovery and connection use instro/opcua under your local data directory for the certificate store.
On Linux the base directory is $XDG_DATA_HOME or ~/.local/share.
On macOS it is ~/Library/Application Support, and on Windows it is %LOCALAPPDATA%.
If the operating system provides no local data directory, the client uses ./pki.
Pass pki_dir to get_endpoints() to use a different certificate store for discovery.
Install the standalone package from PyPI with uv add instro-opcua or pip install instro-opcua.
The package is also available through the instro[opcua] extra and is included in instro[all].
pip install "instro[opcua]"
from instro.opcua import OpcUaClient
with OpcUaClient.connect("opc.tcp://localhost:4840") as client:
clock = client.get_node("/Objects/Server/ServerStatus/CurrentTime")
sample = clock.value
if sample.status.is_good:
print(sample.value, sample.source_unix_timestamp)
else:
print(sample.status.name())
The client guide covers authentication, navigation, reads, writes, and subscriptions. See the API reference for supported types and connection settings. If the client recreates subscriptions during reconnect, see the known cleanup defect.
Sample and command a configured device
Pass publishers to OpcUaDevice, then call read() or write() to publish the operation.
Both methods accept a browse path from RootFolder or a Node from the device's client.
Reuse a Node to skip path translation on repeated calls.
from instro.lib import FilePublisher
from instro.opcua import OpcUaDevice
publisher = FilePublisher(format="jsonl", directory="telemetry")
with OpcUaDevice("line_1", "line_1.json", publishers=[publisher]) as device:
setpoint = device.client.get_node("/Objects/2:Setpoint")
sample = device.read(setpoint)
print(sample.latest)
device.write(setpoint, 42.0)
The channel name uses the device name and the rooted browse path with explicit
namespace indexes. Nodes with the same rooted path share a channel. Commands add
the .cmd suffix. A command records intent before submission to the server,
so a rejected write can still have a command record. These methods publish
booleans, strings, floats, and integers that can be represented exactly as floats.
Use the native Node API for structured values or access to the complete OPC UA sample.
To publish background samples, add a sampling block alongside connection
and nodes in the device configuration:
{
"connection": {"endpoint_url": "opc.tcp://localhost:4840"},
"nodes": {"setpoint": "/Objects/2:Setpoint"},
"sampling": {
"kind": "subscription",
"sampling_interval_ms": 100
}
}
Opening the device subscribes to the Value attribute of every configured node.
Pass autostart=True to open the connection and start the configured
subscription during construction. Call close() when you are done.
The publishing interval uses the sampling interval by default. A zero or negative
publishing interval requests the fastest supported publishing interval. The device
requests two queue entries per monitored item by default.
By default, the device reads nodes that haven't sent a notification during the
past second. Set poll_interval_ms in the sampling block to change that
period, or set it to null to disable fallback reads. Closing the device
finishes publishing retained samples before closing its publishers.
Development setup and checks are documented in CONTRIBUTING.md.
Metadata
Release files for instro-opcua 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| instro_opcua-1.0.0.tar.gz | 98.7 kB | With provenance | Details for instro_opcua-1.0.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| instro_opcua-1.0.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for instro_opcua-1.0.0-cp310-abi3-win_amd64.whl |
| instro_opcua-1.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for instro_opcua-1.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| instro_opcua-1.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details for instro_opcua-1.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| instro_opcua-1.0.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for instro_opcua-1.0.0-cp310-abi3-macosx_11_0_arm64.whl |
| instro_opcua-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for instro_opcua-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 22.9 MB
Release files / instro_opcua-1.0.0.tar.gz
| Download URL | instro_opcua-1.0.0.tar.gz |
|---|---|
| Size | 98.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f95a97ef6dd73ad93a169f0857aa57e10af4ae406f8eb3f05f43629bfe61eab
|
|
BLAKE2b-256 checksum How to use checksums |
92f9cce474c1219caa2907fb38a37915d1f71b4d4c158ae5ac5627db339ecd5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logRelease files / instro_opcua-1.0.0-cp310-abi3-win_amd64.whl
| Download URL | instro_opcua-1.0.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d317da27457896876468389d104ec8b9704b0392931e0259ddaacadce4f65dac
|
|
BLAKE2b-256 checksum How to use checksums |
a4e2af5ea24c16ff174663d562128c354a76cbf5c300b36523edc7bc0ec4ed0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logRelease files / instro_opcua-1.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | instro_opcua-1.0.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c12d0a49172295d0ded0b567eecbfac3d9a1706f6c472c957543a205ade8f940
|
|
BLAKE2b-256 checksum How to use checksums |
f7be327018f2882ca78894d5f9fcbe7b08f3cbf91798605186b0a9cca15eabc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logRelease files / instro_opcua-1.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | instro_opcua-1.0.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5bd5b8fc477ecaea02a81a41c7283cedb60f2d213ca57e3bef492002e3ba1f9b
|
|
BLAKE2b-256 checksum How to use checksums |
bb83c91fd3ec13130fda3ab6f9c183d3381eb83ce090cfdbe546e656b229c2cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logRelease files / instro_opcua-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | instro_opcua-1.0.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ef31e4f44493c7039fbd02176c727ed1dd6c71e7a5c67c0f6c0809b04f1f219f
|
|
BLAKE2b-256 checksum How to use checksums |
0837548899a653e25ba57b6a33e59cfdff700576e942d186fb7891a74b8edc6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logRelease files / instro_opcua-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | instro_opcua-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c1c3b690a3be953d3471e38ef89ac7e4e8a6e51a0ebedf28cd07c02982699527
|
|
BLAKE2b-256 checksum How to use checksums |
516f1db34febec94afc6ae8f4885872410994898f95b9693cc1b525b601260ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Dec 1, 2026.
Transparency logSecurity for instro-opcua 1.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 6 files in this release have been uploaded with provenance metadata.
Attestation for instro_opcua-1.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 Dec 1, 2026.
Transparency logA 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.