From a41c5e65f635bd87ea41961b29973164edb9132b Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 13:22:28 -0700 Subject: [PATCH 01/13] Replace to UV from pip --- parallax/__main__.py | 8 +++-- parallax/main_window.py | 1 + pyproject.toml | 80 ++++++++++++++++++++--------------------- 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/parallax/__main__.py b/parallax/__main__.py index 6a60bea7..a354276d 100644 --- a/parallax/__main__.py +++ b/parallax/__main__.py @@ -17,8 +17,7 @@ from parallax.model import Model from parallax.session.session_manager import SessionManager -# Main function to run the Parallax application -if __name__ == "__main__": +def main(): # Print the ASCII art print(f"Parallax version {__version__}") print(PARALLAX_ASCII) @@ -47,7 +46,10 @@ app.exec() # Clean up on exit - atexit.register(main_window.update_config_from_ui) atexit.register(model.save_config) atexit.register(model.save_session) atexit.register(model.clean) + +# Execute when run directly as a module +if __name__ == "__main__": + main() diff --git a/parallax/main_window.py b/parallax/main_window.py index 959a4ab1..9e11404e 100644 --- a/parallax/main_window.py +++ b/parallax/main_window.py @@ -262,6 +262,7 @@ def closeEvent(self, event): Args: event (QCloseEvent): The close event triggered when the widget is closed. """ + self.update_config_from_ui() self.model.close_clac_instance() self.model.close_reticle_metadata_instance() self.model.close_stage_ipconfig_instance() diff --git a/pyproject.toml b/pyproject.toml index 50dc3838..3540836f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [project] name = "parallax-app" @@ -12,13 +12,12 @@ license = {text = "MIT"} readme = "README.md" keywords = ["parallax"] dynamic = ["version"] -requires-python = "~=3.10" +requires-python = ">=3.10, <3.11" classifiers = [ "Programming Language :: Python :: 3" ] dependencies = [ - "pip", "PyQt6>=6.10.0", "pyqtgraph", "opencv-python", @@ -37,44 +36,15 @@ dependencies = [ "torch>=2.3.0", "pydantic>=2" ] - -[tool.setuptools.packages.find] -include = ["parallax", "ui", "img"] -exclude = ["tests", "tests.*"] -[tool.setuptools.package-data] -exclude = ["tests", "tests/*"] +[project.scripts] +parallax = "parallax.__main__:main" -[tool.setuptools.dynamic] -version = {attr = "parallax.__version__"} -readme = {file = "README.md"} - -[project.optional-dependencies] -dev = ['parallax-app[linters]'] +[tool.hatch.build.targets.wheel] +packages = ["parallax", "ui", "img"] -linters = [ - 'codespell', - 'coverage', - 'ruff', - 'interrogate', - 'pytest-mock' -] - -docs = [ - 'Sphinx', - 'sphinxcontrib-video', - 'sphinx-jinja', - 'furo', - 'docutils' -] - -test = [ - "pytest>=7", - "pytest-qt>=4.4.0", - "pytest-cov>=4.1.0", - "pytest-mock>=3.10.0", - "opencv-python-headless", -] +[tool.hatch.version] +path = "parallax/__init__.py" [tool.coverage.run] omit = [ @@ -105,8 +75,36 @@ select = ["F", "E", "W", "I"] [tool.codespell] skip = ".git,*.json,*.log" - + +[project.optional-dependencies] +linters = [ + 'codespell', + 'coverage', + 'ruff', + 'interrogate', + 'pytest-mock' +] + +docs = [ + 'Sphinx', + 'sphinxcontrib-video', + 'sphinx-jinja', + 'furo', + 'docutils' +] + +test = [ + "pytest>=7", + "pytest-qt>=4.4.0", + "pytest-cov>=4.1.0", + "pytest-mock>=3.10.0", + "opencv-python-headless", +] + [tool] homepage = "https://github.com/AllenNeuralDynamics/parallax" repository = "https://github.com/AllenNeuralDynamics/parallax" -documentation = "https://github.com/AllenNeuralDynamics/parallax/wiki" \ No newline at end of file +documentation = "https://github.com/AllenNeuralDynamics/parallax/wiki" + +[tool.pytest.ini_options] +pythonpath = ["parallax", "tests"] From 7a6b015f6123c988d9c13617c547725afaac43bd Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 14:49:57 -0700 Subject: [PATCH 02/13] Move sfm to uv.sources and relax pytest coverage --- pyproject.toml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3540836f..ac43fa34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,8 @@ dependencies = [ "ultralytics>=8.2.0", "lap>=0.5.12", "torch>=2.3.0", - "pydantic>=2" + "pydantic>=2", + "sfm", ] [project.scripts] @@ -54,11 +55,11 @@ source = ["parallax"] [tool.coverage.report] exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] -fail_under = 70 +fail_under = 30 [tool.interrogate] exclude = ["setup.py", "docs", "build"] -fail-under = 70 +fail-under = 30 [tool.ruff] line-length = 120 @@ -82,7 +83,8 @@ linters = [ 'coverage', 'ruff', 'interrogate', - 'pytest-mock' + 'pytest-mock', + "mypy>=1.11.0", ] docs = [ @@ -106,5 +108,8 @@ homepage = "https://github.com/AllenNeuralDynamics/parallax" repository = "https://github.com/AllenNeuralDynamics/parallax" documentation = "https://github.com/AllenNeuralDynamics/parallax/wiki" +[tool.uv.sources] +sfm = { git = "https://github.com/AllenNeuralDynamics/sfm.git", branch = "main" } + [tool.pytest.ini_options] pythonpath = ["parallax", "tests"] From 74de6bd3018295fa1a11beb7f03075422a2e2b97 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:25:50 -0700 Subject: [PATCH 03/13] Add .venv in gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cb4e3b6b..fde3908b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,4 @@ debug .coverage # Environments -venv/ \ No newline at end of file +.venv/ \ No newline at end of file From 62b000bd2dbb78633e1334dfa31e3aae793f6035 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:28:04 -0700 Subject: [PATCH 04/13] Remove Interrogate from pyproject.toml --- pyproject.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ac43fa34..feb52765 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,10 +57,6 @@ source = ["parallax"] exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] fail_under = 30 -[tool.interrogate] -exclude = ["setup.py", "docs", "build"] -fail-under = 30 - [tool.ruff] line-length = 120 exclude = [ @@ -82,7 +78,6 @@ linters = [ 'codespell', 'coverage', 'ruff', - 'interrogate', 'pytest-mock', "mypy>=1.11.0", ] From 40f5557c78f6a92a28495bd83819ebd9132c9c22 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:37:11 -0700 Subject: [PATCH 05/13] Update to uv in github workflow --- .github/workflows/ci.yml | 28 +++++++++------------- .github/workflows/pytest.yml | 16 ++++--------- .github/workflows/tag_and_publish.yml | 34 +++++++++------------------ 3 files changed, 26 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fbb6cd2..b8ade522 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,19 +15,16 @@ jobs: python-version: [ '3.10' ] steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + - name: Install uv and set Python version + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install -e .[linters] --no-cache-dir - - name: Run interrogate - run: interrogate parallax tests + run: uv sync --extra linters - name: Run Ruff Check - run: ruff check . + run: uv run ruff check . - name: Run Ruff Format Check - run: ruff format --check . + run: uv run ruff format --check . # Job 2: Build Documentation for PR to Main and Dev Branches build-docs: @@ -37,21 +34,18 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 - # Step 2: Set up Python - - name: Set up Python - uses: actions/setup-python@v4 + # Step 2: Install uv and set Python version + - name: Install uv and set Python version + uses: astral-sh/setup-uv@v5 with: python-version: '3.10' - # Step 3: Install dependencies (including Sphinx) + # Step 3: Install Dependencies - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r docs/requirements.txt + run: uv sync --extra docs # Step 4: Build the documentation - name: Build Documentation - run: | - sphinx-build -b html docs/source docs/_build + run: uv run sphinx-build -b html docs/source docs/_build # Fail the workflow if documentation build fails continue-on-error: false diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 09b4e6bf..10570568 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -22,21 +22,13 @@ jobs: sudo apt-get update sudo apt-get install -y libegl1 libxkbcommon-x11-0 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv and set Python version + uses: astral-sh/setup-uv@v5 with: python-version: '3.10' - - name: Upgrade pip - run: python -m pip install --upgrade pip - - name: Install package + test deps - run: | - pip install -e ".[test]" - # optional: linters too - pip install -e ".[linters]" + run: uv sync --extra test --extra linters - name: Run tests with coverage - run: | - pytest --cov=parallax --cov-report=term-missing - continue-on-error: true \ No newline at end of file + run: uv run pytest --cov=parallax --cov-report=term-missing --cov-fail-under=30 \ No newline at end of file diff --git a/.github/workflows/tag_and_publish.yml b/.github/workflows/tag_and_publish.yml index cd97e4a4..9edf7d42 100644 --- a/.github/workflows/tag_and_publish.yml +++ b/.github/workflows/tag_and_publish.yml @@ -4,6 +4,7 @@ on: push: branches: - main + workflow_call: jobs: build-and-release: @@ -14,8 +15,8 @@ jobs: with: fetch-depth: '0' - - name: Set up Python - uses: actions/setup-python@v2 + - name: Install uv and set Python version + uses: astral-sh/setup-uv@v5 with: python-version: '3.10' @@ -23,7 +24,7 @@ jobs: id: get_version shell: bash run: | - RELEASE_VERSION=$(python -c 'import parallax; print(parallax.__version__)') + RELEASE_VERSION=$(uv run python -c 'import parallax; print(parallax.__version__)') echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV echo "Extracted RELEASE_VERSION: $RELEASE_VERSION" @@ -47,18 +48,8 @@ jobs: draft: false prerelease: true - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine build - - - name: Install project - run: pip install -e . - - name: Build package - run: | - python -m build - twine check dist/* + run: uv build - name: Publish on PyPI uses: pypa/gh-action-pypi-publish@release/v1 @@ -74,21 +65,18 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 - # Step 2: Set up Python - - name: Set up Python - uses: actions/setup-python@v4 + # Step 2: Install uv and set Python version + - name: Install uv and set Python version + uses: astral-sh/setup-uv@v5 with: python-version: '3.10' - # Step 3: Install dependencies (including Sphinx) + # Step 3: Install Dependencies - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r docs/requirements.txt + run: uv sync --extra docs # Step 4: Build the documentation - name: Build Documentation - run: | - sphinx-build -b html docs/source docs/_build + run: uv run sphinx-build -b html docs/source docs/_build # Fail the workflow if documentation build fails continue-on-error: false \ No newline at end of file From 67916ad38c89e0632f76d843aed27c0c2c9c3e57 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:40:00 -0700 Subject: [PATCH 06/13] Update REAME instruction using uv --- README.md | 69 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 5f86880c..41fe9449 100644 --- a/README.md +++ b/README.md @@ -7,36 +7,40 @@ setting up and performing acute *in vivo* electrophysiology experiments. **Documentation**: [parallax.readthedocs.io](https://parallax.readthedocs.io/en/latest/index.html). -### Prerequisites -- **Python==3.10** (Recommended to install via -[Anaconda](https://www.anaconda.com/products/individual) or -[Miniconda](https://docs.conda.io/en/latest/miniconda.html)) - - Python 3.10 is required for the Spinnaker library. -- [Spinnaker SDK 4.2](https://www.teledynevisionsolutions.com/products/spinnaker-sdk) +## Prerequisites +- **Python 3.10**: Required for compatibility with the Spinnaker library. +- [Spinnaker SDK 4.2](https://www.teledynevisionsolutions.com/products/spinnaker-sdk) and Teledyne FLIR software for camera support. +- We recommend using [`uv`](https://docs.astral.sh/uv/) for environment management. -### Installation -1. Create a virtual environment with **Python 3.10** and activate it: -2. Install Parallax: +## Installation +#### 1. Install Parallax +Option A, Install from PyPI: ```bash -pip install parallax-app +uv venv --python 3.10 +# On macOS/Linux: source .venv/bin/activate +# On Windows: .venv\Scripts\activate +uv pip install parallax-app ``` - -To upgrade to the latest version, run: +Option B, Install via local repository (Recommanded): ```bash -pip install parallax-app --upgrade +git clone http://github.com/AllenNeuralDynamics/parallax.git +cd parallax +uv sync ``` -3. Install the camera interface [Spinnaker SDK 4.2](https://www.teledynevisionsolutions.com/products/spinnaker-sdk) +#### 2. Install Spinnaker +Install the camera interface [Spinnaker SDK 4.2](https://www.teledynevisionsolutions.com/products/spinnaker-sdk) ```bash # Install from the **wheel file** that comes with the Spinnaker SDK ver.4.2. # Replace **** with the *full path* to your `.whl`: -pip install "" +uv pip install "" +# Example) uv pip install spinnaker_python-4.2.0.88-cp310-cp310-win_amd64.whl ``` -### Running Parallax +## Running Parallax ```bash -python -m parallax +uv run parallax ``` ### Optional: Enable SuperPoint + SuperGlue Reticle Detection @@ -50,13 +54,14 @@ Manual Setup Instructions 1. Clone the repository if it hasn't been done already. ```bash git clone https://github.com/AllenNeuralDynamics/parallax.git +cd parallax ``` 2. Clone the repository into the external/ folder in your Parallax project root: ```bash -pip install git+https://github.com/AllenNeuralDynamics/sfm.git@main git clone https://github.com/magicleap/SuperGluePretrainedNetwork.git external/SuperGluePretrainedNetwork ``` + 3. Verify your folder structure looks like this: ```bash parallax/ @@ -70,28 +75,36 @@ parallax/ ``` ### For developers: -1. Clone the repository: +The following are tools used to ensure code quality in this project. +- Install dependencies: ```bash -git clone https://github.com/AllenNeuralDynamics/parallax.git +uv sync --all-extras ``` -2. Install the package along with dev dependencies: + +- Unit Testing ```bash -pip install -e .[dev] +uv run pytest tests ``` -### Documentation -1. To install the dependencies: +- Linting ```bash -pip install -e .[docs] +uv run ruff check ``` -2. Then to create the documentation html files, run: + +- Type Check +```bash +uv run mypy parallax +``` + +### Documentation +Create the documentation html files, run: ```bash -sphinx-build -b html docs/ docs/_build +uv run sphinx-build -b html docs/source docs/_build ``` ### Support and Contribution If you encounter any problems or would like to contribute to the project, -please submit an [Issue](https://github.com/AllenNeuralDynamics/parallax/issues) +please submit an [Issue](https://github.com/AllenNeuralDynamics/parallax/issues) on GitHub. ### License From 53e7160bc7be097e4586f4ad72326d46b849754a Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:40:50 -0700 Subject: [PATCH 07/13] Fix indentation --- parallax/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parallax/__main__.py b/parallax/__main__.py index a354276d..0900d984 100644 --- a/parallax/__main__.py +++ b/parallax/__main__.py @@ -17,6 +17,7 @@ from parallax.model import Model from parallax.session.session_manager import SessionManager + def main(): # Print the ASCII art print(f"Parallax version {__version__}") @@ -50,6 +51,7 @@ def main(): atexit.register(model.save_session) atexit.register(model.clean) + # Execute when run directly as a module if __name__ == "__main__": main() From 0e13396eb79dc817f02226270805982cc44b56af Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 15:41:07 -0700 Subject: [PATCH 08/13] Update version --- parallax/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parallax/__init__.py b/parallax/__init__.py index a46e7fab..1e46c7bb 100644 --- a/parallax/__init__.py +++ b/parallax/__init__.py @@ -4,7 +4,7 @@ import os -__version__ = "1.16.1" +__version__ = "1.17.0" # allow multiple OpenMP instances os.environ["KMP_DUPLICATE_LIB_OK"] = "True" From 4dafe02b9a2c92a3054e1bc6c217c0081b2220b5 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 16:15:11 -0700 Subject: [PATCH 09/13] remove sfm from dependency pip install parallax-app will fails callling sfm which is from github, not from pypi --- README.md | 7 ++++++- pyproject.toml | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 41fe9449..7c5ff72d 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,19 @@ The SuperGluePretrainedNetwork is not included in this repository and is distrib Please review their [license](https://github.com/magicleap/SuperGluePretrainedNetwork) before use. Manual Setup Instructions -1. Clone the repository if it hasn't been done already. +Clone the repository if it hasn't been done already. ```bash git clone https://github.com/AllenNeuralDynamics/parallax.git cd parallax ``` +1. Install the required `sfm` dependency from GitHub: +```bash +uv pip install git+ +``` 2. Clone the repository into the external/ folder in your Parallax project root: ```bash + git clone https://github.com/magicleap/SuperGluePretrainedNetwork.git external/SuperGluePretrainedNetwork ``` diff --git a/pyproject.toml b/pyproject.toml index feb52765..6ef95874 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,6 @@ dependencies = [ "lap>=0.5.12", "torch>=2.3.0", "pydantic>=2", - "sfm", ] [project.scripts] @@ -103,8 +102,5 @@ homepage = "https://github.com/AllenNeuralDynamics/parallax" repository = "https://github.com/AllenNeuralDynamics/parallax" documentation = "https://github.com/AllenNeuralDynamics/parallax/wiki" -[tool.uv.sources] -sfm = { git = "https://github.com/AllenNeuralDynamics/sfm.git", branch = "main" } - [tool.pytest.ini_options] pythonpath = ["parallax", "tests"] From c59d3719a5755b1ee2310b0cad5ea0e210ad226d Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 16:17:11 -0700 Subject: [PATCH 10/13] REmove unused folder, img, fromhatchling --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6ef95874..0761e8d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,8 @@ dependencies = [ parallax = "parallax.__main__:main" [tool.hatch.build.targets.wheel] -packages = ["parallax", "ui", "img"] +packages = ["parallax"] +include = ["ui/**"] [tool.hatch.version] path = "parallax/__init__.py" From 3f85deefd6ce33a5984282924293ec69e6c0a0c8 Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 16:17:45 -0700 Subject: [PATCH 11/13] Fix TypeO Recommended --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c5ff72d..29d23c7f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ uv venv --python 3.10 # On Windows: .venv\Scripts\activate uv pip install parallax-app ``` -Option B, Install via local repository (Recommanded): +Option B, Install via local repository (Recommended): ```bash git clone http://github.com/AllenNeuralDynamics/parallax.git cd parallax From 33811757cc173217e3d5c52e5b2460f599c5150c Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 16:19:18 -0700 Subject: [PATCH 12/13] http: -> https: --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29d23c7f..fdd47b5d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ uv pip install parallax-app ``` Option B, Install via local repository (Recommended): ```bash -git clone http://github.com/AllenNeuralDynamics/parallax.git +git clone https://github.com/AllenNeuralDynamics/parallax.git cd parallax uv sync ``` From 45e404075e7be822d26af82885253b417e1cfc6e Mon Sep 17 00:00:00 2001 From: hannalee2 Date: Thu, 30 Apr 2026 16:42:48 -0700 Subject: [PATCH 13/13] Fix the README Instruction for github link --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index fdd47b5d..e47c1dfa 100644 --- a/README.md +++ b/README.md @@ -58,12 +58,11 @@ cd parallax ``` 1. Install the required `sfm` dependency from GitHub: ```bash -uv pip install git+ +uv pip install git+https://github.com/AllenNeuralDynamics/sfm.git@main ``` 2. Clone the repository into the external/ folder in your Parallax project root: ```bash - git clone https://github.com/magicleap/SuperGluePretrainedNetwork.git external/SuperGluePretrainedNetwork ```