Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cf31cc4
Switch to pixi and rattler build.
lohedges Feb 5, 2026
ec644db
Add auto-generated version file to gitignore.
lohedges Feb 6, 2026
814cd47
Save the perturbed system to the output directory.
lohedges Feb 6, 2026
de4a6a3
Only convert if a filename has been set.
lohedges Feb 6, 2026
2ac8170
Fix install path.
lohedges Feb 9, 2026
b34748f
Remove numpy pin.
lohedges Feb 9, 2026
08f0879
Fix shell quoting.
lohedges Feb 9, 2026
749f31b
Use relative paths to avoid path mangling.
lohedges Feb 9, 2026
d375246
Add linting tools to dev environment.
lohedges Feb 11, 2026
eef3790
Add pre-commit.
lohedges Feb 11, 2026
a57d00f
Autoformat and lint with ruff.
lohedges Feb 11, 2026
71f22e2
Remove redundant sections of recipe.
lohedges Feb 11, 2026
8d28970
Update gitignore.
lohedges Feb 11, 2026
e117d0e
Add rattler-build to development environment.
lohedges Feb 11, 2026
45789e4
Use pixi install of rattler-build.
lohedges Feb 11, 2026
6b254d7
Remove redundant setup.py file.
lohedges Feb 12, 2026
47d80e4
Add YAML serialisation for custom lambda schedules and restraints.
lohedges Feb 12, 2026
5c76850
Fix handling of different perturbed_system formats.
lohedges Feb 12, 2026
d92fa7d
nvidia-ml-py is noarch.
lohedges Feb 12, 2026
2108582
Fix recipe.
lohedges Feb 12, 2026
00416d3
Skip tests on macOS.
lohedges Feb 12, 2026
f571d02
Add MANIFEST for tests files and refactor recipe.
lohedges Feb 12, 2026
cc4c0c6
Remove import tests since they don't work with conditionals.
lohedges Feb 12, 2026
48c5df9
Fix recipe conditional formatting.
lohedges Feb 12, 2026
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
65 changes: 38 additions & 27 deletions .github/workflows/devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Devel
on:
workflow_dispatch:
push:
branches: [ devel ]
branches: [devel]

jobs:
build:
Expand All @@ -18,11 +18,9 @@ jobs:
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
exclude:
# Exclude all but the latest Python from all
# but Linux
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
environment:
name: somd2-build
defaults:
Expand All @@ -32,30 +30,43 @@ jobs:
SIRE_DONT_PHONEHOME: 1
SIRE_SILENT_PHONEHOME: 1
steps:
- uses: conda-incubator/setup-miniconda@v3
#
- uses: actions/checkout@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: somd2_build
miniforge-version: latest
#
- name: Clone the devel branch
run: git clone -b devel https://github.com/openbiosim/somd2
#
- name: Setup Conda
run: conda install -y -c conda-forge boa anaconda-client packaging
#
- name: Update Conda recipe
run: python ${{ github.workspace }}/somd2/actions/update_recipe.py
#
- name: Prepare build location
run: mkdir ${{ github.workspace }}/build
#
- name: Build Conda package using conda build
run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/somd2/recipes/somd2
#
- name: Upload Conda package
run: python ${{ github.workspace }}/somd2/actions/upload_package.py
fetch-depth: 0
#
- name: Compute version info
shell: bash
run: python actions/update_recipe.py
#
- name: Create sdist
run: pip install build && python -m build --sdist && mv dist/*.tar.gz somd2-source.tar.gz
working-directory: ${{ github.workspace }}
#
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
run-install: false
#
- name: Install rattler-build
shell: bash
run: pixi global install rattler-build
#
- name: Write Python variant config
shell: bash
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
#
- name: Build package using rattler-build
shell: bash
run: rattler-build build --recipe "${{ github.workspace }}/recipes/somd2" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"
#
- name: Install anaconda-client
shell: bash
run: python -m pip install anaconda-client
#
- name: Upload package
shell: bash
run: python actions/upload_package.py
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
ANACONDA_LABEL: dev
63 changes: 39 additions & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
exclude:
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.12" # MacOS can't run 3.12 yet...
python-version: "3.12" # MacOS can't run 3.12 yet...
environment:
name: somd2-build
defaults:
Expand All @@ -33,30 +33,45 @@ jobs:
SIRE_DONT_PHONEHOME: 1
SIRE_SILENT_PHONEHOME: 1
steps:
- uses: conda-incubator/setup-miniconda@v3
#
- uses: actions/checkout@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: somd2_build
miniforge-version: latest
#
- name: Clone the main branch
run: git clone -b main https://github.com/openbiosim/somd2
#
- name: Setup Conda
run: conda install -y -c conda-forge boa anaconda-client packaging
#
- name: Update Conda recipe
run: python ${{ github.workspace }}/somd2/actions/update_recipe.py
#
- name: Prepare build location
run: mkdir ${{ github.workspace }}/build
#
- name: Build Conda package using conda build
run: conda build -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/somd2/recipes/somd2
#
- name: Upload Conda package
run: python ${{ github.workspace }}/somd2/actions/upload_package.py
ref: main
fetch-depth: 0
#
- name: Compute version info
shell: bash
run: python actions/update_recipe.py
#
- name: Create sdist
run: pip install build && python -m build --sdist && mv dist/*.tar.gz somd2-source.tar.gz
working-directory: ${{ github.workspace }}
#
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
run-install: false
#
- name: Install rattler-build
shell: bash
run: pixi global install rattler-build
#
- name: Write Python variant config
shell: bash
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
#
- name: Build package using rattler-build
shell: bash
run: rattler-build build --recipe "${{ github.workspace }}/recipes/somd2" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
#
- name: Install anaconda-client
shell: bash
run: python -m pip install anaconda-client
if: github.event.inputs.upload_packages == 'true'
#
- name: Upload package
shell: bash
run: python actions/upload_package.py
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
ANACONDA_LABEL: main
Expand Down
60 changes: 33 additions & 27 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ jobs:
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
exclude:
# Exclude all but the latest Python from all
# but Linux
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.10"
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.12" # MacOS can't run 3.12 yet...
python-version: "3.12" # MacOS can't run 3.12 yet...
environment:
name: somd2-build
defaults:
Expand All @@ -33,31 +31,39 @@ jobs:
env:
SIRE_DONT_PHONEHOME: 1
SIRE_SILENT_PHONEHOME: 1
REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}"
steps:
- uses: conda-incubator/setup-miniconda@v3
#
- uses: actions/checkout@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: somd2_build
miniforge-version: latest
#
- name: Clone the feature branch
run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} somd2
#
- name: Setup Conda
run: conda install -y -c conda-forge boa anaconda-client packaging
#
- name: Update Conda recipe
run: python ${{ github.workspace }}/somd2/actions/update_recipe.py
#
- name: Prepare build location
run: mkdir ${{ github.workspace }}/build
#
- name: Build Conda package using conda build using main channel
fetch-depth: 0
#
- name: Compute version info
shell: bash
run: python actions/update_recipe.py
#
- name: Create sdist
run: pip install build && python -m build --sdist && mv dist/*.tar.gz somd2-source.tar.gz
working-directory: ${{ github.workspace }}
#
- name: Install pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
run-install: false
#
- name: Install rattler-build
shell: bash
run: pixi global install rattler-build
#
- name: Write Python variant config
shell: bash
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
#
- name: Build package using rattler-build (main channel)
if: ${{ github.base_ref == 'main' }}
run: conda build -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/somd2/recipes/somd2
#
- name: Build Conda package using conda build using dev channel
shell: bash
run: rattler-build build --recipe "${{ github.workspace }}/recipes/somd2" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
#
- name: Build package using rattler-build (dev channel)
if: ${{ github.base_ref != 'main' }}
run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/somd2/recipes/somd2
shell: bash
run: rattler-build build --recipe "${{ github.workspace }}/recipes/somd2" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ setup.err
dist/
build/
somd2.egg-info
src/somd2/_version.py

# Test output.
output.yaml
Expand All @@ -35,5 +34,5 @@ output.yaml
# VSCode config
.vscode/

# Conda recipe (it is auto-generated)
recipes/somd2/meta.yaml
# Auto-generated version file
src/somd2/_version.py
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
files: ^(src|tests)/
exclude: ^tests/(input|output)/

repos:
# General file quality checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: [--maxkb=1000] # Prevent files larger than 1MB
- id: check-merge-conflict

# Python formatting and linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
# Run the formatter
- id: ruff-format
# Run the linter (optional - remove if too strict)
- id: ruff
args: [--fix, --exit-zero] # Auto-fix but don't block commits
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graft tests
73 changes: 61 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,91 @@ simulations. Built on top of [Sire](https://github.com/OpenBioSim/sire) and [Ope

## Installation

First create a conda environment using the provided environment file:
### Conda package

Install `somd2` directly from the `openbiosim` channel:

```
conda env create -f environment.yaml
conda install -c conda-forge -c openbiosim somd2
```

(We recommend using [Miniforge](https://github.com/conda-forge/miniforge).)
Or, for the development version:

> [!NOTE]
> On macOS, you will need to use the `environment_macos.yaml` file instead.
```
conda install -c conda-forge -c openbiosim/label/dev somd2
```

Now install `somd2` into the environment:
### Installing from source (standalone)

To install from source using [pixi](https://pixi.sh), which will
automatically create an environment with all required dependencies
(including pre-built [Sire](https://github.com/OpenBioSim/sire),
[BioSimSpace](https://github.com/OpenBioSim/biosimspace),
[Ghostly](https://github.com/OpenBioSim/ghostly), and
[Loch](https://github.com/OpenBioSim/loch)):

```
conda activate somd2
pip install --editable .
git clone https://github.com/openbiosim/somd2
cd somd2
pixi install
pixi shell
pip install -e .
```

Alternatively, to install into an existing conda environment:
### Installing from source (full OpenBioSim development)

If you are developing across the full OpenBioSim stack, first install
[Sire](https://github.com/OpenBioSim/sire) from source by following the
instructions [here](https://github.com/OpenBioSim/sire#installation), then
activate its pixi environment:

```
conda install -c conda-forge -c openbiosim somd2
pixi shell --manifest-path /path/to/sire/pixi.toml -e dev
```

Or, for the development version:
You may also need to install other packages from source, e.g.
[BioSimSpace](https://github.com/OpenBioSim/biosimspace),
[Ghostly](https://github.com/OpenBioSim/ghostly), and
[Loch](https://github.com/OpenBioSim/loch):

```
conda install -c conda-forge -c openbiosim/label/dev somd2
pip install -e /path/to/biosimspace
pip install -e /path/to/ghostly
pip install -e /path/to/loch
```

Then install `somd2` into the environment:

```
pip install -e .
```

### Testing

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

```
somd2 --help
```

## Development

Pre-commit hooks are used to ensure consistent code formatting and linting.
To set up pre-commit in your development environment:

```
pixi shell -e dev
pre-commit install
```

This will run [ruff](https://docs.astral.sh/ruff/) formatting and linting
checks automatically on each commit. To run the checks manually against all
files:

```
pre-commit run --all-files
```

## Usage

In order to run an alchemical free-energy simulation you will need to
Expand Down
Loading