Skip to content

Commit 7b4a1b5

Browse files
authored
Updated developer instructions and dependencies for uv (#127)
1 parent 4883798 commit 7b4a1b5

File tree

4 files changed

+1035
-6
lines changed

4 files changed

+1035
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ paper/01_lif/lava
2121
paper/01_lif/.venv
2222
paper/02_cnn/lava-dl
2323
paper/02_cnn/ann_pretraining/data/MNIST
24+
.DS_Store

docs/source/contributing.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ Use the standard github workflow.
1212

1313
2. Setup the virtual environment for this project.
1414

15-
3. Install all the development requirements.
16-
17-
```shell
18-
pip install -r dev_requirements.txt
19-
```
15+
3. Install all the development requirements (refer to the options described below).
2016

2117
4. Install git pre-commit hooks.
2218

@@ -28,7 +24,45 @@ pre-commit install
2824

2925
6. [Create a pull request from your fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
3026

31-
## Code formatting.
27+
## Installing the development requirements
28+
29+
### Using uv
30+
31+
Easy package management can be accomplished using the [uv](https://docs.astral.sh/uv/) tool which will need to be available on
32+
your local workstation. As explained in [the official uv documentation](https://docs.astral.sh/uv/getting-started/installation/),
33+
a number of straightforward installation options are available. uv is supported by IDEs such as [PyCharm](https://www.jetbrains.com/help/pycharm/uv.html).
34+
35+
36+
After the first clone of this repository, run the following command in the root directory.
37+
This will automatically create
38+
a new virtual environment in the folder `.venv` and install all required NIR project dependencies to it.
39+
40+
```shell
41+
uv sync
42+
```
43+
44+
45+
To run commands within the uv virtual environment, prefix them with `uv run`.
46+
For example, to run all the tests:
47+
48+
```shell
49+
uv run pytest
50+
```
51+
52+
Alternatively, you can activate the virtual environment in your current terminal and run commands directly.
53+
For example:
54+
```shell
55+
source .venv/bin/activate
56+
pytest
57+
```
58+
59+
### Using pip
60+
61+
```shell
62+
pip install -r dev_requirements.txt
63+
```
64+
65+
## Code formatting
3266

3367
We use `black` to format the code and `ruff` to linting.
3468
The rules and formatting are embedded in the `pre-commit hooks`. So you do not need to explicitly worry about these but is good to know when you see erros while commiting your code or in the CI.

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ lint.per-file-ignores = {"docs/conf.py" = ["E402"]}
5151
exclude = ["paper/"]
5252
extend-exclude = ["*.ipynb"]
5353

54+
[dependency-groups]
55+
dev = [
56+
"black>=25.1.0",
57+
"pre-commit>=4.1.0",
58+
"pytest>=8.3.5",
59+
"ruff>=0.9.9",
60+
"sphinx>=7.4.7",
61+
]
62+

0 commit comments

Comments
 (0)