Skip to main content

Local setup for conda-store (core)

There are two main ways to set up your local environment and conda-store services (web UI, API server, database, etc.) for development:

  • Using Docker and Docker compose: This is the recommended approach for working on conda-store-server library.
  • Using standalone mode: Required for running tests and for working on the conda-store (client) library.
important

You need a local copy of the conda-store repository for the development setup.

Pre-requisites

Install the following dependencies before developing on conda-store:

Local deployment

To deploy conda-store locally, run the following command:

docker compose up --build -d

On a fast machine, this should take about 10 seconds, assuming the docker images have been partially built before.

note

Most of the conda-store docker images are built/tested for amd64(x86-64). Notice the architecture: amd64 within the docker-compose.yaml files.

There will be a performance impact when building and running on ARM architectures. Otherwise, this workflow has been shown to run and build on OSX.

The following resources will be available on the deployment:

ResourceLocalhost portusernamepassword
conda-store web server (UI)localhost:8080adminpassword
MinIO S3localhost:9000adminpassword
PostgreSQL (database: conda-store)localhost:5432adminpassword
Redislocalhost:6379-password

If you make any changes to conda-store-server, run the following to have those changes in the deployment:

docker compose down -v
docker compose up --build

To stop the deployment, run:

docker compose stop

Optionally, to remove the containers, run:

docker compose rm -f

Standalone setup 💻

Pre-requisites

You need conda for this setup, you can install it with the instructions in the documentation.

Development environment

Create a conda environment with the development dependencies, and activate the environment:

conda env create -f conda-store-server/environment-dev.yaml
conda activate conda-store-server-dev

To install the conda-store-server package in editable (development) mode, run the following from the root of the repository:

python -m pip install -e ./conda-store-server

To install the conda-store package in editable (development) mode, run the following from the root of the repository:

python -m pip install -e ./conda-store

Start conda-store in standalone mode

Running conda-store in --standalone mode launches celery as a subprocess of the web server.

python -m conda_store_server.server --standalone

Visit localhost:8080 from your web browser to access the conda-store web UI. ✨

Run the test suite ✅

You can run the codebase tests locally to verify your changes before submitting a pull request. You need Docker Compose as well as the conda development environment to run the complete set of tests.

conda-store (client)

Lint and format

Run the linting and formatting checks with hatch:

cd conda-store
hatch env run -e dev lint

Integration tests

These tests are stateful, so clear the state if you previously ran the conda-store-server service on Docker:

cd conda-store
docker compose down -v # ensure you've cleared state
docker compose up --build

Wait until the conda-store-server is running check by visiting localhost:8080.

Install conda-store (client) library in editable mode:

pip install -e .

Execute the scripts in the tests directory to run the tests:

./tests/unauthenticated-tests.sh
./tests/authenticated-tests.sh
./tests/authenticated-token-tests.sh

You need to explicitly set some environment variables to run the shebang tests:

export CONDA_STORE_URL=http://localhost:8080/conda-store
export CONDA_STORE_AUTH=basic
export CONDA_STORE_USERNAME=username
export CONDA_STORE_PASSWORD=password

./tests/shebang.sh

conda-store-server

Lint and format

Run the linting and formatting checks with hatch:

cd conda-store-server
hatch env run -e dev lint

Package build

Check that the package builds:

cd conda-store-server
hatch build

Unit tests

Run the unit tests with pytest:

cd conda-store-server
pytest

Integration tests

These tests are stateful, so clear the state if you previously ran the conda-store-server service on Docker:

cd conda-store-server
docker-compose down -v # ensure you've cleared state
docker-compose up --build

Wait until the conda-store-server is running check by visiting localhost:8080.

Run the tests with hatch:

hatch env run -e dev playwright-test
hatch env run -e dev integration-test