Skip to content

Commit e2bd3b7

Browse files
committed
Switch to pixi and rattler build.
1 parent 0401b90 commit e2bd3b7

11 files changed

Lines changed: 274 additions & 260 deletions

File tree

.github/workflows/devel.yaml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release Devel
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [ devel ]
6+
branches: [devel]
77

88
jobs:
99
build:
@@ -18,11 +18,9 @@ jobs:
1818
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
1919
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
2020
exclude:
21-
# Exclude all but the latest Python from all
22-
# but Linux
2321
- platform:
2422
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
25-
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
23+
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
2624
environment:
2725
name: ghostly-build
2826
defaults:
@@ -32,30 +30,38 @@ jobs:
3230
SIRE_DONT_PHONEHOME: 1
3331
SIRE_SILENT_PHONEHOME: 1
3432
steps:
35-
- uses: conda-incubator/setup-miniconda@v3
33+
#
34+
- uses: actions/checkout@v4
3635
with:
37-
auto-update-conda: true
38-
python-version: ${{ matrix.python-version }}
39-
activate-environment: ghostly_build
40-
miniforge-version: latest
41-
#
42-
- name: Clone the devel branch
43-
run: git clone -b devel https://github.com/openbiosim/ghostly
44-
#
45-
- name: Setup Conda
46-
run: conda install -y -c conda-forge boa anaconda-client packaging
47-
#
48-
- name: Update Conda recipe
49-
run: python ${{ github.workspace }}/ghostly/actions/update_recipe.py
50-
#
51-
- name: Prepare build location
52-
run: mkdir ${{ github.workspace }}/build
53-
#
54-
- name: Build Conda package using conda build
55-
run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/ghostly/recipes/ghostly
56-
#
57-
- name: Upload Conda package
58-
run: python ${{ github.workspace }}/ghostly/actions/upload_package.py
36+
fetch-depth: 0
37+
#
38+
- name: Compute version info
39+
run: python ${{ github.workspace }}/actions/update_recipe.py
40+
#
41+
- name: Create sdist
42+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz ghostly-source.tar.gz
43+
working-directory: ${{ github.workspace }}
44+
#
45+
- name: Install rattler-build
46+
uses: prefix-dev/rattler-build-action@v0.2.34
47+
with:
48+
tool-version: latest
49+
build-args: --help
50+
#
51+
- name: Write Python variant config
52+
shell: bash
53+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
54+
#
55+
- name: Build package using rattler-build
56+
shell: bash
57+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/ghostly" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"
58+
#
59+
- name: Install anaconda-client
60+
run: python -m pip install anaconda-client
61+
if: ${{ matrix.platform.name == 'linux' && matrix.python-version == '3.11' }}
62+
#
63+
- name: Upload package
64+
run: python ${{ github.workspace }}/actions/upload_package.py
5965
env:
6066
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
6167
ANACONDA_LABEL: dev

.github/workflows/main.yaml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
exclude:
2424
- platform:
2525
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
26-
python-version: "3.12" # MacOS can't run 3.12 yet...
26+
python-version: "3.12" # MacOS can't run 3.12 yet...
2727
environment:
2828
name: ghostly-build
2929
defaults:
@@ -33,30 +33,39 @@ jobs:
3333
SIRE_DONT_PHONEHOME: 1
3434
SIRE_SILENT_PHONEHOME: 1
3535
steps:
36-
- uses: conda-incubator/setup-miniconda@v3
36+
#
37+
- uses: actions/checkout@v4
3738
with:
38-
auto-update-conda: true
39-
python-version: ${{ matrix.python-version }}
40-
activate-environment: ghostly_build
41-
miniforge-version: latest
42-
#
43-
- name: Clone the main branch
44-
run: git clone -b main https://github.com/openbiosim/ghostly
45-
#
46-
- name: Setup Conda
47-
run: conda install -y -c conda-forge boa anaconda-client packaging
48-
#
49-
- name: Update Conda recipe
50-
run: python ${{ github.workspace }}/ghostly/actions/update_recipe.py
51-
#
52-
- name: Prepare build location
53-
run: mkdir ${{ github.workspace }}/build
54-
#
55-
- name: Build Conda package using conda build
56-
run: conda build -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/ghostly/recipes/ghostly
57-
#
58-
- name: Upload Conda package
59-
run: python ${{ github.workspace }}/ghostly/actions/upload_package.py
39+
ref: main
40+
fetch-depth: 0
41+
#
42+
- name: Compute version info
43+
run: python ${{ github.workspace }}/actions/update_recipe.py
44+
#
45+
- name: Create sdist
46+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz ghostly-source.tar.gz
47+
working-directory: ${{ github.workspace }}
48+
#
49+
- name: Install rattler-build
50+
uses: prefix-dev/rattler-build-action@v0.2.34
51+
with:
52+
tool-version: latest
53+
build-args: --help
54+
#
55+
- name: Write Python variant config
56+
shell: bash
57+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
58+
#
59+
- name: Build package using rattler-build
60+
shell: bash
61+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/ghostly" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
62+
#
63+
- name: Install anaconda-client
64+
run: python -m pip install anaconda-client
65+
if: github.event.inputs.upload_packages == 'true' && matrix.platform.name == 'linux' && matrix.python-version == '3.11'
66+
#
67+
- name: Upload package
68+
run: python ${{ github.workspace }}/actions/upload_package.py
6069
env:
6170
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
6271
ANACONDA_LABEL: main

.github/workflows/pr.yaml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ jobs:
1717
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
1818
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
1919
exclude:
20-
# Exclude all but the latest Python from all
21-
# but Linux
2220
- platform:
2321
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
2422
python-version: "3.10"
2523
- platform:
2624
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
27-
python-version: "3.12" # MacOS can't run 3.12 yet...
25+
python-version: "3.12" # MacOS can't run 3.12 yet...
2826
environment:
2927
name: ghostly-build
3028
defaults:
@@ -35,29 +33,34 @@ jobs:
3533
SIRE_SILENT_PHONEHOME: 1
3634
REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}"
3735
steps:
38-
- uses: conda-incubator/setup-miniconda@v3
36+
#
37+
- uses: actions/checkout@v4
3938
with:
40-
auto-update-conda: true
41-
python-version: ${{ matrix.python-version }}
42-
activate-environment: ghostly_build
43-
miniforge-version: latest
44-
#
45-
- name: Clone the feature branch
46-
run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} ghostly
47-
#
48-
- name: Setup Conda
49-
run: conda install -y -c conda-forge boa anaconda-client packaging
50-
#
51-
- name: Update Conda recipe
52-
run: python ${{ github.workspace }}/ghostly/actions/update_recipe.py
53-
#
54-
- name: Prepare build location
55-
run: mkdir ${{ github.workspace }}/build
56-
#
57-
- name: Build Conda package using conda build using main channel
39+
fetch-depth: 0
40+
#
41+
- name: Compute version info
42+
run: python ${{ github.workspace }}/actions/update_recipe.py
43+
#
44+
- name: Create sdist
45+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz ghostly-source.tar.gz
46+
working-directory: ${{ github.workspace }}
47+
#
48+
- name: Install rattler-build
49+
uses: prefix-dev/rattler-build-action@v0.2.34
50+
with:
51+
tool-version: latest
52+
build-args: --help
53+
#
54+
- name: Write Python variant config
55+
shell: bash
56+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
57+
#
58+
- name: Build package using rattler-build (main channel)
5859
if: ${{ github.base_ref == 'main' }}
59-
run: conda build -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/ghostly/recipes/ghostly
60-
#
61-
- name: Build Conda package using conda build using dev channel
60+
shell: bash
61+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/ghostly" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
62+
#
63+
- name: Build package using rattler-build (dev channel)
6264
if: ${{ github.base_ref != 'main' }}
63-
run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/ghostly/recipes/ghostly
65+
shell: bash
66+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/ghostly" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"

README.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,41 +30,60 @@ See the [examples](examples) directory for more details.
3030

3131
## Installation
3232

33-
First create a conda environment using the provided environment file:
33+
### Conda package
34+
35+
Install `ghostly` directly from the `openbiosim` channel:
3436

3537
```
36-
conda env create -f environment.yaml
38+
conda install -c conda-forge -c openbiosim ghostly
3739
```
3840

39-
(We recommend using [Miniforge](https://github.com/conda-forge/miniforge).)
40-
41-
Now install `ghostly` into the environment:
41+
Or, for the development version:
4242

4343
```
44-
conda activate ghostly
45-
pip install .
44+
conda install -c conda-forge -c openbiosim/label/dev ghostly
4645
```
4746

48-
Or, for an editable install (useful for development):
47+
### Installing from source (standalone)
48+
49+
To install from source using [pixi](https://pixi.sh), which will
50+
automatically create an environment with all required dependencies
51+
(including pre-built [Sire](https://github.com/OpenBioSim/sire) and
52+
[BioSimSpace](https://github.com/OpenBioSim/biosimspace)):
4953

5054
```
51-
conda activate ghostly
55+
git clone https://github.com/openbiosim/ghostly
56+
cd ghostly
57+
pixi install
58+
pixi shell
5259
pip install -e .
5360
```
5461

55-
For an existing conda environment, you can also install `ghostly` directly from
56-
the `openbiosim` channel:
62+
### Installing from source (full OpenBioSim development)
63+
64+
If you are developing across the full OpenBioSim stack, first install
65+
[Sire](https://github.com/OpenBioSim/sire) from source by following the
66+
instructions [here](https://github.com/OpenBioSim/sire#installation), then
67+
activate its pixi environment:
5768

5869
```
59-
conda install -c conda-forge -c openbiosim ghostly
70+
pixi shell --manifest-path /path/to/sire/pixi.toml -e dev
6071
```
6172

62-
Or, for the development version:
73+
You may also need to install other packages from source, e.g.
74+
[BioSimSpace](https://github.com/OpenBioSim/biosimspace):
6375

6476
```
65-
conda install -c conda-forge -c openbiosim/label/dev ghostly
77+
pip install -e /path/to/biosimspace/python
78+
```
79+
80+
Then install `ghostly` into the environment:
81+
82+
```
83+
pip install -e .
6684
```
6785

86+
### Testing
6887

6988
You should now have a `ghostly` executable in your path. To test, run:
7089

0 commit comments

Comments
 (0)