Skip to main content

Embed an EPICS IOC in a Python process

Project description

Code CI Docs CI Test Coverage Latest PyPI version Apache License

This module allows an EPICS IOC with Python Device Support to be run from within the Python interpreter. Records can be programmatically created and arbitrary Python code run to update them and respond to caputs. It supports cothread and asyncio for concurrency. PVs are served over Channel Access and PVAccess.

PyPI

pip install softioc

Source code

https://github.com/dls-controls/pythonSoftIOC

Documentation

https://dls-controls.github.io/pythonSoftIOC

Changelog

https://github.com/dls-controls/pythonSoftIOC/blob/master/CHANGELOG.rst

A simple example of the use of this library:

# Import the basic framework components.
from softioc import softioc, builder
import cothread

# Set the record prefix
builder.SetDeviceName("MY-DEVICE-PREFIX")

# Create some records
ai = builder.aIn('AI', initial_value=5)
ao = builder.aOut('AO', initial_value=12.45, on_update=lambda v: ai.set(v))

# Boilerplate get the IOC started
builder.LoadDatabase()
softioc.iocInit()

# Start processes required to be run after iocInit
def update():
    while True:
        ai.set(ai.get() + 1)
        cothread.Sleep(1)


cothread.Spawn(update)

# Finally leave the IOC running with an interactive shell.
softioc.interactive_ioc(globals())

See https://dls-controls.github.io/pythonSoftIOC for more detailed documentation.

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

softioc-4.5.0.tar.gz (82.6 kB view hashes)

Uploaded Source

Built Distributions

softioc-4.5.0-cp310-cp310-win_amd64.whl (108.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

softioc-4.5.0-cp310-cp310-manylinux2014_x86_64.whl (114.8 kB view hashes)

Uploaded CPython 3.10

softioc-4.5.0-cp310-cp310-macosx_10_9_x86_64.whl (110.8 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

softioc-4.5.0-cp39-cp39-win_amd64.whl (108.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

softioc-4.5.0-cp39-cp39-manylinux2014_x86_64.whl (114.9 kB view hashes)

Uploaded CPython 3.9

softioc-4.5.0-cp39-cp39-macosx_10_9_x86_64.whl (110.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

softioc-4.5.0-cp38-cp38-win_amd64.whl (108.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

softioc-4.5.0-cp38-cp38-manylinux2014_x86_64.whl (114.9 kB view hashes)

Uploaded CPython 3.8

softioc-4.5.0-cp38-cp38-macosx_10_9_x86_64.whl (110.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

softioc-4.5.0-cp37-cp37m-win_amd64.whl (108.5 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

softioc-4.5.0-cp37-cp37m-manylinux2014_x86_64.whl (114.7 kB view hashes)

Uploaded CPython 3.7m

softioc-4.5.0-cp37-cp37m-macosx_10_9_x86_64.whl (110.7 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

softioc-4.5.0-cp36-cp36m-win_amd64.whl (110.1 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

softioc-4.5.0-cp36-cp36m-manylinux2014_x86_64.whl (114.7 kB view hashes)

Uploaded CPython 3.6m

softioc-4.5.0-cp36-cp36m-macosx_10_9_x86_64.whl (110.7 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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