Skip to content

Commit 220228c

Browse files
authored
Merge pull request #42 from AllenCell/feature/example-venv
Example environment with camera-alignment-core 0.6.0
2 parents 056c50b + 402374c commit 220228c

File tree

5 files changed

+3235
-0
lines changed

5 files changed

+3235
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ see `Makefile` for others or to inspect the underlying scripts run as part of th
137137
3. make publish: to publish to artifactory. Requires a ~/.pypirc file with an entry like:
138138
[release-local]
139139
repository = https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-release-local
140+
4. Update the example-venv lockfile to use the new release.
141+
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
142+
2. `cd example-venv && uv lock && uv sync`
143+
3. `uv pip list | grep camera-alignment-core` (This should show the new version.)
140144

141145

142146
**Allen Institute Software License**

example-venv/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

example-venv/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# An example virtual environment for using camera-alignment-core
2+
3+
## What's here
4+
This `example-venv` folder contains the following example files.
5+
* `pyproject.toml`: This is the main definition of the example project, which defines a single dependency, `camera-alignment-core`. The `pyproject.toml` is set up to work with the [uv](https://docs.astral.sh/uv/) package manager.
6+
* `.python-version`: Tells tools like `uv` or `pyenv` which python version to use. This is different from the `requires-python` line in `pyproject.toml`, which defines the range of versions that are expected to work.
7+
* `uv.lock`: This uv-specific file defines the exact versions of all dependencies needed for the project (including indirect dependencies). This file is generated by `uv` from the `pyproject.toml` and must be re-generated whenever the `pyproject.toml` changes. This file is what makes the virtual environment reproducible.
8+
9+
## How to use it
10+
1. Copy the `example-venv` folder somewhere else, let's say `~/my-project`.
11+
2. [Install uv](https://docs.astral.sh/uv/getting-started/installation/).
12+
3. Create and test the environment.
13+
1. `cd ~/my-project`
14+
2. `uv sync`
15+
3. `uv run python -c "import camera_alignment_core"`
16+
4. Add your own dependencies: `uv add pytorch`.
17+
5. Customize the metadata at the top of `pyproject.toml` for your project.
18+
6. Put your code in `~/my-project` and run it with `uv run`.

example-venv/pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[project]
2+
name = "example-venv"
3+
version = "0.1.0"
4+
description = "Virtual environment with camera-alignment-core"
5+
readme = "README.md"
6+
requires-python = ">=3.8,<3.12"
7+
dependencies = [
8+
# One main dependency for this example virtual environment
9+
"camera-alignment-core",
10+
# numcodecs is an indirect dependency of aicsimageio, and recent versions
11+
# of numcodecs are incompatible with the version of zarr needed by
12+
# aicsimageio. aicsimageio is deprecated, and ultimately this
13+
# pin should be made unnecessary by upgrading camera-alignment-core to use
14+
# bioio.
15+
"numcodecs<=0.15.0",
16+
]
17+
license = { text = "BSD-3-Clause" }
18+
19+
[tool.uv.sources]
20+
# There are two internal-only dependencies: get these from Artifactory
21+
aicsfiles = { index = "artifactory" }
22+
camera-alignment-core = { index = "artifactory" }
23+
24+
[[tool.uv.index]]
25+
name = "artifactory"
26+
url = "https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-snapshot-local/simple"
27+
# The `explicit = true` ensures that the default index (usually PyPi) is used
28+
# for all packages not explicitly listed in `tool.uv.sources`.
29+
explicit = true

0 commit comments

Comments
 (0)