Commit 302c4343 authored by Olivier's avatar Olivier Committed by oroulet

fixes in pyproject.toml, update readme to use uv

parent 44266819
......@@ -27,9 +27,9 @@ Version 0.9.9 introduces some argument renaming due to more automatic code gener
# Installation
With pip
With uv/pip
pip install asyncua
uv pip install asyncua
# Usage
......@@ -85,16 +85,16 @@ Minimal server example: https://github.com/FreeOpcUa/opcua-asyncio/blob/master/e
A set of command line tools also available: https://github.com/FreeOpcUa/opcua-asyncio/tree/master/tools
- `uadiscover `(find_servers, get_endpoints and find_servers_on_network calls)
- `uals `(list children of a node)
- `uahistoryread`
- `uaread `(read attribute of a node)
- `uawrite `(write attribute of a node)
- `uacall `(call method of a node)
- `uasubscribe `(subscribe to a node and print datachange events)
- `uaclient `(connect to server and start python shell)
- `uaserver `(starts a demo OPC UA server)
`tools/uaserver --populate --certificate cert.pem --private_key pk.pem`
- `uadiscover `(find_servers, get_endpoints and find_servers_on_network calls)
- `uals `(list children of a node)
- `uahistoryread`
- `uaread `(read attribute of a node)
- `uawrite `(write attribute of a node)
- `uacall `(call method of a node)
- `uasubscribe `(subscribe to a node and print datachange events)
- `uaclient `(connect to server and start python shell)
- `uaserver `(starts a demo OPC UA server)
`tools/uaserver --populate --certificate cert.pem --private_key pk.pem`
How to generate certificate: https://github.com/FreeOpcUa/opcua-asyncio/tree/master/examples/generate_certificate.sh
......@@ -102,61 +102,61 @@ How to generate certificate: https://github.com/FreeOpcUa/opcua-asyncio/tree/mas
What works:
- connection to server, opening channel, session
- browsing and reading attributes value
- getting nodes by path and nodeids
- creating subscriptions
- subscribing to items for data change
- subscribing to events
- adding nodes
- method call
- user and password
- history read
- login with certificate
- communication encryption
- removing nodes
- connection to server, opening channel, session
- browsing and reading attributes value
- getting nodes by path and nodeids
- creating subscriptions
- subscribing to items for data change
- subscribing to events
- adding nodes
- method call
- user and password
- history read
- login with certificate
- communication encryption
- removing nodes
Tested servers: freeopcua C++, freeopcua Python, prosys, kepware, beckhoff, winCC, B&R, …
Not implemented yet:
- localized text feature
- XML protocol
- UDP (PubSub stuff)
- WebSocket
- maybe automatic reconnection...
- localized text feature
- XML protocol
- UDP (PubSub stuff)
- WebSocket
- maybe automatic reconnection...
## Server support
What works:
- creating channel and sessions
- read/set attributes and browse
- getting nodes by path and nodeids
- autogenerate address space from spec
- adding nodes to address space
- datachange events
- events
- methods
- basic user implementation (one existing user called admin, which can be disabled, all others are read only)
- encryption
- certificate handling
- removing nodes
- history support for data change and events
- more high level solution to create custom structures
- creating channel and sessions
- read/set attributes and browse
- getting nodes by path and nodeids
- autogenerate address space from spec
- adding nodes to address space
- datachange events
- events
- methods
- basic user implementation (one existing user called admin, which can be disabled, all others are read only)
- encryption
- certificate handling
- removing nodes
- history support for data change and events
- more high level solution to create custom structures
Tested clients: freeopcua C++, freeopcua Python, uaexpert, prosys, quickopc
Not yet implemented:
- UDP (PubSub stuff)
- WebSocket
- session restore
- alarms
- XML protocol
- views
- localized text features
- better security model with users and password
- UDP (PubSub stuff)
- WebSocket
- session restore
- alarms
- XML protocol
- views
- localized text features
- better security model with users and password
### Running a server on a Raspberry Pi
......@@ -172,53 +172,48 @@ from XML definition.
All protocol code is under opcua directory
- `asyncua/ua` contains all UA structures from specification, most are autogenerated
- `asyncua/common` contains high level objects and methods used both in server and client
- `asyncua/client` contains client specific code
- `asyncua/server` contains server specific code
- `asyncua/utils` contains some utilities function and classes
- `asyncua/tools` contains code for command lines tools
- `schemas` contains the XML and text files from specification and the python scripts used to autogenerate code
- `tests` contains tests
- `docs` contains files to auto generate documentation from doc strings
- `examples` contains many example files
- `examples/sync` contains many example files using sync API
- `tools` contains python scripts that can be used to run command line tools from repository without installing
## Running tests:
- `asyncua/ua` contains all UA structures from specification, most are autogenerated
- `asyncua/common` contains high level objects and methods used both in server and client
- `asyncua/client` contains client specific code
- `asyncua/server` contains server specific code
- `asyncua/utils` contains some utilities function and classes
- `asyncua/tools` contains code for command lines tools
- `schemas` contains the XML and text files from specification and the python scripts used to autogenerate code
- `tests` contains tests
- `docs` contains files to auto generate documentation from doc strings
- `examples` contains many example files
- `examples/sync` contains many example files using sync API
- `tools` contains python scripts that can be used to run command line tools from repository without installing
## Running a command for testing:
```
python -m pip install -r requirements.txt
python -m pip install -r dev_requirements.txt
pytest -v -s
uv run uals -u opc.tcp://localhost:4840/myserver
```
Or
## Running tests:
```
./run-test.sh -v -s
uv run pytest -v -s tests
```
## Coverage
```
pytest -v -s --cov asyncua --cov-report=html
```
Or
```
./run-test.sh -v -s --cov asyncua --cov-report=html
uv run pytest -v -s --cov asyncua --cov-report=html
```
## Linting
To apply linting checks (including ruff, and mypy) at each commit run,
```bash
pip install pre-commit
pre-commit install
uv sync --group lint
uv run pre-commit install
```
You can also run all linters on all files with,
```bash
pre-commit run -a
uv run pre-commit run -a
```
......@@ -36,9 +36,8 @@ classifiers = [
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
]
[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"pytest",
"pytest-asyncio == 0.21.2",
"coverage",
......@@ -50,7 +49,10 @@ dev-dependencies = [
"types-pyOpenSSL",
"types-python-dateutil",
"types-pytz",
"ruff",
]
lint = ["ruff", "mypy", "pre-commit"]
[project.scripts]
uabrowse = "asyncua.tools:uals"
......
#!/bin/sh -e
# Check if virtualenv is available and if it is use it
if command -v virtualenv; then
# Create a virtual venv in order not to pollute
# the main python libs if the venv already
# exist no harm is done
virtualenv -p python3 venv
. venv/bin/activate
# install requirements
python3 -m pip install -r requirements.txt
python3 -m pip install -r dev_requirements.txt
# Execute pytest and pass along the arguments
# used to call this script
pytest $@
else
echo "virtualenv not installed"
# Execute pytest and pass along the arguments
# used to call this script
pytest $@
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment