Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pycontrol-core

pycontrol-core is the host engine for pyControl. It handles board communication, the wire protocol, workspace configuration, data logging, task and experiment handlers, firmware sync, and the pycontrol command-line tool.

The package is designed so GUI and script frontends share the same tested core:

Pyboard <-> Transport <-> protocol codec <-> BoardSession <-> event bus <-> subscribers

The board wire protocol remains compatible with existing pyControl tasks. The host writes one canonical .pycontrol.zip run bundle per recording, and the analysis importer reads those bundles (not pyControl v2 loose TSV files). See wire-protocol.md and data-format.md for the frozen specs.

Install From PyPI

3.0.0 is in beta, so allow pre-releases:

uv add pycontrol-core --prerelease allow
# or
pip install --pre pycontrol-core

For the GUI workflow, install the app once globally with pycontrol-manager app install, verify it with pycontrol-manager app status, then launch it with pycontrol gui. See getting-started.md.

Install For Development

From this package:

pip install -e ".[test,lint]"

With uv:

uv sync --extra test --extra lint

Run checks:

uv run python tools/run_tests.py -q
uv run ruff check src tests
uv run ruff format --check src tests
uv run mypy

The test runner enforces a process deadline and reports thread traces if a test hangs. See Testing for focused checks and hardware limits.

Create A Workspace

Most lab-authored files live in a workspace, not inside this package.

pycontrol workspace init my-workspace
cd my-workspace
pycontrol setups add BoxA --port /dev/cu.usbmodemXXXX

The workspace contains:

Path Purpose
tasks/ Task files uploaded to the board, each with its host-side addons (task and experiment handlers, GUI plotters and controls) in its task folder (task-folders.md).
hardware_definitions/ Rig wiring files uploaded as hardware_definition.py.
devices/ Workspace device classes uploaded when referenced.
experiments/*.json Multi-subject experiment definitions.
settings.json / setups.json Workspace settings and setup registry.
data/ Default output folder for native .pycontrol.zip run bundles.

For a full walkthrough, use getting-started.md.

Run A Task

pycontrol run --setup BoxA --task examples/blinker/blinker-pattern-h7 \
  --subject mouse42 --duration 10

--setup looks up the serial port and setup variables from setups.json. --task and --hwdef are resolved against the workspace by stem or by path. Tasks that import hardware_definition need an explicit --hwdef or a setup default hardware definition.

The run command connects to the board, checks firmware status, uploads the hardware definition when the task needs one, uploads the task, starts the framework, and writes a .pycontrol.zip run bundle under the workspace data directory.

Run An Experiment

pycontrol experiment blink_demo --duration 10

Experiment identity comes from the JSON file path under experiments/. For example, experiments/training/day1.json is experiment training/day1.

Experiment JSON supports a first-class optional hardware_definition field. When present, it overrides each setup's default hardware definition for that experiment; when omitted, the setup default is used.

Firmware And Board Checks

BoardSession.connect() performs a read-only firmware status check. It never syncs files automatically.

pycontrol firmware status --setup BoxA
pycontrol firmware sync --setup BoxA
pycontrol board info --setup BoxA --json

Setups can pin an expected MCU so the host refuses the wrong board:

pycontrol setups add BoxH7 --port /dev/cu.usbmodemYYYY --mcu stm32h743
pycontrol setups detect BoxH7

See troubleshooting.md for operator triage.

Public Imports

pycontrol.__init__ exports only __version__. Import from explicit modules:

from pycontrol.session import BoardSession
from pycontrol.recording import NativeEventLogger
from pycontrol.addons import TaskHandler
from pycontrol.workspace import Workspace
from pycontrol.analysis.data_import import session_dataframe

Install pandas dataframe helpers into the global app with pycontrol-manager app extras add analysis, or install pycontrol-core[analysis] in a pip-managed environment. Rig-control, recording, bundles, and the CLI do not require pandas.

See public-api.md for the supported import surface.

Documentation

Start with Understanding one run, then use the references below. Release acceptance distinguishes host verification from the hardware evidence required for lab deployment. Ownership and completion rules are detailed in Threading and state. The tradeoffs to preserve are recorded in Maintainability decisions.

Orientation and operation:

Contracts and internals:

Extending pyControl:

Project process:

Contributing

See CONTRIBUTING.md for local development and review.

Metadata

Release files for pycontrol-core 3.0.0b4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycontrol-core 3.0.0b4
File Size Uploaded Provenance Actions
pycontrol_core-3.0.0b4.tar.gz 642.6 kB Without provenance Details for pycontrol_core-3.0.0b4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycontrol-core 3.0.0b4
File Interpreter ABI Platform Actions
pycontrol_core-3.0.0b4-py3-none-any.whl Python 3 none any Details for pycontrol_core-3.0.0b4-py3-none-any.whl

Total release size: 966.1 kB

Release files / pycontrol_core-3.0.0b4.tar.gz

Download URL pycontrol_core-3.0.0b4.tar.gz
Size 642.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c95df6a77b84b4891cd97cb5314db06195ebdac8c7d1e93e5b1fb39ef1a9b092
BLAKE2b-256 checksum
How to use checksums
7e278da45c871d424604c4e58703b8055d995ae01e06d05136718bf85d446771
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / pycontrol_core-3.0.0b4-py3-none-any.whl

Download URL pycontrol_core-3.0.0b4-py3-none-any.whl
Size 323.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72e9ef88c150dc115e78224b4136910aadbfd6ba58c927ebeb400573bf634188
BLAKE2b-256 checksum
How to use checksums
7c936b37ba9969df232601e7373ca8770fdf19d7a2f766f5308cebe456e75a89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for pycontrol-core 3.0.0b4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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