Sans-IO host library for the pyControl behavioural-experiment framework.
Project description
pycontrol-core
pycontrol-core is the host engine for pyControl. It handles board
communication, the wire protocol, workspace configuration, data logging, task
and experiment extensions, 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
default host output is now a native .pycontrol.zip run bundle, with legacy
TSV/NPY export support for compatibility. See
wire-protocol.md and
data-format.md for the frozen specs.
Install From PyPI Alpha
For the current alpha, allow prereleases:
uv add pycontrol-core --prerelease allow
# or
pip install --pre pycontrol-core
For the GUI workflow, install the app once globally with
pycontrol-install, 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 pytest
uv run ruff check src tests
uv run mypy
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. |
hardware_definitions/ |
Rig wiring files uploaded as hardware_definition.py. |
devices/ |
Workspace device classes uploaded when referenced. |
plugins/task_extensions/ |
Host-side task automation. |
plugins/experiment_extensions/ |
Whole-experiment automation. |
plugins/task_plotters/ |
Optional GUI plotters. |
plugins/task_controls/ |
Optional GUI control panels. |
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 \
--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.extension import TaskExtension
from pycontrol.workspace import Workspace
from pycontrol.analysis.data_import import session_dataframe
Install pandas dataframe helpers into the global app with
pycontrol-install --with-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
New to the project? Start with the repo-level guides:
- Documentation index - map of everything, with a reading order.
- Architecture tour - learn the system end to end.
- Data-flow walkthrough - one packet's journey through the pipeline.
Orientation and operation:
- Getting started
- Writing tasks
- Hardware definitions
- Architecture
- CLI reference
- Troubleshooting
- Migration from pyControl v2
Contracts and internals:
Extending pyControl:
- Task extensions - includes integrations and optional extras.
- Experiment extensions
- Extension settings
- Task sharing archives
Project process:
Contributing
See the repository-level CONTRIBUTING.md for editable installs, tests, contracts, firmware notes, and trusted plugin guidance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycontrol_core-3.0.0a10.tar.gz.
File metadata
- Download URL: pycontrol_core-3.0.0a10.tar.gz
- Upload date:
- Size: 2.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45882fe8305e71402f8d1ebae5ddec5b3996257ca4a2198babab716f621a279a
|
|
| MD5 |
9e1358b14dd9181bdc32a3d7f9bc7400
|
|
| BLAKE2b-256 |
1720e5877027b1d209c728c7dc12d5e6a66e135e7463be52f6f1478c2bbc898d
|
File details
Details for the file pycontrol_core-3.0.0a10-py3-none-any.whl.
File metadata
- Download URL: pycontrol_core-3.0.0a10-py3-none-any.whl
- Upload date:
- Size: 249.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f5a6a61822acaa8e5d2b85d2f1f76409488c50b3a2ea3328b1e2dfb7b61955
|
|
| MD5 |
f80abe6b8e4342ad95883eb4495ac971
|
|
| BLAKE2b-256 |
b347f5084f77664359937ebd3bb1493f6e9106c9df31a1f664f03ada047c51fc
|