Contributing to AnyVar
Installing For Development
Clone and enter the repo, use the devready Makefile target to set up a virtual environment, then activate it and install pre-commit hooks:
git clone https://github.com/biocommons/anyvar.git
cd anyvar
make devready
source venv/3.11/bin/activate
pre-commit install
Testing
Some configuration is required to run tests:
Install test dependencies - in your AnyVar environment, ensure that the
testdependency group is available by runningmake testreadyin the root directory.Configure test database - unit and integration tests will set up a storage instance using the connection string defined by the environment variable
ANYVAR_TEST_STORAGE_URI(notANYVAR_STORAGE_URI!), which defaults to"postgresql://postgres:postgres@localhost:5432/anyvar_test".
Note
Ensure that the database and role are available in the PostgreSQL instance.
For example, to support the connection string "postgresql://anyvar_test_user:anyvar_test_pw@localhost:5432/anyvar_test_db", run
psql -U postgres -c "CREATE USER anyvar_test_user WITH PASSWORD 'anyvar_test_pw';"
psql -U postgres -c "CREATE DATABASE anyvar_test_db WITH OWNER anyvar_test_user;"
psql -U postgres -d anyvar_test_db -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
Ensure Celery backend and broker are available, and that Celery workers are NOT running - the task queueing tests create and manage their own Celery workers, but they do require access to a broker/backend for message transport and result storage. See async task queuing setup instructions for more. If an existing AnyVar Celery worker is running, they may not function properly.
Tests are invoked with the pytest command. The project Makefile includes an easy shortcut:
make test
Documentation
To build documentation, use the docs Makefile target from the project root directory:
make docs
HTML output is built in the subdirectory docs/build/html/.
The docs use Sphinx GitHub Changelog to automatically generate the changelog page. A GitHub API token must be provided for the Sphinx build process to fetch GitHub release history and generate this page. If not provided, an error will be logged during the build and the page will be blank.