Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

CONTRIBUTING.md 6.9 KB

You have to be logged in to leave a comment. Sign In

Test production API Run integration tests for TRAPI

Python versions Version SonarCloud Coverage SonarCloud Maintainability Rating CII Best  Practices

Contributing

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.

๐Ÿ‘ฉโ€๐Ÿ’ป Development process

To work with translator-openpredict locally:

๐Ÿ“ฅ๏ธ Install

  1. Clone the repository:

    git clone https://github.com/MaastrichtU-IDS/translator-openpredict.git
    cd translator-openpredict
    
  2. 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 with dvc, 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

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

๐Ÿ‹๏ธ Run training

For OpenPredict model:

docker-compose run --entrypoint "python src/openpredict_model/train.py" tests

๐Ÿงช Run tests

Run 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.

Format

To automatically format the code with isort, autoflake, etc, run:

hatch run fmt

๐Ÿ“ค๏ธ Push changes to the data

If you make changes to the data in the data folder you will need to add and push this data on DagsHub with dvc

  1. Go to dagshub.com, and login with GitHub or Google

  2. Get your token and set your credentials:

    export DAGSHUB_USER="vemonet"
    export DAGSHUB_TOKEN="TOKEN"
    
  3. 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
    
  4. Push data:

    dvc push
    

โš ๏ธ Open source projects on DagsHub using the free plan have a 10G storage limit.

๐Ÿ“ Integrate new prediction models

Checkout the documentation of the trapi-predict-kit library to add new predictions models.

๐Ÿ“ฌ Pull Request process

  1. Ensure the tests are passing before sending a pull request ๐Ÿงช

  2. Update the README.md with details of changes, this includes new environment variables, exposed ports, useful file locations and container parameters ๐Ÿ“

  3. Send a pull request to the master branch, answer the questions in the pull request message ๐Ÿ“ค

  4. Project contributors will review your change as soon as they can โœ”๏ธ


โ„น๏ธ Additional informations about releases

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.

๐Ÿท๏ธ Release process

The versioning scheme for new releases on GitHub used is SemVer (Semantic Versioning).

  1. Change version in setup.py before new a release, e.g. 0.0.7
  2. Create a new release in the GitHub web UI.Provide the version as tag, e.g. v0.0.7
  3. 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.

๐Ÿ“ฆ Publish a new Docker image

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

Update the TRAPI version

Get the latest TRAPI YAML: https://github.com/NCATSTranslator/ReasonerAPI/blob/master/TranslatorReasonerAPI.yaml

  1. Update description of the service
  2. Add additional calls exclusive to OpenPredict
  3. Add operationId for each call
  4. In components: add schemas: QueryOptions
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...