Skip to content

Commit

Permalink
Setup pixi (#95)
Browse files Browse the repository at this point in the history
* setup pixi

Add dependencies, environments and tasks.

Note: dependencies are currently duplicated in pyproject.toml since we
prefer installing spherely dependencies using conda packages instead of
getting them from pypi (see
prefix-dev/pixi#532).

The two "configure" and "compile" tasks consist of raw cmake command
calls so we can better debug any issue during these two stages. Those
tasks are not used to build and install Spherely. Instead, Spherely is
declared as an editable pypi-dependency so that pixi can re-build and
re-install it (via uv/pip and scikit-build-core) when needed. The
`build-dir` scikit-build option has been set to speed-up rebuilds.

* test pixi configuration in CI

* doc: add instructions to get started using pixi
  • Loading branch information
benbovy authored Feb 4, 2025
1 parent f050013 commit 18eb795
Show file tree
Hide file tree
Showing 5 changed files with 11,075 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,17 @@ jobs:
verbose: true
if: |
runner.os == 'Linux' && matrix.python-version == '3.11' && matrix.dev == false
test_with_pixi:
name: Tests via pixi
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.40.1
cache: true

- run: pixi run --environment test tests
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@ compile_commands.json
# docs
docs/build/
docs/_api_generated

# pixi
.pixi
47 changes: 42 additions & 5 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,61 @@ Additional build dependencies:
- CMake
- [scikit-build-core](https://github.com/scikit-build/scikit-build-core)

### Cloning the source repository

Spherely's source code can be downloaded by cloning its [source
repository](https://github.com/benbovy/spherely):

```sh
$ git clone https://github.com/benbovy/spherely
$ cd spherely
```

### Setting up a development environment using pixi

Spherely provides everything needed to manage its dependencies and run common
tasks via [pixi](https://pixi.sh).

If you have `pixi` installed, you can install a complete development environment
for your platform simply by executing the following command from Spherely's
project root directory:

```sh
$ pixi install --environment all
```

Running the command below from Spherely's root directory will install all
required tools and dependencies (if not installed yet) in a local environment,
build and install Spherely (if needed) and run the tests:

```sh
$ pixi run tests
```

All available tasks are detailed in the ``pyproject.toml`` file or listed via
the following command:

```sh
$ pixi task list
```

### Setting up a development environment using conda

All the requirements listed above are available via conda-forge.
If you don't have `pixi` installed, you can follow the steps below to manually
setup a conda environment for developing Spherely.

After cloning Spherely's [source
repository](https://github.com/benbovy/spherely), create a conda environment
After cloning Spherely's source repository, create a conda environment
with the required (and development) dependencies using the
`ci/environment-dev.yml` file:

```sh
$ conda env create -f spherely/ci/environment-dev.yml
$ conda env create -f ci/environment-dev.yml
$ conda activate spherely-dev
```

Build and install Spherely:

```sh
$ cd spherely
$ python -m pip install . -v --no-build-isolation
```

Expand Down
Loading

0 comments on commit 18eb795

Please sign in to comment.