Skip to content

Commit 003a0e0

Browse files
authored
feat: uv (#1171)
* wip: switch to uv completely * chore: move python version to uv setup * chore: revert to uv pip for CI * chore: revert integration test rule used for testing * chore: add max python version and setuptool to requirements * chore: add line to activate venv in readme * chore: update detailed install * chore: pre-commit
1 parent b4dc045 commit 003a0e0

File tree

9 files changed

+2762
-57
lines changed

9 files changed

+2762
-57
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ jobs:
1717
uses: actions/checkout@v4
1818

1919
- name: Install uv
20-
uses: astral-sh/setup-uv@v3
20+
uses: astral-sh/setup-uv@v5
2121
with:
22-
version: "0.5.4"
22+
version: "0.6.12"
2323
enable-cache: true
24-
cache-dependency-glob: "requirements/requirements**.txt" # invalidate cache when requirements file changes
24+
cache-dependency-glob: "uv.lock" # invalidate cache when requirements file changes
25+
python-version: "${{ matrix.python-version }}"
2526

2627
- uses: actions/setup-python@v5
2728
with:
2829
python-version: "${{ matrix.python-version }}"
2930

3031
- name: Install python dependencies 🔧
31-
run: uv pip install .[dev]
32+
run: uv pip install . --group dev
3233
env:
3334
UV_SYSTEM_PYTHON: 1
3435

.github/workflows/integration_tests.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ jobs:
2020
uses: actions/checkout@v4
2121

2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v3
23+
uses: astral-sh/setup-uv@v5
2424
with:
25-
version: "0.5.4"
25+
version: "0.6.12"
2626
enable-cache: true
27-
cache-dependency-glob: "requirements/requirements**.txt" # invalidate cache when requirements file changes
27+
cache-dependency-glob: "uv.lock" # invalidate cache when requirements file changes
28+
python-version: "${{ matrix.python-version }}"
2829

2930
- uses: actions/setup-python@v5
3031
with:
3132
python-version: "${{ matrix.python-version }}"
3233

3334
- name: Install python dependencies 🔧
34-
run: uv pip install .[dev]
35+
run: uv pip install . --group dev
3536
env:
3637
UV_SYSTEM_PYTHON: 1
3738

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,6 @@ results/
174174
outputs/
175175
multirun/
176176
.neptune
177-
.aider*
177+
178+
# AI
179+
.aider**

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,20 @@ Mava allows researchers to experiment with multi-agent reinforcement learning (M
4141

4242
## Installation 🎬
4343

44-
At the moment Mava is not meant to be installed as a library, but rather to be used as a research tool. We recommend cloning the Mava repo and pip installing as follows:
44+
At the moment Mava is not meant to be installed as a library, but rather to be used as a research tool. We recommend cloning the Mava repo and installing dependencies using [uv](https://github.com/astral-sh/uv) as follows:
4545

4646
```bash
47-
git clone https://github.com/instadeepai/mava.git
48-
cd mava
47+
# Clone the repository
48+
git clone https://github.com/instadeepai/Mava.git
49+
cd Mava
50+
# Create a virtual environment and install all dependencies
51+
uv sync
52+
# Activate the virtual environment
53+
source .venv/bin/activate
54+
```
55+
56+
Alternatively with pip, create a virtual environment and then:
57+
```bash
4958
pip install -e .
5059
```
5160

docs/DETAILED_INSTALL.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ cd mava
1616

1717
3. Create and activate a virtual environment and install requirements
1818
```bash
19-
uv venv -p=3.12
20-
source .venv/bin/activate
21-
uv pip install -e .
19+
uv sync -p=3.12
2220
```
2321

2422
4. Install jax on your accelerator. The example below is for an NVIDIA GPU, please the [official install guide](https://github.com/google/jax#installation) for other accelerators.
@@ -29,6 +27,11 @@ uv pip install "jax[cuda12]==0.4.30"
2927

3028
5. Run a system!
3129
```bash
30+
uv run mava/systems/ppo/anakin/ff_ippo.py env=rware
31+
```
32+
or
33+
```
34+
source .venv/bin/activate
3235
python mava/systems/ppo/anakin/ff_ippo.py env=rware
3336
```
3437

pyproject.toml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ include=['mava*']
88
[project]
99
name="id-mava"
1010
authors=[{name="InstaDeep Ltd"}]
11-
dynamic=["version", "dependencies", "optional-dependencies"]
11+
dynamic=["version"]
1212
license={file="LICENSE"}
1313
description="Distributed Multi-Agent Reinforcement Learning in JAX."
1414
readme ="README.md"
15-
requires-python=">=3.10"
15+
requires-python=">=3.10,<3.13"
1616
keywords=["multi-agent", "reinforcement learning", "python", "jax", "anakin", "sebulba"]
1717
classifiers=[
1818
"Environment :: Console",
@@ -28,10 +28,47 @@ classifiers=[
2828
"Topic :: Software Development :: Libraries :: Python Modules",
2929
"License :: OSI Approved :: Apache Software License",
3030
]
31+
dependencies = [
32+
"brax==0.10.3",
33+
"colorama",
34+
"distrax",
35+
"flashbax~=0.1.0",
36+
"flax>=0.8.1,<0.10.4",
37+
"gigastep @ git+https://github.com/mlech26l/gigastep",
38+
"gymnasium==1.0.0",
39+
"hydra-core==1.3.2",
40+
"id-marl-eval @ git+https://github.com/instadeepai/marl-eval",
41+
"jax==0.4.30",
42+
"jaxlib==0.4.30",
43+
"jaxmarl @ git+https://github.com/RuanJohn/JaxMARL@unpin-jax", # This only unpins the version of Jax.
44+
"jumanji>= 1.1.0",
45+
"lbforaging",
46+
"matrax>= 0.0.5",
47+
"mujoco==3.1.3",
48+
"mujoco-mjx==3.1.3",
49+
"neptune",
50+
"numpy==1.26.4",
51+
"omegaconf",
52+
"optax",
53+
"protobuf~=3.20",
54+
"rware",
55+
"scipy==1.12.0",
56+
"setuptools",
57+
"smaclite @ git+https://github.com/uoe-agents/smaclite.git",
58+
"tensorboard_logger",
59+
"tensorflow_probability",
60+
"type_enforced", # needed because gigastep is missing this dependency
61+
]
62+
63+
[dependency-groups]
64+
dev = [
65+
"mypy",
66+
"pre-commit",
67+
"pytest",
68+
]
69+
3170
[tool.setuptools.dynamic]
3271
version={attr="mava.__version__"}
33-
dependencies={file="requirements/requirements.txt"}
34-
optional-dependencies={dev={file=["requirements/requirements-dev.txt"]}}
3572

3673
[project.urls]
3774
"Homepage"="https://github.com/instadeep/Mava"

requirements/requirements-dev.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

requirements/requirements.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)