Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 2.93 KB

CONTRIBUTING.md

File metadata and controls

100 lines (67 loc) · 2.93 KB

Contributing to tsdownsample

Welcome! We're happy to have you here. Thank you in advance for your contribution to tsdownsample.

The basics

tsdownsample welcomes contributions in the form of Pull Requests. For small changes (e.g., bug fixes), feel free to submit a PR. For larger changes (e.g., new functionality, major refactoring), consider submitting an Issue outlining your proposed change.

Prerequisites

tsdownsample is written in Rust. You'll need to install the Rust toolchain for development.

This project uses the nightly version of Rust. You can install it with:

rustup install nightly

and then set it as the default toolchain with:

rustup default nightly

Installing (locally)

To install the package locally, run the following command in the root directory of the project:

make install

tsdownsample

The structure of the tsdownsample project is as follows:

tsdownsample
├── Cargo.toml
├── README.md
├── src
│   ├── lib.rs     # Python bindings for Rust library
├── tsdownsample   # The Python package
├── downsample_rs  # Rust library containing the actual implementation
├── tests          # Tests for the Python package

The Rust library is located in the downsample_rs directory. The Python package is located in the tsdownsample directory. The src/lib.rs file contains the Python bindings for the Rust library.

Under the hood most downsampling algorithms heavily rely on the argminmax - a SIMD accelerated library for finding the index of the minimum and maximum values in an array. If you want to improve the performance of the library, you could also take a look at the argminmax library.

Testing

Changes to the downsample_rs library can be tested with:

cd downsample_rs
cargo test

Changes to the Python package can be tested using the Makefile in the root directory of the project:

Make sure you have the test dependencies installed:

pip install -r test/requirements.txt          # Install test dependencies
pip install -r test/requirements-linting.txt  # Install linting dependencies

To run the tests:

make test

To run the tests and linting:

make lint

Formatting

We use black and isort to format the Python code.

To format the code, run the following command (more details in the Makefile):

make format

(make sure you have the test linting dependencies installed)

To format the Rust code, run the following command:

cargo fmt

Improving the performance

When a PR is submitted that improves the performance of the library, we would highly appreciate if the PR also includes a (verifiable) benchmark that shows the improvement.