{"id":15108873,"url":"https://github.com/freeopcua/python-opcua","last_synced_at":"2025-05-15T06:02:17.753Z","repository":{"id":37706554,"uuid":"31074280","full_name":"FreeOpcUa/python-opcua","owner":"FreeOpcUa","description":"LGPL Pure Python OPC-UA Client and Server","archived":false,"fork":false,"pushed_at":"2024-05-18T14:28:47.000Z","size":10464,"stargazers_count":1409,"open_issues_count":424,"forks_count":661,"subscribers_count":107,"default_branch":"master","last_synced_at":"2025-04-14T08:12:55.458Z","etag":null,"topics":["iec-62541","library","opc","opc-ua","protocol","python","python3"],"latest_commit_sha":null,"homepage":"http://freeopcua.github.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreeOpcUa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-20T16:46:53.000Z","updated_at":"2025-04-04T13:57:43.000Z","dependencies_parsed_at":"2023-01-25T13:15:06.681Z","dependency_job_id":"d842c562-2781-423f-a40b-0cca0ed4761b","html_url":"https://github.com/FreeOpcUa/python-opcua","commit_stats":{"total_commits":1218,"total_committers":121,"mean_commits":"10.066115702479339","dds":0.5812807881773399,"last_synced_commit":"fdf5f3c6c8655c90b0d36ce6a8db54749e8daeb4"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeOpcUa%2Fpython-opcua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeOpcUa%2Fpython-opcua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeOpcUa%2Fpython-opcua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeOpcUa%2Fpython-opcua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreeOpcUa","download_url":"https://codeload.github.com/FreeOpcUa/python-opcua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283336,"owners_count":22045140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iec-62541","library","opc","opc-ua","protocol","python","python3"],"created_at":"2024-09-25T22:41:53.227Z","updated_at":"2025-05-15T06:02:17.684Z","avatar_url":"https://github.com/FreeOpcUa.png","language":"Python","readme":"Pure Python OPC UA / IEC 62541 Client and Server Python 2, 3 and pypy.\nhttp://freeopcua.github.io/, https://github.com/FreeOpcUa/python-opcua\n\n[![Build Status](https://travis-ci.org/FreeOpcUa/python-opcua.svg?branch=master)](https://travis-ci.org/FreeOpcUa/python-opcua)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/FreeOpcUa/python-opcua/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/FreeOpcUa/python-opcua/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/FreeOpcUa/python-opcua/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/FreeOpcUa/python-opcua/?branch=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/f7f9a138ee7c4541b3b794b86e61e929)](https://www.codacy.com/app/olivier-roulet/python-opcua)\n[![Code Climate](https://codeclimate.com/github/FreeOpcUa/python-opcua/badges/gpa.svg)](https://codeclimate.com/github/FreeOpcUa/python-opcua)\n\n[![PyPI Package](https://badge.fury.io/py/opcua.svg)](https://badge.fury.io/py/opcua)\n\n# The library is deprecated. \n# Please switch to : [opcua-asyncio](https://github.com/FreeOpcUa/opcua-asyncio) which also has a [sync-wrapper](https://github.com/FreeOpcUa/opcua-asyncio/blob/master/asyncua/sync.py), with very few changes in API**\n\n**PR to fix bugs to python-opcua are welcome, but if you want to write new fancy features or architectural changes, please look at opcua-asyncio**\n\n**Why asyncio? because it makes code easier to read and safer(read: less chances for bugs) and since python is monoprocess it might even be faster. It is also a good timing to remove all Python2 code**\n\n\nOPC UA binary protocol implementation is quasi complete and has been tested against many different OPC UA stacks. API offers both a low level interface to send and receive all UA defined structures and high level classes allowing to write a server or a client in a few lines. It is easy to mix high level objects and low level UA calls in one application.\n\nMost low level code is autogenerated from xml specification, thus adding missing functionality to client or server is often trivial.\n\ncoverage.py reports a test coverage of over 95 % of code, most of non-tested code is autogenerated code that is not used yet.\n\n\n# Installation\n\nWith pip (note: the package was ealier called freeopcua)\n\n    pip install opcua\n\nUbuntu:\n\n    apt install python-opcua        # Library\n    apt install python-opcua-tools  # Command-line tools\n\nDependencies:\n* Python \u003e 3.4: `cryptography`, `dateutil`, `lxml` and `pytz`. \n* Python 2.7 or pypy \u003c 3: you also need to install `enum34`, `trollius` (`asyncio`), and `futures` (`concurrent.futures`),\n  with pip for example.\n\n\n# Documentation\n\nSome documentation is available on [ReadTheDocs](http://python-opcua.readthedocs.org/en/latest/).\n\nA simple GUI client is available: https://github.com/FreeOpcUa/opcua-client-gui\n\nExamples: https://github.com/FreeOpcUa/python-opcua/tree/master/examples\n\nMinimal client example: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/client-minimal.py\nMinimal server example: https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py\n\nA set of command line tools also available: https://github.com/FreeOpcUa/python-opcua/tree/master/tools\n* `uadiscover `(find_servers, get_endpoints and find_servers_on_network calls)\n* `uals `(list children of a node)\n* `uahistoryread`\n* `uaread `(read attribute of a node)\n* `uawrite `(write attribute of a node)\n* `uacall `(call method of a node)\n* `uasubscribe `(subscribe to a node and print datachange events)\n* `uaclient `(connect to server and start python shell)\n* `uaserver `(starts a demo OPC UA server)  \n  `tools/uaserver --populate --certificate cert.pem --private_key pk.pem`\n\nHow to generate certificate: https://github.com/FreeOpcUa/python-opcua/tree/master/examples/generate_certificate.sh\n\n## Client\n\nWhat works:\n\n* connection to server, opening channel, session\n* browsing and reading attributes value\n* getting nodes by path and nodeids\n* creating subscriptions\n* subscribing to items for data change\n* subscribing to events\n* adding nodes\n* method call\n* user and password\n* history read\n* login with certificate\n* communication encryption\n* removing nodes\n\nTested servers: freeopcua C++, freeopcua Python, prosys, kepware, beckhoff, winCC, B\u0026R, …\n\nNot implemented yet:\n\n* localized text feature\n* XML protocol\n* UDP\n* maybe automatic reconnection...\n\n\n## Server\n\nWhat works:\n\n* creating channel and sessions\n* read/set attributes and browse\n* getting nodes by path and nodeids\n* autogenerate address space from spec\n* adding nodes to address space\n* datachange events\n* events\n* methods\n* basic user implementation (one existing user called admin, which can be disabled, all others are read only)\n* encryption\n* certificate handling\n* removing nodes\n* history support for data change and events\n\nTested clients: freeopcua C++, freeopcua Python, uaexpert, prosys, quickopc\n\nNot yet implemented:\n\n* more high level solution to create custom structures\n* UDP\n* session restore\n* alarms\n* XML protocol\n* views\n* localized text features\n* better security model with users and password\n\n\n### Running a server on a Raspberry Pi\n\nSetting up the standard address-space from XML is the most time-consuming step of the startup process which may lead to\nlong startup times on less powerful devices like a Raspberry Pi. By passing a path to a cache-file to the server constructor,\na shelve holding the address space will be created during the first startup. All following startups will make use of the\ncache-file which leads to significantly better startup performance (~3.5 vs 125 seconds on a Raspberry Pi Model B).\n\n\n# Development\n\nCode follows PEP8 apart for line lengths which should be max 120 characters and OPC UA structures that keep camel case\nfrom XML definition.\n\nAll protocol code is under opcua directory\n\n- `opcua/ua` contains all UA structures from specification, most are autogenerated\n- `opcua/common` contains high level objects and methods used both in server and client\n- `opcua/client` contains client specific code\n- `opcua/server` contains server specific code\n- `opcua/utils` contains some utilities function and classes\n- `opcua/tools` contains code for command lines tools\n- `schemas` contains the XML and text files from specification and the python scripts used to autogenerate code\n- `tests` contains tests\n- `docs` contains files to auto generate documentation from doc strings\n- `examples` contains many example files\n- `tools` contains python scripts that can be used to run command line tools from repository without installing\n\n## Running tests:\n\n```\n./run-tests.sh\n```\n\n## Coverage\n\n```\ncoverage run tests.py\ncoverage html\nfirefox htmlcov/index.html\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeopcua%2Fpython-opcua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreeopcua%2Fpython-opcua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeopcua%2Fpython-opcua/lists"}