Skip to content

Commit 9adcdd8

Browse files
authored
Switch instructions & metadata files to use a modern uv workflow (#202)
2 parents ae5d6b6 + 994e28c commit 9adcdd8

File tree

11 files changed

+269
-53
lines changed

11 files changed

+269
-53
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,14 @@ jobs:
2424
with:
2525
path: ~/.cache/uv
2626
key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv
27-
- name: Create and activate virtualenv with uv
27+
- name: uv sync and activate
2828
run: |
2929
curl -LsSf https://astral.sh/uv/install.sh | sh
30-
uv venv
30+
uv sync
3131
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
3232
echo "$PWD/.venv/bin" >> $GITHUB_PATH
33-
- name: Install Python tools
34-
run: uv pip install -r requirements.txt
3533
3634
# Set up for tests.
37-
- name: Install Turnt
38-
run: uv pip install turnt
3935
- name: Problem matcher
4036
run: echo '::add-matcher::.github/tap-matcher.json'
4137
- name: Fetch test data
@@ -70,14 +66,12 @@ jobs:
7066
with:
7167
path: ~/.cache/uv
7268
key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv
73-
- name: Create and activate virtualenv with uv
69+
- name: uv sync and activate
7470
run: |
7571
curl -LsSf https://astral.sh/uv/install.sh | sh
76-
uv venv
72+
uv sync
7773
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
7874
echo "$PWD/.venv/bin" >> $GITHUB_PATH
79-
- name: Install Python tools
80-
run: uv pip install -r requirements.txt
8175
8276
# Install odgi
8377
- name: Pull odgi container

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ Similarly, `slow_odgi` is a set of GFA analyses based on `mygfa`; it's meant to
3434

3535
To set up both of them from this repository, try using [uv][]:
3636

37-
$ uv venv
38-
$ uv pip install -r requirements.txt
39-
$ source .venv/bin/activate
37+
$ uv run slow_odgi --help
38+
39+
Or, alternatively, you can set up and activate the environment manually:
4040

41-
Now type `slow_odgi --help` to see if everything's working.
41+
$ uv sync
42+
$ source .venv/bin/activate
43+
$ slow_odgi --help
4244

4345
[uv]: https://github.com/astral-sh/uv
4446
[mygfa-docs]: http://cucapra.github.io/pollen/mygfa/

flatgfa-py/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flatgfa-py/README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,20 @@ Then, read [the API documentation][flatgfa-py-docs] for details about what it ca
1212
Development
1313
-----------
1414

15-
To build this library, first install [Maturin][]:
15+
The easiest way to get started is with [uv][]:
1616

17-
$ pipx install maturin
17+
$ uv run --package flatgfa python example.py
1818

19-
Next, we'll build and install the Python library in our virtualenv.
20-
Starting from the repository root:
21-
22-
$ uv venv # Unless you already created the virtualenv.
23-
$ uv pip install pip # Maturin depends on pip.
24-
$ source .venv/bin/activate
25-
$ cd flatgfa-py
26-
$ maturin develop
27-
28-
Now the `flatgfa` module is available to Python programs.
29-
Try our [example][]:
30-
31-
$ python example.py
19+
That should build and install the package and then run our `example.py` script.
3220

3321
Or run the tests:
3422

35-
$ uv pip install pytest
36-
$ pytest
23+
$ uv run --package flatgfa pytest
3724

3825
[maturin]: https://www.maturin.rs
3926
[flatgfa-py-docs]: https://cucapra.github.io/pollen/flatgfa/
4027
[flatgfa]: https://github.com/cucapra/pollen/tree/main/flatgfa
4128
[gfa]: https://github.com/GFA-spec/GFA-spec/blob/master/GFA1.md
4229
[flatgfa-pypi]: https://pypi.org/project/flatgfa/
4330
[example]: https://github.com/cucapra/pollen/blob/main/flatgfa-py/example.py
31+
[uv]: https://docs.astral.sh/uv/

flatgfa-py/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ classifiers = [
1515
repository = "https://github.com/cucapra/pollen"
1616
documentation = "https://cucapra.github.io/pollen/flatgfa/"
1717

18-
[project.optional-dependencies]
19-
test = ["pytest"]
18+
[dependency-groups]
19+
dev = ["pytest>=8.3.0"]
2020

2121
[build-system]
2222
requires = ["maturin>=1.0,<2.0"]

pollen_py/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ Clone this repository:
112112

113113
And then install the Python tools using [uv][]:
114114

115-
$ uv venv
116-
$ uv pip install -r requirements.txt
115+
$ uv sync
117116
$ source .venv/bin/activate
118117

119118
[calyx]: https://calyxir.org

pollen_py/pyproject.toml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[build-system]
2-
requires = ["flit_core >=2,<4"]
2+
requires = ["flit_core >=3.2,<4"]
33
build-backend = "flit_core.buildapi"
44

5-
[tool.flit.metadata]
6-
module = "pollen"
7-
author = "Susan Garry"
8-
author-email = "shg64@cs.cornell.edu"
9-
home-page = "https://github.com/cucapra/pollen"
10-
description-file = "README.md"
11-
requires-python = ">=3.8"
12-
requires = []
5+
[project]
6+
name = "pollen"
7+
authors = [
8+
{ name = "Susan Garry", email = "shg64@cs.cornell.edu" }
9+
]
10+
readme = "README.md"
11+
dynamic = ["version", "description"]
1312

14-
[tool.flit.scripts]
13+
[project.scripts]
1514
exine = "pollen.main:main"

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[project]
2+
name = "pollen_workspace"
3+
version = "0.0.0"
4+
requires-python = ">=3.8"
5+
dependencies = [
6+
"mygfa",
7+
"slow_odgi",
8+
"pollen",
9+
"pollen_data_gen",
10+
"turnt>=1.11.0",
11+
]
12+
13+
[tool.uv.sources]
14+
mygfa = { workspace = true }
15+
slow_odgi = { workspace = true }
16+
pollen = { workspace = true }
17+
pollen_data_gen = { workspace = true }
18+
flatgfa = { workspace = true }
19+
20+
[tool.uv.workspace]
21+
members = [
22+
"mygfa",
23+
"slow_odgi",
24+
"pollen_py",
25+
"pollen_data_gen",
26+
"flatgfa-py",
27+
]

requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

slow_odgi/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Think of it as a code-forward spec for `odgi` commands.
1010

1111
One easy way to install everything in the Pollen repo is to use [uv][]:
1212

13-
$ uv venv
14-
$ uv pip install -r requirements.txt
13+
$ uv sync
1514
$ source .venv/bin/activate
1615

1716
[uv]: https://github.com/astral-sh/uv
@@ -30,7 +29,7 @@ To test `slow_odgi`, we treat odgi as an oracle and compare our outputs against
3029
To run these tests, you will need:
3130

3231
1. [Odgi][]. Our tests were run against a built-from-source copy of odgi (commit `34f006f`).
33-
2. [Turnt][]. This is installed automatically if you use `requirements.txt` as above.
32+
2. [Turnt][]. This is installed automatically if you use `uv` as above.
3433

3534
With these in place, run `make test-slow-odgi`. The "oracle" files will be generated first, and this will toss up a large number of warnings which can all be ignored. Then the tests will begin to run, and the `ok`/`not ok` signals there are actually of interest.
3635

0 commit comments

Comments
 (0)