Skip to content

Commit 8918af5

Browse files
committed
🎉 add CONTRIBUTING.md
1 parent 1b08886 commit 8918af5

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

CONTRIBUTING.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Contributing to tsdownsample
2+
3+
Welcome! We're happy to have you here. Thank you in advance for your contribution to tsdownsample.
4+
5+
## The basics
6+
7+
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](https://github.com/predict-idlab/tsdownsample/issues) outlining your proposed change.
8+
9+
### Prerequisites
10+
11+
tsdownsample is written in Rust. You'll need to install the [Rust toolchain](https://www.rust-lang.org/tools/install) for development.
12+
13+
This project uses the nightly version of Rust. You can install it with:
14+
15+
```bash
16+
rustup install nightly
17+
```
18+
19+
and then set it as the default toolchain with:
20+
21+
```bash
22+
rustup default nightly
23+
```
24+
25+
### tsdownsample
26+
27+
The structure of the tsdownsample project is as follows:
28+
29+
```bash
30+
tsdownsample
31+
├── Cargo.toml
32+
├── README.md
33+
├── src
34+
│ ├── lib.rs # Python bindings for Rust library
35+
├── tsdownsample # The Python package
36+
├── downsample_rs # Rust library containing the actual implementation
37+
├── tests # Tests for the Python package
38+
```
39+
40+
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.
41+
42+
Under the hood most downsampling algorithms heavily rely on the [argminmax](https://github.com/jvdd/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.
43+
44+
### Testing
45+
46+
Changes to the downsample_rs library can be tested with:
47+
48+
```bash
49+
cd downsample_rs
50+
cargo test
51+
```
52+
53+
Changes to the Python package can be tested using the [`Makefile`](Makefile) in the root directory of the project:
54+
55+
*Make sure you have the test dependencies installed:*
56+
57+
```bash
58+
pip install -r test/requirements.txt # Install test dependencies
59+
pip install -r test/requirements-linting.txt # Install linting dependencies
60+
```
61+
62+
To run the tests:
63+
```bash
64+
make test
65+
```
66+
67+
To run the tests and linting:
68+
```bash
69+
make lint
70+
```
71+
72+
### Formatting
73+
74+
We use [black](https://github.com/psf/black) and [isort](https://github.com/PyCQA/isort) to format the Python code.
75+
76+
To format the code, run the following command (more details in the [Makefile](Makefile)):
77+
```sh
78+
make format
79+
```
80+
81+
*(make sure you have the test linting dependencies installed)*
82+
83+
To format the Rust code, run the following command:
84+
```sh
85+
cargo fmt
86+
```
87+
88+
---
89+
90+
## Improving the performance
91+
92+
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.

0 commit comments

Comments
 (0)