Skip to content

Commit 9e6c885

Browse files
committed
update contribution guide
1 parent cad5d29 commit 9e6c885

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,49 @@ def prior3(a, b, c):
5656

5757
### 2. Set up your development environment
5858

59-
Create a fork of the BayesFlow git repository using the GitHub interface.
60-
Then clone your fork and install the development environment with conda:
59+
Once we agree on an approach in the issue you opened, we can move ahead with the implementation.
60+
61+
First, create a development environment with conda, or any other environment manager of your choice.
62+
63+
```bash
64+
conda create -n bf python=3.11
65+
conda activate bf
66+
```
67+
68+
Note: always use a clean environment dedicated for development of BayesFlow to avoid dependency issues.
69+
70+
Most contributors will have to create and clone a fork of BayesFlow using the GitHub interface or the CLI:
71+
72+
```bash
73+
gh repo fork bayesflow-org/bayesflow --clone
74+
```
75+
76+
Then, check out the development branch and install dependencies:
6177

6278
```bash
63-
git clone https://github.com/<your-username>/bayesflow
6479
cd bayesflow
6580
git checkout dev
66-
conda env create --file environment.yaml --name bayesflow
67-
conda activate bayesflow
81+
conda install pip
82+
pip install -e .[dev,docs,test]
6883
pre-commit install
6984
```
7085

71-
We recommend using the PyTorch backend for development.
72-
Be careful not to downgrade your keras version when installing the backend.
86+
Finally, install at least one backend of your choice.
87+
At the moment of writing this, to install all three backends on a machine supporting CUDA 12.6, we would use:
88+
89+
```bash
90+
pip install -U jax[cuda12]
91+
pip install -U tensorflow[and-cuda]
92+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
93+
```
7394

74-
You can also install a triple backend cuda environment using `cuda.yaml`:
95+
You can set an environment variable to choose the default backend. We recommend defaulting to jax:
7596

7697
```bash
77-
conda env create --file cuda.yaml --name bf-cuda
98+
conda env config vars set KERAS_BACKEND=jax
7899
```
79100

80-
Note that we cannot guarantee that this environment file will always work,
81-
as it is not tested frequently or across devices.
82-
It is provided merely as a convenience. For reliability, install only a single backend.
101+
Note that you will have to re-activate the environment for the changes to take effect.
83102

84103
### 3. Implement your changes
85104

@@ -138,7 +157,8 @@ z = keras.ops.convert_to_numpy(x)
138157

139158
The documentation uses [sphinx](https://www.sphinx-doc.org/) and relies on [numpy style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html) in classes and functions.
140159

141-
Run the following command to install all necessary packages for setting up documentation generation:
160+
If you haven't done so earlier, run the following command to install all necessary packages for setting up
161+
documentation generation:
142162

143163
```
144164
pip install .[docs]

0 commit comments

Comments
 (0)