Skip to content

Commit 663ef6e

Browse files
committed
Add guidelines about how to handle dependencies for Python users.
1 parent 3240a83 commit 663ef6e

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed
Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
More to come.
1+
If you are writing a contribution that relies on Python code and Python packages, you can locally install and use those packages any way you like.
2+
3+
We then handle your Python package dependencies in our CI/CD scripts using [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html), which requires that you ship a file called `environment.yml` that lists your dependencies. This file should be stored at the root of your repository. Here is the typical content of such a file:
4+
5+
```yml
6+
name: computo
7+
channels:
8+
- conda-forge
9+
dependencies:
10+
- python=3.11
11+
- jupyter
12+
- matplotlib
13+
- pandas
14+
- scipy
15+
- seaborn
16+
- scikit-learn
17+
- numpy=1.24
18+
- numba
19+
```
20+
21+
The `name:` entry
22+
23+
: You can choose a name of your liking. It should be short with no spaces and uniquely refer to the title or content of your contribution.
24+
25+
The `channels:` entry
26+
27+
: In most cases, you should leave it to the value `conda-forge`. Some advanced configurations for which you might want to reference other channels can be found by browsing our list of published papers [here](https://github.com/computorg?q=published&type=all&language=&sort=).
28+
29+
The `dependencies:` entry
30+
31+
: This is where you should list all your dependencies. It is good practice to list `python` itself so you can provide the version you used as done above. Other dependencies written in the outer list will be installed from the listed channel using micromamba. It is recommended to indicate which version was used as done above for **numpy** for instance. If your work relies on packages that have not been made available as conda packages, you can add a `pip` entry to the outer list and add those packages under the `pip:` list as in:
32+
33+
```yml
34+
name: clayton
35+
channels:
36+
- conda-forge
37+
dependencies:
38+
- jupyter
39+
- numpy
40+
- scipy
41+
- matplotlib
42+
- pandas
43+
- seaborn
44+
- pip:
45+
- clayton
46+
```
47+
48+
::: {.callout-note title="Automatic registration of packages"}
49+
Currently and differently from what we provide for R users, we do not have implemented an automatic way of registering environment, packages and their versions. Hence, you are expected to do that manually.
50+
:::
51+
52+
::: {.callout-tip title="`requirements.txt`"}
53+
If your work exclusively depends on packages installed from `pip` and you are used to listing dependencies in a `requirements.txt` file, you can ship this file instead of the `environment.yml` file and our CI/CD scripts should run smoothly.
54+
:::

0 commit comments

Comments
 (0)