Skip to content

Commit da1de56

Browse files
authored
Merge pull request #830 from int-brain-lab/iblrigv8dev
8.29.0
2 parents da5ec54 + 2da9f17 commit da1de56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+7474
-8471
lines changed

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# EditorConfig is awesome: https://editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# General settings
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
max_line_length = 80
12+
charset = utf-8
13+
14+
# 4 space indentation
15+
[*.py]
16+
max_line_length = 130
17+
indent_style = space
18+
indent_size = 4
19+
20+
# Indentation override for rst files
21+
[*.rst]
22+
indent_style = space
23+
indent_size = 3
24+
25+
# Indentation override for rst and yaml files
26+
[*.{toml,yaml,qrc}]
27+
indent_style = space
28+
indent_size = 2

.github/workflows/documentation.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Set up PDM
22-
uses: pdm-project/setup-pdm@v4
23-
with:
24-
cache: true
25-
python-version-file: pyproject.toml
26-
- name: Install requirements
27-
run: pdm sync -dG doc
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
23+
- name: Install dependencies
24+
run: uv sync --no-default-groups --group doc
2825
- name: Install PortAudio and GraphViz
2926
run: sudo apt-get install -y libportaudio2 graphviz
3027
- name: Sphinx build
31-
run: pdm run sphinx-build docs/source docs/build/html
28+
run: uv run --frozen sphinx-build docs/source docs/build/html
3229
- name: Deploy
3330
uses: peaceiris/actions-gh-pages@v3
3431
with:

.github/workflows/main.yaml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
version-file: 'pyproject.toml'
2121
args: 'check --output-format=github'
2222
- run: 'ruff format --check --diff'
23+
2324
tests:
2425
name: build (${{ matrix.python-version }}, ${{ matrix.os }})
2526
needs: ruff
@@ -33,37 +34,28 @@ jobs:
3334
uses: actions/checkout@v4
3435
with:
3536
fetch-depth: 0
36-
- name: Set up PDM
37-
uses: pdm-project/setup-pdm@v4
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v6
3839
with:
39-
python-version: ${{ matrix.python-version }}
40-
cache: true
41-
- name: Install requirements
42-
run: pdm sync -G project-extraction -dG test -dG ci
43-
- name: Install audio library (Ubuntu only)
40+
activate-environment: true
41+
- name: Install dependencies
42+
run: uv sync --no-default-groups --group test --group ci --extra project-extraction
43+
- name: Install required libraries (Ubuntu only)
4444
if: matrix.os == 'ubuntu-latest'
45-
run: sudo apt-get install -y libportaudio2
46-
- uses: pyvista/setup-headless-display-action@v3
47-
with:
48-
qt: true
49-
pyvista: false
45+
run: sudo apt-get install -y libportaudio2 libegl1 libxkbcommon-x11-0
5046
- name: iblrig unit tests
51-
run: pdm run pytest
47+
run: pytest
48+
env:
49+
QT_QPA_PLATFORM: offscreen
50+
QT_QUICK_BACKEND: software
51+
QT_OPENGL: software
5252
- name: coveralls.io
5353
uses: coverallsapp/github-action@v2
5454
with:
5555
flag-name: ${{ matrix.python-version }}, ${{ matrix.os }}
5656
parallel: true
5757
file: coverage.xml
5858
compare-ref: iblrigv8
59-
- name: Generate requirements_frozen.txt
60-
run: pdm export -o requirements_frozen.txt --no-hashes
61-
- name: Store frozen requirements as artifacts
62-
if: matrix.os == 'ubuntu-latest'
63-
uses: actions/upload-artifact@v4
64-
with:
65-
name: requirements_frozen
66-
path: requirements_frozen.txt
6759

6860
finish:
6961
needs: [ruff, tests]

.github/workflows/release.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Set up PDM
15-
uses: pdm-project/setup-pdm@v4
16-
with:
17-
cache: true
18-
python-version-file: pyproject.toml
19-
- name: Install requirements
20-
run: pdm sync -dG doc
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v6
16+
- name: Install dependencies
17+
run: uv sync --no-default-groups --group doc
18+
- name: Sphinx build
19+
run: uv run --frozen sphinx-build docs/source docs/build/html
2120
- name: Build PDF
22-
run: pdm run make -C docs/ simplepdf
21+
run: uv run --frozen make -C docs/ simplepdf
2322
- name: Upload artifact
2423
uses: actions/upload-artifact@v4
2524
with:

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
8.29.0
5+
------
6+
* added: GUI settings for changing MAIN_SYNC
7+
* fixed: Stop/Pause button not always working for UDP sessions
8+
* changed: use UV for packaging
9+
410
8.28.2
511
------
612
* fixed: ensure that reward amount shown in online plots stays visible at all times
@@ -26,7 +32,7 @@ Changelog
2632
* fixed: online plots included timeout trials
2733
* fixed: online plots showed wrong reward amount for adaptive rewards
2834
* fixed: online plots did not take into account initial delay
29-
* fixed: data tab did not show correct session copy status
35+
* fixed: data tab did not show correct session copy status
3036

3137
-------------------------------
3238

@@ -36,7 +42,7 @@ Changelog
3642

3743
8.27.6
3844
------
39-
* fixed: detection of LED control ability broken for Bpods with old firmware
45+
* fixed: detection of LED control ability broken for Bpods with old firmware
4046

4147
8.27.5
4248
------
@@ -52,7 +58,7 @@ Changelog
5258
* changed: reset camera(s) prior to starting task when inconsistencies have been detected
5359
* changed: include stock subjects if user is stock manager
5460
* changed: skip validation of Ambient Module if device_bpod.USE_AMBIENT_MODULE is false
55-
* added: `remove_bonsai_layouts` command for troubleshooting BONSAI GUIs not appearing
61+
* added: `remove_bonsai_layouts` command for troubleshooting BONSAI GUIs not appearing
5662

5763
8.27.2
5864
------
@@ -84,7 +90,7 @@ Changelog
8490
8.25.0
8591
------
8692
* feature: fiber photometry loader
87-
* feature: dataframe converter for Bpod session data
93+
* feature: dataframe converter for Bpod session data
8894
* removed: remaining tkinter dialogs
8995

9096
-------------------------------
@@ -128,7 +134,7 @@ Changelog
128134
* feature: validate values in `trials_table` using Pydantic
129135
* feature: add auto-generated API reference to documentation
130136
* changed: `show_trial_log()` now accepts a dict for including additional log items
131-
* fix: `_ephysChoiceWorld` - values from the pre-generated sessions were not actually used
137+
* fix: `_ephysChoiceWorld` - values from the pre-generated sessions were not actually used
132138
* fix: `_ephysChoiceWorld` - trial fixtures contained inverted values for `probability_left`
133139
* fix: GUI - Subjects and Projects are not being cached
134140
* add script for validating audio output of Bpod HiFi Module (in `scripts/` folder)
@@ -271,7 +277,7 @@ Changelog
271277

272278
8.15.4
273279
------
274-
* hotfix: disable prompt for deleting "duds" for appended sessions
280+
* hotfix: disable prompt for deleting "duds" for appended sessions
275281

276282
8.15.3
277283
------

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'sphinx.ext.autosummary',
2727
'sphinx.ext.inheritance_diagram',
2828
'sphinx.ext.viewcode',
29+
'sphinx_design',
30+
'sphinx_copybutton',
2931
]
3032
autosectionlabel_prefix_document = True
3133
source_suffix = ['.rst', '.md']

docs/source/developer_guide.rst

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,38 @@ Both of these fields are automatically inferred (by means of ``git describe``) a
3636
developer.
3737

3838

39-
Package Management and Development Workflows with PDM
40-
-----------------------------------------------------
39+
Package Management and Development Workflows with UV
40+
----------------------------------------------------
4141

42-
We use `PDM <https://pdm-project.org/en/latest/>`_ to manage dependencies of IBLRIG.
43-
PDM can also be used to run various commands with relevance to the development process without having to activate a virtual
44-
environment first.
45-
Please refer to `PDM's documentation <https://pdm-project.org/en/latest/#installation>`_ for help with installing PDM.
42+
This project is utilizing `UV <https://github.com/astral-sh/uv>`_ as its package
43+
manager for managing dependencies and ensuring consistent and reproducible environments.
44+
To install UV:
45+
46+
.. tab-set::
47+
48+
.. tab-item:: Linux and macOS
49+
50+
.. code-block:: console
51+
52+
$ curl -LsSf https://astral.sh/uv/install.sh | sh
53+
54+
.. tab-item:: Windows
55+
56+
.. code-block:: pwsh-session
57+
58+
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
59+
60+
See `UV's documentation <https://docs.astral.sh/uv/>`_ for details.
4661

4762

4863
Installing Developer Dependencies
4964
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5065

51-
To install additional dependencies needed for working on IBLRIG's code-base, run:
66+
To install IBLRIG as an editable package including all developer dependencies:
5267

53-
.. code-block:: console
68+
.. code-block:: pwsh-session
5469
55-
pdm sync -d
70+
PS> uv sync
5671
5772
5873
Running Unit Tests
@@ -62,7 +77,7 @@ To run unit tests locally, run:
6277

6378
.. code-block:: console
6479
65-
pdm run pytest
80+
uv run --frozen pytest
6681
6782
This will also generate a HTML based coverage report which can be found in the ``htmlcov`` directory.
6883

@@ -77,15 +92,15 @@ To lint your code, run:
7792

7893
.. code-block:: console
7994
80-
pdm run ruff check
95+
uv run --frozen ruff check
8196
8297
Appending the flag ``--fix`` to the above command will automatically fix issues that are deemed safe to handle.
8398

8499
To reformat your code according to the `Black code style <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_ run:
85100

86101
.. code-block:: console
87102
88-
pdm run ruff format
103+
uv run --frozen uff format
89104
90105
Appending the flag ``--check`` to the above command will check your code for formatting issues without applying any changes.
91106
Refer to `Ruff Formater's documentation <https://docs.astral.sh/ruff/formatter/>`_ for further details.
@@ -116,13 +131,13 @@ To build the documentation, run:
116131

117132
.. code-block:: console
118133
119-
pdm run sphinx-autobuild ./docs/source ./docs/build
134+
uv run --frozen sphinx-autobuild ./docs/source ./docs/build
120135
121136
You can also export the documentation to a PDF file:
122137

123138
.. code-block:: console
124139
125-
pdm run make -C docs/ simplepdf
140+
uv run --frozen make -C docs/ simplepdf
126141
127142
Find the exported PDF file in ``docs/build/simplepdf``.
128143

iblrig/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# 5) git tag the release in accordance to the version number below (after merge!)
77
# >>> git tag 8.15.6
88
# >>> git push origin --tags
9-
__version__ = '8.28.2'
9+
__version__ = '8.29.0'

iblrig/base_choice_world.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,21 @@ def _run(self) -> None:
295295
time_last_trial_end = time.time()
296296

297297
# handle pause event
298-
flag_pause = self.paths.SESSION_FOLDER.joinpath('.pause')
299-
flag_stop = self.paths.SESSION_FOLDER.joinpath('.stop')
300-
if flag_pause.exists() and trial_number < (self.task_params.NTRIALS - 1):
298+
if self.paused and trial_number < (self.task_params.NTRIALS - 1):
301299
log.info(f'Pausing session inbetween trials {trial_number} and {trial_number + 1}')
302-
while flag_pause.exists() and not flag_stop.exists():
300+
while self.paused and not self.stopped:
303301
time.sleep(1)
304302
self.trials_table.at[self.trial_num, 'pause_duration'] = time.time() - time_last_trial_end
305-
if not flag_stop.exists():
303+
if not self.stopped:
306304
log.info('Resuming session')
307305

308306
# save trial and update log
309307
self.trial_completed(self.bpod.session.current_trial.export())
310308
self.show_trial_log()
311309

312310
# handle stop event
313-
if flag_stop.exists():
311+
if self.stopped:
314312
log.info('Stopping session after trial %d', trial_number)
315-
flag_stop.unlink()
316313
break
317314

318315
def mock(self, file_jsonable_fixture=None):
@@ -605,8 +602,6 @@ def trial_completed(self, bpod_data: dict[str, Any]) -> None:
605602
with self.paths['AMBIENT_FILE_PATH'].open('ab') as f:
606603
binary.write_array(f, [self.trial_num, *sensor_reading], DTYPE_AMBIENT_SENSOR_BIN)
607604

608-
# this is a flag for the online plots. If online plots were in pyqt5, there is a file watcher functionality
609-
Path(self.paths['DATA_FILE_PATH']).parent.joinpath('new_trial.flag').touch()
610605
self.paths.SESSION_FOLDER.joinpath('transfer_me.flag').touch()
611606
self.check_sync_pulses(bpod_data=bpod_data)
612607

@@ -823,7 +818,7 @@ def _run(self):
823818
)
824819
super()._run()
825820

826-
def __del__(self):
821+
def _finalize(self):
827822
if isinstance(self.plot_subprocess, subprocess.Popen) and self.plot_subprocess.poll() is None:
828823
log.info('Terminating subprocess: online plots')
829824
self.plot_subprocess.terminate()

0 commit comments

Comments
 (0)