How to set up your development environment#
With Pixi#
The development workflow is built around Pixi. Install
Pixi and Git, then clone this
repository alongside conda/conda, whose test data is used by the test and
benchmark tasks:
git clone https://github.com/conda/conda.git
git clone https://github.com/conda/conda-rattler-solver.git
cd conda-rattler-solver
The tasks expect conda’s test data at ../conda/tests/data. Pixi installs the
locked dependencies and an editable copy of this repository when you run them.
The development dependencies bootstrap conda with a compatible solver from
conda-canary/label/dev, then replace it with this checkout for tests and benchmarks.
For example, to run the test suite with Python 3.13:
pixi run --locked -e test-py313 test
The available environments are defined in pyproject.toml. The ones you will
use most often are:
Environment |
Purpose |
|---|---|
|
Run the tests and benchmarks on a given Python version |
|
Run the pre-commit hooks |
|
Build this documentation |
|
Build the conda package from |
See Typical development workflows for the tasks each one offers.
With devcontainer in VS Code#
A devcontainer configuration is bundled in this repository for a disposable
Linux environment. You’ll need Docker and VS Code with the
Dev Containers extension:
Clone
conda/condaandconda/conda-rattler-solverto your preferred locations, for example,~/devel/condaand~/devel/conda-rattler-solver. The location does not matter as long as both repositories have the same parent directory.Open your
conda-rattler-solverclone with VS Code.Connect to the DevContainer image via the bottom-left menu (❱❰) and click on “Reopen in Container”. The image is based on Miniforge.
The image will be built and after a couple of minutes, you’ll be dropped into a Bash shell. Since the local repositories are mounted, you can make modifications to the source live, and they will be reflected in the Docker instance automatically. Run
pytestorcondaas needed, no need to reload Docker!If the development environment breaks, click again on ❱❰ and, this time, choose “Rebuild container”. You might need to retry a couple of times.
With regular Docker#
You can reuse the devcontainer scripts with regular Docker too.
Clone
conda/condaandconda/conda-rattler-solverto your preferred locations, as above.Start a new Docker instance with this command. Adjust the local mounts as necessary.
docker run -it --rm \ -v ~/devel/conda:/workspaces/conda \ -v ~/devel/conda-rattler-solver:/workspaces/conda-rattler-solver \ condaforge/miniforge3:latest \ bash
Run the
post_createandpost_startscripts:bash /workspaces/conda-rattler-solver/.devcontainer/post_create.sh bash /workspaces/conda-rattler-solver/.devcontainer/post_start.sh
Manual setup#
If you prefer to manage the environment yourself, be careful with overwriting
your existing conda installations, especially when it comes to shell
initialisation.
Get yourself familiar with the “Development environment” guide for
condaitself.Fork and clone the conda-rattler-solver repository to your preferred location:
git clone "git@github.com:$YOUR_USERNAME/conda-rattler-solver" "$REPO_LOCATION" cd "$REPO_LOCATION"
Install the required dependencies for conda-rattler-solver:
CONDA_CHANNEL_PRIORITY=flexible conda install \ --file "$REPO_LOCATION"/dev/requirements.txt \ --file "$REPO_LOCATION"/tests/requirements.txt
Install conda-rattler-solver in editable mode:
cd "$REPO_LOCATION" python -m pip install --no-deps -e .
Debugging#
Once you have followed the steps above you may need to investigate the state at
a particular point. Insert a
breakpoint() within the code
and run a test or conda directly to hit the breakpoint.
Most of the solving logic is in Rust code, inside the rattler and resolvo
libraries. The Python side of this plugin is responsible for translating
conda’s view of the request (installed packages, history, pins, and channel configuration) into py-rattler objects, running the solve, and translating
the result back. If you suspect a bug in the solver itself, we suggest investigating
against the rattler repository.