-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor, Protocol Enhancements, and Device Ecosystem Reorganization #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
be0c7a0
ef9936e
69e11f0
4fff7ba
d974ee4
fbdacbd
33d8cc8
0191b23
6a73a99
4108f6b
e3457bb
455de81
4e5e58f
0e47767
43629c0
edfc361
d5d835a
3a122a3
2fc5c58
3f7dfba
401bd36
ac57cb3
c2bba09
fb54476
e7900d4
1b1e833
325769c
368e346
2381e8f
9e30545
0d993bb
583a270
556e512
efdefc5
0a15ab2
7281aca
c68f87b
de151be
e3c338d
e86eb29
0163e17
15ac05e
efceffd
627b1db
23a2c08
c9a1615
b121ab1
3f1b5f8
2e4f216
00217d4
2716ce8
0f57b08
9b86a45
bcfcf3c
f474503
ab0a7da
0859612
a7f595c
472e1a5
904040d
4af5567
a2b8cc0
45ee965
20c2c59
1aecf2a
b9819aa
2ca3e4f
fb78b31
4dd42e8
8cd50ad
13924db
413f36c
f0266cc
53b41a4
b80d79b
d87c1ae
56b9df3
c677429
74dd5c4
df43bde
27dc1c8
355e90c
2adbdc3
152a28d
09e0dd6
c7fea61
8f52e90
c853f05
5c77aa6
70d4bbf
299b4d0
b924837
1d12633
98046e6
9959cdd
61c2562
d1ef6e0
4398024
9c04d72
960ce9c
bfcb9ec
7223e0c
3f7922f
924997b
3c21927
ec85295
be6f11c
de5a799
542de32
5796621
6b69b65
897ffd3
9dfcf15
2fd965f
4e3ee84
f310406
721fcb4
d6a886a
0f7bb9f
b977d7d
9e9a95a
47c3feb
b8e4bed
9aedecf
2ff6bc2
1ae9aee
55f38d3
c1d1a59
deef783
74daef6
60bff12
f50be32
3cf6d12
c8af5a1
01b42cf
7ec5518
a97fd0a
d760086
aca830a
2113d59
ece40f7
3515020
47cfb1d
39e3ca3
4d9a3a4
efa5e04
d27c226
77607ae
11c47df
a0be5e2
87a8b14
9073f4c
8c07844
ee5aa32
594399a
93aa50c
2481ec1
ea50e70
713c934
36ec9ad
3272e10
34de54d
a107ebb
ed7388a
fbd7d64
af7e79f
5ea52bb
25f0445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build Documentation | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout pyharp repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Clone harp.devices repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: fchampalimaud/harp.devices | ||
token: ${{ secrets.HARP_DEVICES_TOKEN }} | ||
path: harp.devices | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
|
||
- name: Install project dependencies | ||
run: | | ||
uv sync | ||
- name: Build documentation | ||
run: | | ||
chmod +x ./run_docs.sh | ||
./run_docs.sh build | ||
- name: Upload Build Artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: site | ||
|
||
|
||
deploy: | ||
name: Deploy to Github pages | ||
needs: build-docs | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .vscode should be added to the list There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason we keep the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,174 @@ | ||
.idea/ | ||
pyharp.egg-info/ | ||
.python-version | ||
__pycache__ | ||
tests/.pytest_cache | ||
**/*.bin | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# UV | ||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
#uv.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control | ||
.pdm.toml | ||
.pdm-python | ||
.pdm-build/ | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ | ||
|
||
# Ruff stuff: | ||
.ruff_cache/ | ||
|
||
# PyPI configuration file | ||
.pypirc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
repos: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest turning this into an action instead of a pre-commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why an action only? |
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v5.0.0" | ||
hooks: | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: check-json | ||
exclude: ^.devcontainer/devcontainer.json | ||
- id: pretty-format-json | ||
exclude: ^.devcontainer/devcontainer.json | ||
args: [--autofix, --no-sort-keys] | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: "v0.11.5" | ||
hooks: | ||
- id: ruff | ||
args: [--exit-non-zero-on-fix] | ||
- id: ruff-format |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-python.python", | ||
"charliermarsh.ruff", | ||
"meta.pyrefly" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
"editor.formatOnSave": true, | ||
"editor.formatOnPaste": true, | ||
"ruff.organizeImports": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
}, | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"python.pyrefly.displayTypeErrors": "force-on", | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this config file is for? But should likely be ignored? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was inherited from the AIND fork, but we agree it can be removed. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# UDEV rules for a Harp Device (actually an ftdi RS232 Serial [Uart] IC) | ||
SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}" | ||
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666", SYMLINK+="harp_device_%E{.LOCAL_ifNum}" |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be changed to harp-tech, similar to what happens with the other software packages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can change it when the move of the repo to |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 OEPS & Filipe Carvalho | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should consider making this standard with the copyright in the other software packages. https://github.com/harp-tech/harp-python/blob/3d97d0b800533e4821896f744e52569c6413c6f7/LICENSE#L3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, same as answered previously,
|
||
Copyright (c) 2025 Hardware and Software Platform, Champalimaud Foundation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,12 @@ | ||
|
||
|
||
# pyharp | ||
|
||
Harp implementation of the Harp protocol. | ||
|
||
## Edit the code | ||
|
||
Each Python user has is own very dear IDE for editing. Here, we are leaving instructions on how to edit this code using pyCharm, Anaconda and Poetry. | ||
|
||
The instructions are for beginner. Most of the users can just skip them. | ||
|
||
This was tested on a Windows machine, but should be similar to other systems. | ||
|
||
|
||
### 1. Install PyCHarm | ||
**PyCharm** can be download from [here](https://www.jetbrains.com/pycharm/download/). The Community version is enough. | ||
Download and install it. | ||
|
||
### 2. Install Anaconda | ||
|
||
**Anaconda** can be found [here](https://www.anaconda.com/products/individual). | ||
Download the version according to your computer and install it. | ||
- Unselect **Add Anaconda to the system PATH environment variable** | ||
- Select ** Register Anaconda as the system Pyhton** | ||
|
||
It's suggested to reboot your computer at this point | ||
|
||
### 3. Install Poetry | ||
|
||
Open the **Command Prompt** and execute the next command: | ||
``` | ||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python | ||
``` | ||
|
||
### 4. Install pyharp | ||
|
||
Open **Anaconda**, navigate to the repository folder and execute the next commands: | ||
``` | ||
poetry install | ||
poetry env info | ||
``` | ||
|
||
The second comand will reply with a **Path:**. | ||
Select and copy this path. | ||
|
||
### 5. Using PyCharm to edit the code | ||
This project includes two main packages: | ||
|
||
1. Open **PyCharm** :) | ||
2. Go to File -> Open, select the repository folder, and click **OK** | ||
3. Go to File -> Settings -> Project:pyharp -> Project Interpreter | ||
3.1 Click in the gear in front of the Project Interpreter: and select **Add...** | ||
3.2 On Virtualenv Environment, chose Existing environment | ||
3.3 Select **python.exe** on the folder Scripts under the path copied from the _poetry env info_ command | ||
3.4 Click **OK** and **OK** | ||
- **harp-protocol**: Provides the core protocol definitions and utilities for the Harp protocol. | ||
See [Protocol API Documentation](https://fchampalimaud.github.io/pyharp/api/protocol) for details. | ||
|
||
You are ready to go! | ||
- **harp-serial**: Implements serial communication functionalities for generic Harp devices. | ||
See [Serial API Documentation](https://fchampalimaud.github.io/pyharp/api/serial) for more information. | ||
|
||
### 6. Test the code | ||
|
||
Under **PyCharm**, Open one of the examples from the folder _examples_ (the _get_info.py_ is generic, so it's a good option) and update the COMx to your COM number. | ||
Right-click on top of the file and chose option _Run 'get_info.py_. You should read something like this in the console: | ||
``` | ||
Device info: | ||
* Who am I: (2080) IblBehavior | ||
* HW version: 1.0 | ||
* Assembly version: 0 | ||
* HARP version: 1.6 | ||
* Firmware version: 1.0 | ||
* Device user name: IBL_rig_0 | ||
``` | ||
For specific Harp devices' packages please select the corresponding Harp device under the Devices section on the menu. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% include-markdown "../../src/harp-protocol/README.md" %} | ||
|
||
--- | ||
|
||
::: harp.protocol.MessageType | ||
::: harp.protocol.PayloadType | ||
::: harp.protocol.CommonRegisters | ||
::: harp.protocol.OperationMode | ||
::: harp.protocol.OperationCtrl | ||
::: harp.protocol.ResetMode | ||
::: harp.protocol.ClockConfig | ||
::: harp.protocol.messages.HarpMessage | ||
::: harp.protocol.messages.ReplyHarpMessage | ||
::: harp.protocol.messages.ReadHarpMessage | ||
::: harp.protocol.messages.WriteHarpMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure the package repository should be coupled with the generation of docs for the devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the long term, we could consider to separate the docs generation from the packages in different repos. The current solution is not set in stone, but we would like to keep the documentation for the generic device and for the specific devices together.