pymtconnect
Python model classes generated from the MTConnect SysML specification, plus a small set of helpers for querying a live MTConnect agent.
Every class in this package is generated directly from the MTConnect SysML model, so its structure — names, properties, inheritance — mirrors the specification itself.
Installation
pip install pymtconnect
Quick start
Import generated classes directly from the package root:
from pymtconnect import Device, DataItem, CategoryEnum
Every generated class inherits a from_dict / to_dict / to_json protocol for
JSON (de)serialization, so building an instance from an MTConnect agent's JSON
response — or serializing one back out — needs no extra glue code:
device = Device.from_dict(json_data)
print(device.name, device.uuid)
data = device.to_dict() # plain dict, ready for json.dumps
text = device.to_json(indent=2) # or straight to a JSON string
Querying a live agent
mtconnect_client wraps the MTConnect REST endpoints and returns populated instances
of the generated classes — no raw dicts:
from pymtconnect.mtconnect_client import probe, current, sample, stream_sample
header, devices = probe("http://demo.mtconnect.org")
header, events, conditions = current("http://demo.mtconnect.org")
header, events, conditions = sample("http://demo.mtconnect.org", count=100)
for header, events, conditions in stream_sample("http://demo.mtconnect.org", interval=1000):
... # runs until the connection closes or `timeout` elapses
It can also be run directly as a smoke test against any agent:
python -m pymtconnect.mtconnect_client [agent_url]
For a fuller walk of an agent's device tree — including nested Components and
DataItems, resolved to their most specific generated class — see
probe_example.py:
python -m pymtconnect.probe_example [agent_url]
Both commands default to http://demo.mtconnect.org when agent_url is omitted.
Package layout
| Path | Contents |
|---|---|
Classes/ |
One module per SysML class (Device, DataItem, Component, …) |
Enums/ |
Generated enumerations (CategoryEnum, UnitEnum, …) |
Packages/ |
Package-level groupings mirroring the SysML model's namespaces |
base.py |
MtconnectBase — the from_dict/to_dict/to_json root class |
MtconnectModel.py |
Root entry point into the generated package hierarchy |
mtconnect_client.py |
probe/current/sample/stream_sample helpers for a live agent |
probe_example.py |
Full device-tree probe example with typed component resolution |
License
Apache-2.0
Source
Generated by MtconnectTranspiler.Sinks.Python from the MTConnect SysML model. Issues with the generated package should be filed against MtconnectTranspiler.Sinks.Python.
Metadata
Release files for pymtconnect 1.0.1
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 |
|---|---|---|---|---|
| pymtconnect-1.0.1.tar.gz | 396.9 kB | Without provenance | Details for pymtconnect-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymtconnect-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pymtconnect-1.0.1-py3-none-any.whl |
Total release size: 1.6 MB
Release files / pymtconnect-1.0.1.tar.gz
| Download URL | pymtconnect-1.0.1.tar.gz |
|---|---|
| Size | 396.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b8b1a9f9797082ca2585bcb55d9b420f9f855070442557d77975138cbd7a72d
|
|
BLAKE2b-256 checksum How to use checksums |
a8dfca2a3cc710535282d4a1751db9dccf383d0ac9b9ad8cf7dedc33f2d6ec66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Release files / pymtconnect-1.0.1-py3-none-any.whl
| Download URL | pymtconnect-1.0.1-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
301dac446005b8afc09421b2ed1376935251c93b7c20e120f825282611a056c0
|
|
BLAKE2b-256 checksum How to use checksums |
075b43dde7b7c6011493d5f9e260b7121351de232e22a92717ee67218edc75f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Security for pymtconnect 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.