Skip to content

๐Ÿ› ๏ธ Contributing

Build Lint and Test codecov dependency status

The usual process to make a contribution is to:

  1. Check for existing related issues on GitHub
  2. Fork the repository and create a new branch
  3. Make your changes
  4. Make sure formatting, linting and tests passes.
  5. Add tests if possible to cover the lines you added.
  6. Commit, and send a Pull Request.

๐Ÿ“ฅ๏ธ Clone the repository

Clone the curies.rs repository, cd into it, and create a new branch for your contribution:

git clone https://github.com/biopragmatics/curies.rs.git
cd curies.rs

โš™๏ธ Install dependencies

Rust, Python, NodeJS, and R are required for development.

Install development dependencies:

./scripts/install-dev.sh

VSCode extension

If you are using VSCode we strongly recommend to install the rust-lang.rust-analyzer extension.

๐Ÿงช Run tests

๐Ÿฆ€ Test Rust crate

Run tests for all packages:

cargo test

More options

Display prints:

cargo test -- --nocapture

Run a specific test:

cargo test new_empty_converter -- --nocapture

If tests panic without telling on which test it failed, use:

cargo test -- --test-threads=1

Test the curies crate with code coverage:

./scripts/cov.sh

๐Ÿ Test Python

Build the pip package, and run pytest:

./scripts/test-python.sh

Or just run the tests:

source .venv/bin/activate
python -m pytest python/tests/

๐ŸŸจ Test JavaScript

Build the npm package, and run the jest tests in a NodeJS environment:

./scripts/test-js.sh

Start a web server to use the dev page:

python -m http.server 3000 --directory ./js

Open localhost:3000 in your web browser to check the browser dev page.

๐Ÿ“ˆ Test R

Build and test R bindings:

./scripts/test-r.sh

The first time you will need to add the --install flag to install dependencies:

./scripts/test-r.sh --install

Force build

You can force rextendr to re-build the bindings by making a change to one of the docstring /// in the /r/rust/src code

๐Ÿงน Format and lint

Format code with rustfmt:

cargo fmt

Lint check with clippy:

cargo clippy --all --all-targets --all-features

๐Ÿ“– Generate docs locally

Build and serve:

./scripts/docs.sh

๏ธโ›“๏ธ Check supply chain

Check the dependency supply chain, only accept dependencies with OSI or FSF approved licenses.

cargo deny check

Make sure dependencies are up-to-date:

cargo update
cargo outdated

๐Ÿท๏ธ Publish a new release

Automated release

Building and publishing artifacts (binaries, pip wheels, npm package) will be done automatically by the .github/workflows/build.yml GitHub action when you push a new tag.

Set secrets for the GitHub repository

Make sure you have set the following tokens as secrets on GitHub for this repository: PYPI_TOKEN, NPM_TOKEN, CRATES_IO_TOKEN, CODECOV_TOKEN

To release a new version, run the release script providing the new version following semantic versioning, it will bump the version in the Cargo.toml files, generate the changelog from commit messages, create a new tag, and push to GitHub; the workflow will do the rest:

./scripts/release.sh 0.1.2