Skip to main content

DPEA_DPi

Python drivers for the DPEA Pi family of circuit boards developed by Stan Reifel.

Installation

Add the package to an exhibit project:

uv add dpeaDPi

On the DPEA Raspberry Pi image, this also installs rpi-lgpio, which provides the RPi.GPIO module used by DPiComputer. The image includes the native build dependencies required by lgpio on Python 3.13.

RS485 drivers do not open /dev/serial0 when they are imported or constructed. The default shared network opens it when the first command is sent. Tests and applications can pass a configured DPiNetwork or another compatible network object into a board constructor. The package does not automatically select a simulated hardware backend.

DPiComputer also initializes GPIO and I2C on first use. Its constructor accepts compatible gpio and i2cBus objects for integration tests.

Testing without hardware

There are three separate layers for running without physical boards. Pick the one that matches what you are doing.

  1. Low-level injection (for this package's own tests). Every driver accepts an injected transport or backend: DPiNetwork(serialPort=...) for the RS485 boards, and DPiComputer(gpio=..., i2cBus=...) for GPIO and I2C. This exercises packet and pin behavior. Consumers should not need to emulate packets or pins.

  2. Board simulation (for consumer applications and tests). The dpeaDPi.simulation package provides a SimulatedDPiXxx for each board with the same public methods as the real driver, so application code runs unchanged against either. Simulated physical input (button presses, sensor changes, motion completion) is driven through a separate .controls object. The simulators use no serial, GPIO, I2C, real sleeps, or threads, and one injected SimClock gives deterministic timing.

    from dpeaDPi.simulation import SimState, SimulatedDPiButton
    
    state = SimState()
    button = SimulatedDPiButton(state=state)
    button.controls.press(0)
    assert button.readRGBButtonLatch(0) == (True, True)
    
    state.fail_next("button", "readRGBButtonLatch")
    assert button.readRGBButtonLatch(0) == (False, False)
    

    Import the simulators explicitly. Nothing is auto-selected based on the operating system, and the real drivers never import this package.

  3. Consumer composition (for structuring an exhibit). Choose real or simulated hardware once, at the application's composition root, and keep the decision out of business logic. See DPi_Examples/consumer_backend for a complete reference, DPi_Examples/simulations for runnable simulated board examples and consumer-side tests, and DPi_Examples for board, application, and diagnostic examples that all run against real or simulated hardware.

Development

Install the locked project and development dependencies:

uv sync --locked --all-groups

Run the tests and build both package distributions:

uv run --locked pytest
uv build --no-sources

Project metadata, runtime dependencies, and the next release version live in pyproject.toml. uv.lock is committed for reproducible development and CI.

Releases

Merging a new package version into main runs the full test and package checks. CI creates a tag such as v1.0.0 from the version in pyproject.toml, then publishes the exact artifacts to PyPI with Trusted Publishing. No manual tag or PyPI upload is required.

Configure the PyPI trusted publisher once with these values:

  • Owner: dpengineering
  • Repository: DPEA_DPi
  • Workflow: publish.yml
  • Environment: pypi

No PyPI token is stored in GitHub.

Download files

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

Source Distribution

dpeadpi-1.1.0.tar.gz (50.9 kB view details)

Uploaded Source

Built Distribution

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

dpeadpi-1.1.0-py3-none-any.whl (68.0 kB view details)

Uploaded Python 3

File details

Details for the file dpeadpi-1.1.0.tar.gz.

File metadata

  • Download URL: dpeadpi-1.1.0.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dpeadpi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 dff4517978281b6b094f4a881aae8971f27554ea8b55ac1ba0495cc3ce1a8383
MD5 e79d83a2262b88acb8d6c3ea6ceb0521
BLAKE2b-256 f3bdc215b19c8540ac1b68b1c326a6f6517e3befd2f9f39c14c07530359e9fd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dpeadpi-1.1.0.tar.gz:

Publisher: publish.yml on dpengineering/DPEA_DPi

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

File details

Details for the file dpeadpi-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: dpeadpi-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 68.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dpeadpi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f851c940d3b28b2fbf8c54fa92b7b08aa9f5c7137c6a78ac58119157dc1d1b87
MD5 6c16fe938d8a60ef7845afed58bba560
BLAKE2b-256 bce65f6c3d3d586ff2d9c5554a04b4d0367c21653569801875f4e41ca9450ed9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dpeadpi-1.1.0-py3-none-any.whl:

Publisher: publish.yml on dpengineering/DPEA_DPi

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

Release history Release notifications | RSS feed

2.0.0

2 files

1.2.1

2 files

1.2.0

2 files

This release

1.1.0 This release

2 files

1.0.1

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page