Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
be0c7a0
can now pip instal in editable mode
Poofjunior Apr 14, 2022
ef9936e
updating readme
Poofjunior Apr 14, 2022
69e11f0
fixing readme bug
Poofjunior Apr 14, 2022
4fff7ba
adding udev rules
Poofjunior Apr 14, 2022
d974ee4
device_names is now a default dict; examples now also work on linux
Poofjunior Apr 14, 2022
fbdacbd
fixing pdf link; tweaking serial port to use ftdi rule
Poofjunior Apr 15, 2022
33d8cc8
Update README.md
Poofjunior Apr 15, 2022
0191b23
PEP 563 return type hints
Poofjunior Apr 18, 2022
6a73a99
grand messages.py refactor
Poofjunior Apr 19, 2022
4108f6b
more message.py refactor
Poofjunior Apr 19, 2022
e3457bb
adding harp rules
Poofjunior Apr 19, 2022
455de81
adding simple behavior io stuff
Poofjunior Apr 19, 2022
4e5e58f
adding prelim behavior driver
Poofjunior Apr 19, 2022
0e47767
adding a string representation
Poofjunior Apr 20, 2022
43629c0
added __str__ and active mode script
Poofjunior Apr 21, 2022
edfc361
printing DI event changes works
Poofjunior Apr 21, 2022
d5d835a
updating how payload is parsed
Poofjunior Apr 21, 2022
3a122a3
adding enabling of events
Poofjunior Apr 22, 2022
2fc5c58
adding inWaiting to reads
Poofjunior Apr 22, 2022
3f7dfba
read dumped registers
Poofjunior Sep 28, 2023
401bd36
expose more core features
Poofjunior Dec 21, 2023
ac57cb3
Merge pull request #1 from AllenNeuralDynamics/dev/editable_mode
Poofjunior Dec 21, 2023
c2bba09
add WriteU32 and WriteS32
Poofjunior Dec 21, 2023
fb54476
fix signed error in WriteS32
Poofjunior Dec 21, 2023
e7900d4
add debug level logging.
Poofjunior Jan 12, 2024
1b1e833
Added ReadS32 and refactored WriteS32 to handle array inputs
jessy-liao May 17, 2024
325769c
Merge pull request #2 from jessy-liao/master
Poofjunior Jul 18, 2024
368e346
Add threaded serial port
patricklatimer Oct 30, 2024
2381e8f
clean up formatting changes
patricklatimer Feb 12, 2025
9e30545
add event_count method and update test
patricklatimer Feb 12, 2025
0d993bb
remove unused import
patricklatimer Feb 12, 2025
583a270
undo formatting change
patricklatimer Feb 12, 2025
556e512
remove python-versions pin
patricklatimer Feb 12, 2025
efdefc5
add future import for list annotations
patricklatimer Feb 13, 2025
0a15ab2
fix future import
patricklatimer Feb 13, 2025
7281aca
Merge pull request #4 from AllenNeuralDynamics/feat/threading
Poofjunior Feb 13, 2025
c68f87b
update wait-for-events example
Poofjunior Feb 21, 2025
de151be
remove extraneous call
Poofjunior Feb 21, 2025
e3c338d
Merge pull request #5 from AllenNeuralDynamics/feat/example_update
Poofjunior Feb 22, 2025
e86eb29
Convert project to uv
MicBoucinha Mar 19, 2025
0163e17
Define docstyle convention
MicBoucinha Mar 19, 2025
15ac05e
Update default vscode settings
ZegCricket Mar 19, 2025
efceffd
Add docs to the project
ZegCricket Mar 19, 2025
627b1db
Delete poetry.lock
ZegCricket Mar 19, 2025
23a2c08
Update .gitignore and README
ZegCricket Mar 19, 2025
c9a1615
Merge pull request #1 from fchampalimaud/feature/docs_init
MicBoucinha Mar 20, 2025
b121ab1
Chore: remove shebangs from example scripts
ZegCricket Mar 24, 2025
3f1b5f8
Cleanup unused code
MicBoucinha Mar 25, 2025
2e4f216
Remove ReadXXHarpMessage classes
MicBoucinha Mar 25, 2025
00217d4
Move base classes
MicBoucinha Mar 25, 2025
2716ce8
Formatting
MicBoucinha Mar 25, 2025
0f57b08
Update protocol link
MicBoucinha Mar 25, 2025
9b86a45
Convert usage of ReadXX classes to device related methods
MicBoucinha Mar 25, 2025
bcfcf3c
Remove ReadXX methods from HarpMessage
MicBoucinha Mar 25, 2025
f474503
Extract unrelated Enum members
MicBoucinha Mar 25, 2025
ab0a7da
Add read_S64 and read_U64 methods to Device
MicBoucinha Mar 25, 2025
0859612
Create write_XXX methods on Device
MicBoucinha Mar 25, 2025
a7f595c
Merge branch 'feature/refactor_messages' into develop
MicBoucinha Mar 25, 2025
472e1a5
Add dump parameter to Device's write methods
MicBoucinha Apr 2, 2025
904040d
Change default name and changed visibility of control registers methods
MicBoucinha Apr 2, 2025
4af5567
Refactor timeout assignment and correct payload string formatting
MicBoucinha Apr 2, 2025
a2b8cc0
Update current_device_names
MicBoucinha Apr 2, 2025
45ee965
Add support for device's serial number
MicBoucinha Apr 2, 2025
20c2c59
Remove unused method
MicBoucinha Apr 2, 2025
1aecf2a
Update README
MicBoucinha Apr 2, 2025
b9819aa
Update documentation dependencies
MicBoucinha Apr 2, 2025
2ca3e4f
Update mkdocs configuration
MicBoucinha Apr 2, 2025
fb78b31
Move examples to documentation folder
MicBoucinha Apr 2, 2025
4dd42e8
Update documentation
MicBoucinha Apr 2, 2025
8cd50ad
Add context manager support to Device class
MicBoucinha Apr 2, 2025
13924db
Chore: add pytest configs to vscode workspace settings
ZegCricket Apr 4, 2025
413f36c
Docs: separate examples in different pages
ZegCricket Apr 4, 2025
f0266cc
Docs: modify documentation organizational, functional and visual aspects
ZegCricket Apr 4, 2025
53b41a4
Docs: modify home page
ZegCricket Apr 4, 2025
b80d79b
Test: comment incorrect tests to fix in the future
ZegCricket Apr 4, 2025
d87c1ae
Docs: add documentation to HarpMessage and Device classes
ZegCricket Apr 4, 2025
56b9df3
Refactor: change base.py enums to IntEnums
ZegCricket Apr 4, 2025
c677429
Refactor: rename functions to follow a consistent naming pattern
ZegCricket Apr 4, 2025
74dd5c4
Refactor: move DeviceMode to base.py
ZegCricket Apr 4, 2025
df43bde
Refactor: make some class members private
ZegCricket Apr 4, 2025
27dc1c8
Refactor: modify way of sending write harp messages
ZegCricket Apr 4, 2025
355e90c
Refactor: misc changes
ZegCricket Apr 4, 2025
2adbdc3
Feature: add HarpMessage.create static method
ZegCricket Apr 6, 2025
152a28d
Docs: add comments to the remaining code
ZegCricket Apr 6, 2025
09e0dd6
Feature: add classes in base.py to root pyharp namespace
ZegCricket Apr 6, 2025
c7fea61
Feature: remove read_xx and write_xx Device methods
ZegCricket Apr 6, 2025
8f52e90
Docs: reorganize examples section
ZegCricket Apr 6, 2025
c853f05
Docs: add olfactometer example
ZegCricket Apr 6, 2025
5c77aa6
Docs: add pyharp core API to documentation
ZegCricket Apr 6, 2025
70d4bbf
Merge branch 'feature/update_docs' into develop
MicBoucinha Apr 9, 2025
299b4d0
Change dump file usage convention
MicBoucinha Apr 9, 2025
b924837
Change DeviceMode to OperationMode for official Harp documentation co…
MicBoucinha Apr 9, 2025
1d12633
Change return type of Device's send method
MicBoucinha Apr 9, 2025
98046e6
Update and add missing OperationControl methods
MicBoucinha Apr 9, 2025
9959cdd
Update docs links
MicBoucinha Apr 9, 2025
61c2562
Fix doc link
MicBoucinha Apr 9, 2025
d1ef6e0
Comment device tests
MicBoucinha Apr 9, 2025
4398024
Add pytest-cov dev dependency
MicBoucinha Apr 9, 2025
9c04d72
Add is_error to HarpMessage
MicBoucinha Apr 9, 2025
960ce9c
Read Timestamp entry for PayloadType
MicBoucinha Apr 9, 2025
bfcb9ec
Handle HarpMessage with arrays and timestamps
MicBoucinha Apr 16, 2025
7223e0c
Restore read and write methods from Device
MicBoucinha Apr 23, 2025
3f7922f
Remove dump from send method
MicBoucinha Apr 23, 2025
924997b
Add ClockConfig and TimestampOffset
MicBoucinha Apr 23, 2025
3c21927
Add OperationCtrl and ResetMode
MicBoucinha Apr 23, 2025
ec85295
Allow Port control
MicBoucinha Apr 23, 2025
be6f11c
Fix issue with payload property
MicBoucinha Apr 23, 2025
de5a799
Update payload_as_string
MicBoucinha Apr 23, 2025
542de32
Update CommonRegisters members name
MicBoucinha Apr 23, 2025
5796621
Update send method to receive HarpMessage
MicBoucinha Apr 23, 2025
6b69b65
Remove unused methods
MicBoucinha Apr 23, 2025
897ffd3
Fix bug with uninitialized fields and wrong property call
MicBoucinha Apr 23, 2025
9dfcf15
Fix bug on Device's send method
MicBoucinha Apr 30, 2025
2fd965f
Handle empty replies
MicBoucinha Apr 30, 2025
4e3ee84
Fix bug with str method
MicBoucinha Apr 30, 2025
f310406
Reformat
MicBoucinha May 20, 2025
721fcb4
Update pre-commit config
MicBoucinha May 20, 2025
d6a886a
Add monorepo-plugin to mkdocs
MicBoucinha May 20, 2025
0f7bb9f
Fix typo
MicBoucinha May 20, 2025
b977d7d
Test new module structure
MicBoucinha May 20, 2025
9e9a95a
Update project
MicBoucinha May 20, 2025
47c3feb
Merge branch 'feature/pyharp_namespace' into develop
MicBoucinha May 22, 2025
b8e4bed
Delete behavior driver
MicBoucinha May 22, 2025
9aedecf
Move device.py and harp_serial.py to communication folder
MicBoucinha May 22, 2025
2ff6bc2
Move core from docs to protocol
MicBoucinha May 22, 2025
1ae9aee
Update docs links with correct namespaces
MicBoucinha May 22, 2025
55f38d3
Remove duplicated extension from mkdocs config
MicBoucinha May 22, 2025
c1d1a59
Minor fix on example
MicBoucinha May 22, 2025
deef783
Update files to prevent circular imports
MicBoucinha May 23, 2025
74daef6
Update project related information for pushing it to PyPI
MicBoucinha Jun 12, 2025
60bff12
Change namespace to "harp"
MicBoucinha Jun 30, 2025
f50be32
Update minimum Python version
MicBoucinha Jun 30, 2025
3cf6d12
Add "include markdown plugin" to docs
MicBoucinha Jun 30, 2025
c8af5a1
Update version
MicBoucinha Jun 30, 2025
01b42cf
Add dependency to handle dataclasses on documentation generation
MicBoucinha Jul 1, 2025
7ec5518
Update mkdocs config
MicBoucinha Jul 1, 2025
a97fd0a
Update docs
MicBoucinha Jul 2, 2025
d760086
Add CurrentDriver to known device names
MicBoucinha Jul 2, 2025
aca830a
Reorder docs' TOC
MicBoucinha Jul 2, 2025
2113d59
Remove type annotation on Enum
MicBoucinha Jul 2, 2025
ece40f7
Update version
MicBoucinha Jul 2, 2025
3515020
Add github action to build and deploy docs
MicBoucinha Jul 3, 2025
47cfb1d
Update LICENSE
MicBoucinha Jul 18, 2025
39e3ca3
Rename communication namespace to 'serial'
MicBoucinha Aug 5, 2025
4d9a3a4
Remove unnecessary devices folder
MicBoucinha Aug 5, 2025
efa5e04
Fix issue with Visual_en flag
MicBoucinha Aug 27, 2025
d27c226
Fix documentation path for Device
MicBoucinha Aug 27, 2025
77607ae
Implement a Timeout handling strategy
MicBoucinha Aug 27, 2025
11c47df
Update payload handling taking into account the timeout strategy in s…
MicBoucinha Aug 27, 2025
a0be5e2
Reorganize project directory structure
MicBoucinha Aug 27, 2025
87a8b14
Create workspaces for harp-protocol and harp-serial
MicBoucinha Aug 27, 2025
9073f4c
Update docs
MicBoucinha Aug 27, 2025
8c07844
Chore: add pyrefly extension to `extensions.json`
ZegCricket Aug 27, 2025
ee5aa32
Chore: add script to run docs locally on Windows
ZegCricket Aug 27, 2025
594399a
Add harp reference epoch constant
ZegCricket Aug 27, 2025
93aa50c
Fix issues with types
ZegCricket Aug 27, 2025
2481ec1
Docs: fix imports from examples to take the new project structure int…
ZegCricket Aug 27, 2025
ea50e70
Refactor: simplify WriteHarpMessage handling of PayloadType
ZegCricket Sep 16, 2025
713c934
Chore: add VSCode setting that enables pyrefly to display type errors
ZegCricket Sep 16, 2025
36ec9ad
Removed custom message from exceptions
MicBoucinha Sep 16, 2025
3272e10
Pin harp-protocol version on harp-serial
MicBoucinha Sep 16, 2025
34de54d
Fix: raise HarpReadException for missing timestamp in ReplyHarpMessage
MicBoucinha Sep 16, 2025
a107ebb
Add LaserDriverController to device_names
MicBoucinha Sep 16, 2025
ed7388a
Refactor payload handling in HarpMessage to properly support Python 3.9
MicBoucinha Sep 16, 2025
fbd7d64
Add operation_ctrl methods to device
MicBoucinha Sep 18, 2025
af7e79f
Update documentation
MicBoucinha Sep 18, 2025
5ea52bb
Fix tests
MicBoucinha Sep 18, 2025
25f0445
Merge branch 'feature/workspaces' into develop
MicBoucinha Sep 18, 2025
d7a6a63
Remove unnecessary udev rules file
MicBoucinha Oct 8, 2025
d454897
Refactor HARP_VERSION to CORE_VERSION
MicBoucinha Oct 8, 2025
4162bff
Update documentation
MicBoucinha Oct 8, 2025
6e714ec
Refactor base.py enums for consistency and clarity
MicBoucinha Oct 8, 2025
9a440b2
Refactor HarpMessage to consolidate message creation
MicBoucinha Oct 9, 2025
ed8fca5
Remove HarpMessage.create static method
MicBoucinha Oct 9, 2025
78cce0e
Refactor HarpMessage to remove ReplyHarpMessage
MicBoucinha Oct 17, 2025
6f97c92
Refactor timeout variables
MicBoucinha Oct 17, 2025
1f24190
Rename HarpTimeoutError to HarpTimeoutException and add context to it
MicBoucinha Oct 17, 2025
36a8363
Update comment
MicBoucinha Oct 17, 2025
e97480c
Add HarpMessage context to Harp exceptions
MicBoucinha Oct 22, 2025
8e84b3a
Remove constraint when creating HarpMessage
MicBoucinha Oct 22, 2025
aa564c7
Change build system
MicBoucinha Oct 22, 2025
3d8d10d
Remove device_names
MicBoucinha Oct 22, 2025
ccdef2a
Handle potential serial connection errors
MicBoucinha Oct 22, 2025
c24c51f
Update minimum Python version
MicBoucinha Oct 22, 2025
e1025d5
Fix: write events to dump file
ZegCricket Oct 23, 2025
5676d38
Merge remote-tracking branch 'origin/feature/dump_events_to_file' int…
MicBoucinha Oct 23, 2025
1fbfb2d
Refactor to improve message reading and timeout handling in Device
MicBoucinha Oct 24, 2025
5f62673
Separate docs from dev dependencies
MicBoucinha Oct 24, 2025
c61184b
Bump version of packages
MicBoucinha Oct 24, 2025
7523b47
Update documentation
MicBoucinha Oct 24, 2025
ede6aa4
Merge branch 'feature/pr_review_changes' into develop
MicBoucinha Oct 24, 2025
6f5cde3
Update docs
MicBoucinha Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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
Copy link
Member

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.

Copy link
Author

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.

token: ${{ secrets.HARP_DEVICES_TOKEN }}
path: harp.devices

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install project dependencies
run: |
uv sync --group docs --group dev

- 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
180 changes: 174 additions & 6 deletions .gitignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.vscode should be added to the list

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we keep the .vscode directory in the repo is because it has the extensions (and respective settings) we actively use for development and that we would like for contributors to use as well. Do you have an alternative suggestion regarding this matter?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not include it at all since vscode is not required for development and even if people use vscode they may use different extensions. Anything that you want contributors to follow should be enforced via standard metadata files and linting (e.g. pyproject.toml and github actions)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering where this .gitignore is coming from. It seems quite opinionated. Is there a reason to exclude so much stuff? Are you really expecting people to use pdm, celery and flask to develop this library?

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
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an action only?
I might be missing something, but personally, I prefer to have checks locally before committing when possible.
We can discuss this further.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-commits are something we need to rely on people installing. GitHub actions are something we can enforce during PRs.
Pre-commits can be bypassed locally, github actions can't
I can't verify the output of a pre-commit hook that runs in your PC, but I can verify the log of a GitHub action.

You are right that doesnt need to be an action "only", but if we are maintaining one thing, let it be the github action.

- 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
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-python.python",
"charliermarsh.ruff",
"meta.pyrefly"
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
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",
}
1 change: 1 addition & 0 deletions LICENSE
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change it when the move of the repo to harp-tech is imminent.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 OEPS & Filipe Carvalho
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, same as answered previously,

We can change it when the move of the repo to harp-tech is imminent.

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
Expand Down
71 changes: 6 additions & 65 deletions README.md
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.
12 changes: 12 additions & 0 deletions docs/api/protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% 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
6 changes: 6 additions & 0 deletions docs/api/serial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% include-markdown "../../src/harp-serial/README.md" %}

---

::: harp.serial.Device
::: harp.serial.TimeoutStrategy
Binary file added docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading