Shared is a place for code that is common to multiple python services within codecov.
shared is a package of its own, so it needs to be installed as a dependency on the services that might use it.
The current services using shared are worker and codecov-api.
To get started, ensure that you have:
- Docker installed on your machine
- Run
docker compose up
In order to run tests from within your docker container, run:
make test
To run a specific test file, run for example:
make test-path TEST_PATH=tests/unit/bundle_analysis/test_bundle_analysis.py
If you make changes to the models in shared/django_apps/ you will need to create migrations to reflect those changes in the database.
Make sure the shared container is running and shell into it
$ docker compose up
$ docker compose exec -it shared /bin/bashNow you can create a migration (from within the container)
$ cd shared/django_apps/
$ python manage.py pgmakemigrationsTo learn more about migrations visit Django Docs
As a normal python package, shared can include dependencies of its own.
Updating them should be done in the pyproject.toml file.
Remember to add dependencies as loosely as possible. Only make sure to include what the minimum version is, and only include a maximum version if you do know that higher versions will break.
Remember that multiple packages, on different contexts of their own requirements, will have to install this. So keeping the requirements loose allow them to avoid version clashes and eases upgrades whenever they need to.