When contributing to this repository, please first discuss the change you wish to make via an issue if applicable.
If you are part of the MaastrichtU-IDS organization on GitHub you can directly create a branch in this repository. Otherwise you will need to first fork this repository.
To work with translator-openpredict locally:
-
Clone the repository:
git clone https://github.com/MaastrichtU-IDS/translator-openpredict.git cd translator-openpredict
-
Install hatch to manage the project, then use hatch to install the dependencies, this will also pull the data required to run the models in the
data
folder withdvc
, and install pre-commit hooks:pip install hatch hatch env create
Warning
For the project to take into account the code changes in dependencies you will need to activate the virtual environment yourself and install all packages that will changes in edit mode:
pip install -e ./predict-drug-target .
Start the API in development with docker, the API will automatically reload when you make changes in the code:
docker-compose up api
You will need to re-build the docker image if you add new dependencies to the pyproject.toml
:
docker-compose up api --build
For OpenPredict model:
docker-compose run --entrypoint "python src/openpredict_model/train.py" tests
Run the integrations tests with docker:
docker-compose run tests
Or you can run the tests locally after starting the API with docker-compose:
docker-compose exec api pytest tests/integration
See the TESTING.md
file for more details on testing the API.
To automatically format the code with isort, autoflake, etc, run:
hatch run fmt
If you make changes to the data in the data
folder you will need to add and push this data on DagsHub with dvc
-
Go to dagshub.com, and login with GitHub or Google
-
Get your token and set your credentials:
export DAGSHUB_USER="vemonet" export DAGSHUB_TOKEN="TOKEN"
-
Connect your local repository with the created DagsHub project:
dvc remote add origin https://dagshub.com/vemonet/translator-openpredict.dvc dvc remote modify origin --local auth basic dvc remote modify origin --local user $DAGSHUB_USER dvc remote modify origin --local password $DAGSHUB_TOKEN
-
Push data:
dvc push
⚠️ Open source projects on DagsHub using the free plan have a 10G storage limit.
Checkout the documentation of the trapi-predict-kit
library to add new predictions models.
-
Ensure the tests are passing before sending a pull request 🧪
-
Update the
README.md
with details of changes, this includes new environment variables, exposed ports, useful file locations and container parameters 📝 -
Send a pull request to the
master
branch, answer the questions in the pull request message 📤 -
Project contributors will review your change as soon as they can ✔️
This part is not required to be completed if you are looking into contributing, it is purely informative on the release process of the OpenPredict API.
The versioning scheme for new releases on GitHub used is SemVer (Semantic Versioning).
- Change version in
setup.py
before new a release, e.g.0.0.7
- Create a new release in the GitHub web UI.Provide the version as tag, e.g.
v0.0.7
- When you publish the new release, a GitHub Action workflow will be automatically run to run the tests, and publish the
openpredict
package to PyPI.
When publishing a new version of OpenPredict we usually also publish an updated Docker image to the MaastrichtU-IDS GitHub Container Registry.
Replace the
latest
tag by your version number, e.g.v0.0.7
Build the OpenPredict API Docker image:
docker build -t ghcr.io/maastrichtu-ids/openpredict-api:latest .
Push to the MaastrichtU-IDS GitHub Container Registry
docker push ghcr.io/maastrichtu-ids/openpredict-api:latest
Get the latest TRAPI YAML: https://github.com/NCATSTranslator/ReasonerAPI/blob/master/TranslatorReasonerAPI.yaml
- Update description of the service
- Add additional calls exclusive to OpenPredict
- Add
operationId
for each call - In
components:
addschemas: QueryOptions