Skip to content
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

Refactor codebase into installable "reprostim" Python module (+ reprostim-videocapture) package #124

Merged
merged 51 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e4433a8
Initial doc sketch for how to RF codebase
yarikoptic Dec 11, 2024
baf9691
ReproStim library empty project with hatch, #116.
vmdocua Dec 13, 2024
9e51900
ReproStim library empty project with hatch, #116.
vmdocua Dec 13, 2024
85db7ca
Move Capture to reprostim-videocapture, #116.
vmdocua Dec 13, 2024
6a53de5
Move Capture to reprostim-videocapture, #116.
vmdocua Dec 13, 2024
92d6a7e
Move Capture to reprostim-videocapture, #116.
vmdocua Dec 13, 2024
d6b89c6
Restrict python package distribution only to src/reprostim and related
yarikoptic Dec 13, 2024
6178449
Added base files for intuit auto release
yarikoptic Dec 13, 2024
e54ab28
Added codespell action, #124.
vmdocua Dec 16, 2024
0515d43
Fixed codespell issues, #124.
vmdocua Dec 16, 2024
d43b4af
Fixed codespell issues, #124.
vmdocua Dec 16, 2024
6643b2b
Turned on pre-commit hook, #124.
vmdocua Dec 16, 2024
7bd75d1
Stick to python 3.10 version (as the best for psychopy), and add pyte…
vmdocua Dec 16, 2024
58af70e
Turned on pre-commit hook, #124.
vmdocua Dec 16, 2024
c00d785
License placeholder, #124.
vmdocua Dec 16, 2024
35e64d9
Hatch reprostim cli stub, #124.
vmdocua Dec 18, 2024
32d9188
Hatch reprostim cli stub, #124.
vmdocua Dec 18, 2024
553c852
Hatch reprostim cli stub, #124.
vmdocua Dec 18, 2024
91ee2bb
Update authors and basic dependencies, #124.
vmdocua Dec 18, 2024
bd121c4
Update dependencies and added optional ones like: test, audio, psycho…
vmdocua Dec 18, 2024
be4d726
Update LICENSE.txt
vmdocua Dec 18, 2024
31c0a9e
Update docs/design/rf-library.md
vmdocua Dec 18, 2024
a7d224c
Created stub/placeholder for commands like qr-parse, timesync-stimuli…
vmdocua Dec 18, 2024
a071c88
Created stub/placeholder for commands like qr-parse, timesync-stimuli…
vmdocua Dec 18, 2024
9719819
Normalize code with pre-commit hooks, #124.
vmdocua Dec 18, 2024
32e8994
Reworked parse_qQR.py to "reprostim qr-parse" command, setup logging …
vmdocua Dec 23, 2024
f6c7197
Nosignal screen sample, #124.
vmdocua Dec 26, 2024
de11fba
Implemented detect-noscreen command, #124.
vmdocua Dec 26, 2024
7534791
Implemented detect-noscreen command, #124.
vmdocua Dec 26, 2024
499b7bf
Implemented detect-noscreen batch command, #124.
vmdocua Dec 26, 2024
fcce207
Removed old nosignal tool implementation, #124.
vmdocua Dec 26, 2024
92000dc
Removed old nosignal tool implementation, #124.
vmdocua Dec 28, 2024
a7e5c77
Refactor reprostim-timesync-stimuli script into timesync-stimuli comm…
vmdocua Dec 28, 2024
6fa9b29
Updated SPDX license headers, #124.
vmdocua Jan 3, 2025
1ffc027
Updated SPDX license headers, #124.
vmdocua Jan 3, 2025
b23cf7e
Updated SPDX license headers, #124.
vmdocua Jan 3, 2025
340e217
REUSE.toml and other licenses, #124.
vmdocua Jan 3, 2025
89c3b7b
Added REUSE check workflow action, #124.
vmdocua Jan 3, 2025
0af7dd7
Remove unused licenses, #124.
vmdocua Jan 3, 2025
2faae42
Remove default python specification for pre-commit, just complicates …
yarikoptic Jan 17, 2025
4640b53
Move imports of actual functionality into click wrappers to speedy --…
yarikoptic Jan 17, 2025
9a51e55
Do not duplicate level (ERROR) in log message itself
yarikoptic Jan 17, 2025
7eb2353
Removed older Python versions as specified by @candleindark , #124.
vmdocua Jan 19, 2025
97da890
Removed older Python versions as specified by @candleindark , #124.
vmdocua Jan 19, 2025
c32bcf5
Use hatch self-referential for dependencies groups like suggested in …
vmdocua Jan 19, 2025
b763628
Set default log level to INFO as suggested by @candleindark, #124.
vmdocua Jan 19, 2025
1e6a41d
Catch2 library migration from v2 to v3 and fix C/C++ CI job, #124.
vmdocua Jan 19, 2025
8037b19
Catch2 library migration from v2 to v3 and fix C/C++ CI job, #124.
vmdocua Jan 19, 2025
6a56541
Catch2 library migration from v2 to v3 and fix C/C++ CI job, #124.
vmdocua Jan 19, 2025
43d7a55
Catch2 library migration from v2 to v3 and fix C/C++ CI job, #124.
vmdocua Jan 19, 2025
1bf01ea
Polishing manual publishing to TestPyPi/PyPi v0.0.7, #124.
vmdocua Jan 21, 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
16 changes: 16 additions & 0 deletions .autorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"onlyPublishWithReleaseLabel": true,
"baseBranch": "master",
"author": "DANDI Bot <[email protected]>",
"noVersionPrefix": true,
"plugins": [
"git-tag",
[
"exec",
{
"afterRelease": "python -m build && twine upload dist/*"
}
],
"released"
]
}
1 change: 1 addition & 0 deletions .codespell-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
acend
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
ignore-words = .codespell-ignore
skip = venv,reprostim-capture,build,cmake-build-debug
8 changes: 4 additions & 4 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ jobs:
cd build
cmake ..
make
working-directory: Capture
working-directory: src/reprostim-capture

- name: Test "reprostim-videocapture -h"
run: |
./reprostim-videocapture -V
./reprostim-videocapture -h
working-directory: Capture/build/videocapture
working-directory: src/reprostim-capture/build/videocapture

- name: Test "reprostim-screencapture -h"
run: |
./reprostim-screencapture -V
./reprostim-screencapture -h
working-directory: Capture/build/screencapture
working-directory: src/reprostim-capture/build/screencapture

- name: Run tests with CTest
run: |
ctest --output-on-failure
working-directory: Capture/build
working-directory: src/reprostim-capture/build
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
57 changes: 57 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Test with pytest and hatch

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
pytest:
name: Test with pytest
runs-on: ubuntu-latest
strategy:
matrix:
python:
- '3.10'
steps:
- name: Configure environment
run: |
git config --global user.name "reprostim-test"
git config --global user.email "[email protected]"
uname -a
date -Is
date -u

- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install hatch and virtual environment
run: |
pwd
ls -l
pip install --upgrade pip
pip install hatch
hatch env create
shell: bash

- name: Run pytest
run: |
hatch run pytest --cov=. --cov-report=xml
shell: bash

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Auto-release on PR merge

on:
# ATM, this is the closest trigger to a PR merging
push:
branches:
- master

jobs:
auto-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download latest auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/latest | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install build & twine
run: python -m pip install build twine

- name: Create release
run: ~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

# vim:set sts=2:
11 changes: 11 additions & 0 deletions .github/workflows/reuse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: REUSE Compliance Check

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v4
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ Videos/
*.pyc
Capture/C++/VideoCapture
venvs
build/
.coverage*
.dir-locals.el
dist/
*.egg-info
.env.*
!.env.local
.flake8
.idea/
.mypy_cache/
*.pid
*.pyc
.python-version
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile=black"]

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
# B008 Do not perform function calls in argument defaults.
# A003 class attribute "id" is shadowing a python builtin
args: ["-j8", "--ignore=B008,A003,E402", "--max-line-length=89"]
additional_dependencies:
- flake8-bugbear
- flake8-builtins
# - flake8-unused-arguments

exclude: '^src/reprostim-capture/.*|.codespellrc'
2 changes: 1 addition & 1 deletion Events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Handheld input pads which are usable inside an MR scanner are connected to the d
## Installation

### Micropython
A device-type-specific micropython distribution file (e.g. `.uf2` or `.dfu`) will need to be downloaded and flashed onto the microcontroller.
A device-type-specific micropython distribution file (e.g. `.uf2` or `.dfu`) will need to be downloaded and flashed onto the microcontroller.
2 changes: 1 addition & 1 deletion Events/listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def listen(command, pyb):
Notes
-----
* This could be set up as a global listener, though that might be overkill just for conveying stimulus events.
* Using `-1` polling to disable timouts, we could use ipoll instead:
* Using `-1` polling to disable timeouts, we could use ipoll instead:
https://docs.micropython.org/en/latest/library/select.html?highlight=poll#select.poll.ipoll
"""

Expand Down
21 changes: 21 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020-2025 ReproNim Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading