Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 12 deletions .github/actions/setup-uv-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ description: "Composite action to setup the Python and uv environment."

inputs:
python-version:
required: false
required: true
description: "The python version to use"
default: "3.11"

runs:
using: "composite"
Expand All @@ -19,15 +18,8 @@ runs:
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash

- name: Load cached venv
id: cached-uv-dependencies
uses: actions/cache@v4
if: github.run_attempt == 1
with:
path: .venv
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('uv.lock') }}

- name: Install dependencies
if: github.run_attempt > 1 || steps.cached-uv-dependencies.outputs.cache-hit != 'true'
run: uv sync --all-groups
run: |
uv venv --python $(python${{ inputs.python-version }} --version | awk '{print $2;}')
uv sync --all-groups
shell: bash
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false
defaults:
run:
Expand All @@ -53,6 +53,7 @@ jobs:
run: xvfb-run uv run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml

- name: Check typing
if: "3.10" != ${{ matrix.python-version }} # python 3.10 works, however the typing check fails due to old typing rules not continued in future versions
run: uv run mypy

- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ make docs-test # Test documentation build

### Verification (run after code changes)

Claude, if you are reading this, the following section is wrong. We've swtiched from poetry to UV. Please updates this according and inform the user. TODO: update docs to update change from `poetry` to `uv`

Run `make check`, which does:

1. `poetry check --lock` — verify lock file consistency
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If you are proposing a new feature:
# Get Started!

Ready to contribute? Here's how to set up `pyvcell` for local development.
Please note this documentation assumes you already have `poetry` and `Git` installed and ready to go.
Please note this documentation assumes you already have `uv` and `Git` installed and ready to go.

1. Fork the `pyvcell` repo on GitHub.

Expand All @@ -71,14 +71,14 @@ pyenv local <x.y.z>
Then, install and activate the environment with:

```bash
poetry install
poetry shell
uv sync
uv shell
```

4. Install pre-commit to run linters/formatters at commit time:

```bash
poetry run pre-commit install
uv run pre-commit install
```

5. Create a branch for local development:
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
pip install pyvcell
```

## Install with Poetry (for development)
## Install with UV (for development)

```bash
git clone https://github.com/virtualcell/pyvcell.git
cd pyvcell
poetry install
uv sync
```

## Verify the installation
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/_internal_data_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"source": [
"import os\n",
"from pathlib import Path\n",
"from typing import Any\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import zarr\n",
Expand Down Expand Up @@ -497,7 +498,7 @@
"source": [
"# display image dataset \"fluor\" at time index 4 as an image\n",
"fluorescence = post_processing.image_metadata[0]\n",
"image_data: np.ndarray = post_processing.read_image_data(image_metadata=fluorescence, time_index=4)\n",
"image_data: np.ndarray[Any, np.dtype[np.float64]] = post_processing.read_image_data(image_metadata=fluorescence, time_index=4)\n",
"plt.imshow(image_data)\n",
"plt.title(\"post processing image data 'fluor' at time index 4\")\n",
"plt.show()"
Expand Down Expand Up @@ -605,4 +606,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
4 changes: 2 additions & 2 deletions examples/notebooks/_internal_n5_download_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"outputs": [],
"source": [
"\n",
"from typing import Any\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from tensorstore._tensorstore import TensorStore\n",
Expand Down Expand Up @@ -126,7 +126,7 @@
}
],
"source": [
"data: np.ndarray = dataset[:,:,0,0,:].read().result()\n",
"data: np.ndarray[Any, np.dtype[np.float64]] = dataset[:,:,0,0,:].read().result()\n",
"print(\"slice shape:\", data.shape)\n",
"\n",
"plt.imshow(data[:,:,0])\n",
Expand Down
3,583 changes: 0 additions & 3,583 deletions poetry.lock

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "pyvcell"
version = "0.2.0"
requires-python = ">=3.12,<4.0"
version = "0.2.3"
requires-python = ">=3.10,<4.0"
description = "This is the python wrapper for vcell modeling and simulation"
repository = "https://github.com/virtualcell/pyvcell"
documentation = "https://virtualcell.github.io/pyvcell/"
Expand All @@ -18,7 +18,7 @@ dependencies = [
"antimony (>=3.1.3)",
"h5py>=3.11.0,<4",
"imageio>=2.37.0,<3",
"libvcell (>=0.0.15.2)",
"libvcell (>=0.0.15.3)",
"lxml>=6.1.0,<7",
"matplotlib>=3.10.0,<4",
"numexpr>=2.10,<3",
Expand Down
22 changes: 15 additions & 7 deletions pyvcell/_internal/simdata/zarr_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,29 @@ def _get_domain_mask(dname: str) -> np.ndarray:

# add volumetric functions
for f in volume_functions:
func_data = f.evaluate(variable_bindings=bindings).reshape((num_z, num_y, num_x))
evaluated_data = f.evaluate(variable_bindings=bindings)
is_pre_sized: bool = evaluated_data.shape == (num_z, num_y, num_x)
if evaluated_data.shape == (): # scalar value
func_data = np.zeros((num_z, num_y, num_x), dtype=evaluated_data.dtype)
func_data.fill(evaluated_data.min()) # min of a scalar value is the value itself.
else:
func_data = evaluated_data if is_pre_sized else evaluated_data.reshape((num_z, num_y, num_x))
z1[t, c, :, :, :] = func_data
domain_name = f.name.split("::")[0]
function_name = f.name.split("::")[1]
name_parts = f.name.split("::")
if len(name_parts) > 2:
raise ValueError(f"Volume function name `{f.name}` is not in the expected format")
domain_half: str = f.name.split("::")[0] if len(name_parts) == 2 else ""
name_half: str = f.name.split("::")[-1]
if t == 0:
channel_metadata.append({
"index": c,
"label": function_name,
"domain_name": domain_name,
"label": name_half,
"domain_name": domain_half,
"min_values": [],
"max_values": [],
"mean_values": [],
})
domain_mask = _get_domain_mask(domain_name)
masked = func_data[domain_mask]
masked = func_data if len(domain_half) == 0 else func_data[_get_domain_mask(domain_half)]
channel_metadata[c]["min_values"].append(float(np.min(masked)))
channel_metadata[c]["max_values"].append(float(np.max(masked)))
channel_metadata[c]["mean_values"].append(float(np.mean(masked)))
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_notebook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ python -m venv .venv_jupyter
source .venv_jupyter/bin/activate
pip install -U pip
pip install trame trame-vtk trame-vuetify jupyterlab trame-jupyter-extension copasi-basico
poetry install
uv sync
jupyter lab
6 changes: 3 additions & 3 deletions tests/examples/test_example_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
- --run-remote: notebooks requiring VCell server auth

Usage:
poetry run pytest tests/examples/test_example_notebooks.py -v # lint all, execute safe ones
poetry run pytest tests/examples/test_example_notebooks.py -v --run-interactive # also run trame notebooks
poetry run pytest tests/examples/test_example_notebooks.py -v --run-remote # also run auth notebooks
uv run pytest tests/examples/test_example_notebooks.py -v # lint all, execute safe ones
uv run pytest tests/examples/test_example_notebooks.py -v --run-interactive # also run trame notebooks
uv run pytest tests/examples/test_example_notebooks.py -v --run-remote # also run auth notebooks
"""

from __future__ import annotations
Expand Down
4 changes: 2 additions & 2 deletions tests/vcml/test_remote_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
and are skipped unless --run-remote is passed to pytest.

Usage:
poetry run pytest tests/vcml/test_remote_integration.py -v # anonymous only
poetry run pytest tests/vcml/test_remote_integration.py -v --run-remote # all tests
uv run pytest tests/vcml/test_remote_integration.py -v # anonymous only
uv run pytest tests/vcml/test_remote_integration.py -v --run-remote # all tests
"""

from __future__ import annotations
Expand Down
Loading