Skip to content

Commit 272a97f

Browse files
authored
Update dev env instructions (#2990)
Close #2793 - Add pixi, first mentioned in #2707 (comment) - Use tabs in docs to help to point out only one option is needed - Default recommendation is conda, add `dev.yml` with dev dependencies
1 parent d516811 commit 272a97f

File tree

9 files changed

+12476
-32
lines changed

9 files changed

+12476
-32
lines changed

.envrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
use flake
1+
#use flake
2+
3+
PATH=~/.pixi/bin:$PATH
4+
5+
watch_file pixi.lock
6+
eval "$(pixi shell-hook)"

.github/workflows/dev_envs.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
pull_request:
44
push:
55
branches: [latest]
6+
concurrency:
7+
group: ${{ github.ref }}
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/latest' }}
69
jobs:
710
nix:
811
runs-on: ${{ matrix.os }}
@@ -23,8 +26,32 @@ jobs:
2326

2427
- run: nix develop --command bash -c "tox -e py310"
2528

29+
pixi:
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, macos-14]
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: set up pixi
40+
uses: prefix-dev/[email protected]
41+
with:
42+
pixi-version: v0.26.1
43+
cache: true
44+
frozen: true
45+
46+
- name: run tests for 3.10
47+
shell: pixi run bash {0}
48+
run: tox -e py310
49+
2650
mamba:
27-
runs-on: ubuntu-latest
51+
runs-on: ${{ matrix.os }}
52+
strategy:
53+
matrix:
54+
os: [ubuntu-latest, macos-14]
2855
steps:
2956
- uses: actions/checkout@v4
3057
with:
@@ -42,20 +69,11 @@ jobs:
4269
- name: setup conda
4370
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca
4471
with:
45-
auto-update-conda: true
4672
python-version: "3.10"
47-
channels: conda-forge,bioconda
48-
miniforge-variant: Mambaforge
4973
miniforge-version: latest
50-
use-mamba: true
51-
mamba-version: "*"
74+
environment-file: dev.yml
5275
activate-environment: sourmash_dev
5376
auto-activate-base: false
54-
use-only-tar-bz2: true
55-
56-
- name: install dependencies
57-
shell: bash -l {0}
58-
run: mamba install 'tox>=3.27,<4' tox-conda rust git compilers pandoc libstdcxx-ng
5977

6078
- name: run tests for 3.10
6179
shell: bash -l {0}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ wasm-pack.log
3737
# nix
3838
.direnv/
3939
result
40+
41+
# pixi
42+
.pixi/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dist: FORCE
1818
$(PYTHON) -m build --sdist
1919

2020
test: .PHONY
21-
tox -e py39
21+
tox -e py310
2222
cargo test
2323

2424
doc: .PHONY

dev.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: sourmash_dev
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- clangdev >=16.0.6,<16.1
6+
- cxx-compiler >=1.7.0,<1.8
7+
- git 2.41.0.*
8+
- libclang >=16.0.6,<16.1
9+
- pandoc 3.1.3.*
10+
- python 3.10.*
11+
- rust >=1.80.0,<1.81
12+
- tox >=4.11.0,<5

doc/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"nbsphinx",
4242
"IPython.sphinxext.ipython_console_highlighting",
4343
"myst_parser",
44+
"sphinx_design",
4445
]
4546

4647
# Add any paths that contain templates here, relative to this directory.
@@ -314,3 +315,7 @@
314315

315316
autodoc_mock_imports = ["sourmash.minhash"]
316317
myst_heading_anchors = 3
318+
myst_enable_extensions = [
319+
"html_admonition",
320+
"colon_fence",
321+
]

doc/developer.md

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,52 @@ git clone https://github.com/sourmash-bio/sourmash.git
1212
```
1313
sourmash runs under Python 3.10 and later.
1414

15-
We recommend using `conda` or `Nix` for setting up an environment for developing
15+
We recommend using `conda` for setting up an environment for developing
1616
new features, running tests and code quality checks.
17-
Here are some suggestions on how to set them up (note: you only need one =])
17+
Here are some suggestions on how to set them up
1818

19-
### Using mamba (conda alternative)
19+
:::{note}
20+
You only need one of these, no need to install them all!
21+
:::
22+
23+
::::{tab-set}
24+
25+
:::{tab-item} conda
2026

2127
Follow the [installation instructions](https://github.com/conda-forge/miniforge#install) for
22-
installing `mambaforge` (a conda distribution that uses
23-
[`mamba`](https://github.com/TheSnakePit/mamba)
24-
and the [`conda-forge`](https://conda-forge.org/) channel by default).
28+
installing `Miniforge3` (a conda distribution that uses
29+
the [`conda-forge`](https://conda-forge.org/) channel by default).
2530

26-
Once `mamba` is installed, run
31+
Once `conda` is installed, run
2732
```
28-
mamba create -n sourmash_dev 'tox>=3.27,<4' tox-conda rust git compilers pandoc libstdcxx-ng
33+
conda env create -n sourmash_dev --file dev.yml
2934
```
3035
to create an environment called `sourmash_dev` containing the programs needed
3136
for development.
3237

33-
To activate the new environment, run
38+
Once the environment is created, you can activate it for development with
3439
```
3540
conda activate sourmash_dev
3641
```
42+
43+
:::
44+
45+
:::{tab-item} pixi
46+
47+
Follow the [installation instructions](https://github.com/prefix-dev/pixi) for
48+
installing `pixi`.
49+
50+
To activate the new environment, run
51+
```
52+
pixi shell
53+
```
3754
and proceed to the ["Running tests and checks"](#running-tests-and-checks) section.
3855

39-
### Using Nix
56+
:::
57+
58+
:::{tab-item} nix
4059

41-
Follow the [installation instructions](https://nixos.org/manual/nix/stable/#chap-installation)
60+
Follow the [installation instructions](https://zero-to-nix.com/start/install)
4261
for setting up Nix in your system (Linux or macOS).
4362

4463
Once Nix is installed, run
@@ -47,18 +66,22 @@ nix develop
4766
```
4867
to start an environment ready for [running tests and checks](#running-tests-and-checks).
4968

50-
### General instructions
69+
:::
70+
71+
:::{tab-item} General instructions
5172

5273
As long as you have `tox` and a Rust compiler available,
53-
you can skip `mamba` or `Nix`.
74+
you can skip `conda`, `pixi`, or `nix`.
5475

5576
For Rust, we suggest using `rustup` to install the Rust environment:
5677
```
5778
curl https://sh.rustup.rs -sSf | sh
5879
```
59-
And for `tox` you can run
80+
81+
And for `tox` you can use [pipx](https://pipx.pypa.io/latest/installation/) for
82+
installing it without interfering with other Python environments:
6083
```
61-
python -m pip install tox
84+
pipx install tox
6285
```
6386

6487
We suggest working on sourmash in a virtualenv; e.g. from within the
@@ -74,12 +97,15 @@ pip install -r requirements.txt
7497
```
7598
(but they are already installed in the virtualenv created with `tox -e dev`).
7699

77-
## Updating your developer environment
78-
79100
To update rust to the latest version, use `rustup update`.
80101

81102
To update your Python dependencies to the latest required for sourmash, you can run `pip install -r requirements.txt`.
82103

104+
:::
105+
106+
::::
107+
108+
83109
## Running tests and checks
84110

85111
We use [`tox`](https://tox.readthedocs.io) for managing dependencies and

0 commit comments

Comments
 (0)