Skip to content

Commit

Permalink
fixes in pyproject.toml, update readme to use uv
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier authored and oroulet committed Oct 30, 2024
1 parent 4426681 commit 302c434
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 104 deletions.
157 changes: 76 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -85,78 +85,78 @@ 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

## Client support

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

Expand All @@ -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
```
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
20 changes: 0 additions & 20 deletions run-tests.sh

This file was deleted.

0 comments on commit 302c434

Please sign in to comment.