Skip to main content

Extensions to the p4p Server API, to aid in creation and managment of pvAccess servers.

Project description

p4pillon

Extensions to the p4p Server API, to aid in creation and managment of pvAccess servers.

p4pillon

Installation

p4pillon may be installed via

$ pip install p4pillon

Python Version

Requires Python 3.10 or later. These extensions make extensive use of typing and other recent Python features.

Documentation

Documentation intended for developers using the library is available here.

Extensions

A brief overview of the components of the library.

NT Logic

[!CAUTION] This is not an alternative to the Process Database implemented in a traditional EPICS IOC. Although the Normative Type logic is implemented, it does not implement locking. This means that in the case of multiple simultaneous updates it is possible for a PV to become inconsistent. At this time we suggest that the NT Logic code be used for rapid prototyping and systems where consistency/reliability are not critical.

The SharedNT class, derived from p4p's SharedPV class, automatically implements the logic of Normative Types (at this time NTScalars and NTScalarArrays) using handlers. It is possible, with the CompositeHandler class to override this behaviour, including diabling or replacing Normative Type logic.

CompositeHandler and Rules

p4p only allows a single Handler class to be associated with a SharedPV. To make it easier to combine or share handlers from multiple sources a CompositeHandler class is provided. The supplied CompositeHandler is derived from the p4p Handler. It also derives from an OrderedDict to store componenent Handlers (also standard p4p Handlers). The CompositeHandler calls component handlers in the specified order, and allows the component Handlers to be accessed through the OrderedDict interface.

[!NOTE] CompositeHandler is designed to work with the Handler class, and is not designed to work with the Handler decorators.

Rules are component Handlers used with the CompositeHandler used to implement the NT Logic discussed above. The Rule class is derived from the Handler class but implements a commonly encountered flow from put() (for identification and authorisation), to put() (for operations that require comparison between the current state of the PV and its possible future state), and open() (for operations that only need consider the possible future state of the PV).

PVRecipe and Server

PVRecipe is a factory method used to simplify creation of SharedNT objects, i.e. PVs that implement Normative Type logic. It may be used in conjunction with the p4pillon Server class to simplify management of event loops and PV lifecycle.

The config_reader parses a YAML file in order to construct SharedNT PVs which are managed by the p4pillon Server. This is the simplest way to create and configure

Testing

Install the extra dependencies required for testing using pip install .[test] or similar.

To run tests invoke pytest:

$ python -m pytest tests

or to run all tests and output a coverage report:

$ uv run --extra=test python -m coverage run --source=. -m pytest -x tests
$ uv run --extra=test python -m coverage report

Linting and Formatting

This repository's CI/CD pipeling (using GitHub Actions) checks that source code meets PEP 8, and other more stringent, coding standards. This uses the ruff linter and code formatter. It is included in the `.[test] dependencies (see above) and may be manually invoked:

$ ruff check --fix
$ ruff format

Releases

The release process requires use of the .[dist] dependencies, which may be installed with pip install .[dist]. A build may then be triggered with python -m build. Alternatively, use:

$ uv run --extra=dist python -m build

Publication to either PyPi or TestPyPI is performed automatically via CI/CD (i.e. GitHub Actions) and is driven by tags. Any commit intended for package publication must be tagged with a unique tag, and the semantic version must be greater than any existing tag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

p4pillon-0.1.4.5.tar.gz (112.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

p4pillon-0.1.4.5-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file p4pillon-0.1.4.5.tar.gz.

File metadata

  • Download URL: p4pillon-0.1.4.5.tar.gz
  • Upload date:
  • Size: 112.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for p4pillon-0.1.4.5.tar.gz
Algorithm Hash digest
SHA256 2a6f94fea47387f215f41001f25987688a0755a75a992b72156093529256ba6b
MD5 1d6eb46ce29971dfe7005f4e4e80a17d
BLAKE2b-256 07886b8d5f6707a78e7f4805d444994934f6a2d750715fdc62a4f15b2176de83

See more details on using hashes here.

Provenance

The following attestation bundles were made for p4pillon-0.1.4.5.tar.gz:

Publisher: build.yaml on ISISNeutronMuon/p4pillon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file p4pillon-0.1.4.5-py3-none-any.whl.

File metadata

  • Download URL: p4pillon-0.1.4.5-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for p4pillon-0.1.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 885002957aacebdb527fc8665be410237fdeede0cc223eb6fb17344ec6a97e38
MD5 04d7f22208f0b377ac9c37c8c72d4559
BLAKE2b-256 8e8e76cffbbfc78d596b5ad05265b25762dfb4015e8ffac9e8c588bd318ccb0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for p4pillon-0.1.4.5-py3-none-any.whl:

Publisher: build.yaml on ISISNeutronMuon/p4pillon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page