Skip to content

Commit df51862

Browse files
authored
Reduce core dependencies, split in optional dependencies (#2265)
This PR introduces a more flexible dependency management system for Mesa, allowing users to choose which additional components they need while maintaining core functionality. ### Motivation This change allows for more tailored installations, reducing unnecessary dependencies and potential conflicts, while ensuring core functionality remains intact. ### Key Changes 1. Updated `pyproject.toml` to define new optional dependency groups: - `[network]`: Network-related dependencies - `[viz]`: Visualization dependencies - `[rec]`: Recommended dependencies (includes network and viz) - `[all]`: All dependencies, including developer dependencies - Additional groups for development, examples, and documentation 2. Updated `README.md` with new installation instructions for optional dependencies. 3. Core dependencies now only include essential packages (numpy, pandas, tqdm). ### Installation Options Users can now customize their Mesa installation: ```bash # Basic installation with core dependencies pip install -U --pre mesa # Install with recommended dependencies pip install -U --pre mesa[rec] # Install with specific additional dependencies pip install -U --pre mesa[network,viz] # Install all dependencies (including dev dependencies) pip install -U --pre mesa[all] ```
1 parent 17cd62a commit df51862

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ To install our latest pre-release (3.0.0 alpha), run:
3939
``` bash
4040
pip install -U --pre mesa
4141
```
42+
With Mesa 3.0, we don't install all our dependencies anymore by default.
43+
```bash
44+
# You can customize the additional dependencies you need, if you want. Available are:
45+
pip install -U --pre mesa[network,viz]
46+
47+
# This is equivalent to our recommended dependencies:
48+
pip install -U --pre mesa[rec]
49+
50+
# To install all, including developer, dependencies:
51+
pip install -U --pre mesa[all]
52+
```
4253

4354
You can also use `pip` to install the latest GitHub version:
4455

pyproject.toml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,46 @@ classifiers = [
3636
]
3737
readme = "README.md"
3838
dependencies = [
39-
"click",
40-
"cookiecutter",
41-
"matplotlib",
42-
"networkx",
4339
"numpy",
4440
"pandas",
45-
"solara",
4641
"tqdm",
4742
]
4843
dynamic = ["version"]
4944

5045
[project.optional-dependencies]
46+
# User collections
47+
rec = ["mesa[network,viz]"]
48+
all = ["mesa[network,viz,dev,examples,docs]"]
49+
# Core dependencies
50+
network = [
51+
"networkx",
52+
]
53+
viz = [
54+
"matplotlib",
55+
"solara",
56+
]
57+
# Dev and CI stuff
5158
dev = [
52-
"ruff~=0.1.1", # Update periodically
53-
"pytest >= 4.6",
59+
"mesa[rec]",
60+
"ruff",
61+
"pytest",
5462
"pytest-cov",
5563
"sphinx",
5664
"pytest-mock",
65+
"cookiecutter",
5766
]
5867
examples = [
59-
"pytest >= 4.6",
60-
"scipy"
68+
"mesa[rec]",
69+
"pytest",
70+
"scipy",
6171
]
6272
docs = [
6373
"sphinx",
6474
"ipython",
6575
"pydata_sphinx_theme",
6676
"seaborn",
6777
"myst-nb",
68-
"myst-parser", # Markdown in Sphinx
78+
"myst-parser", # Markdown in Sphinx
6979
]
7080

7181
[project.urls]

0 commit comments

Comments
 (0)