Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce core dependencies, split in optional dependencies #2265

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ To install our latest pre-release (3.0.0 alpha), run:
``` bash
pip install -U --pre mesa
```
With Mesa 3.0, we don't install all our dependencies anymore by default.
```bash
# You can customize the additional dependencies you need, if you want. Available are:
pip install -U --pre mesa[network,viz]

# This is equivalent to our recommended dependencies:
pip install -U --pre mesa[rec]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on. This will trip people over. Visualization is what a lot of people coming to Mesa want to use it for. The default needs to include visualization. I can do pip install solara and have the common functionality working out of the box. Why do I have to do pip install mesa[rec] specifically for just Mesa?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a minimal install of Mesa is less common than doing an install of Mesa for visualization in a classroom setting. Can the split be mesa-minimal/mesa-core and mesa instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have multiple complex models that don't touch Solara, the batch_run or the DataCollector at all.

Also the initial error message when you can't install Solara is quite clear.

Also it's literally in our front-page Readme.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also typically want to avoid installing stuff like solara on an HPC. As long as it is well documented, which it is, I am fine with the current structure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have similar situations (initially wanted to embed Mesa inside other simulation frameworks), but why make it more inconvenient to students and first time learners, who have to read the fine print of the README.md?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put it in a few other places, like the visualization tutorial, and potentially also add a helpful warning on import somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I also didn't saw this properly before, but I side with @rht on this one. Viz should be in core imho. Mesa should be "batteries included". For hpc or similar environments you can always install with "--no-deps". And in the future it might be more convinient to have a "mesa-core" package with minimal dependencies. But for now it should be included

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know you where the person who opened #626 ;)

Let’s discuss at the next dev meeting.


# To install all, including developer, dependencies:
pip install -U --pre mesa[all]
```

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

Expand Down
30 changes: 20 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,46 @@ classifiers = [
]
readme = "README.md"
dependencies = [
"click",
"cookiecutter",
"matplotlib",
"networkx",
"numpy",
"pandas",
"solara",
"tqdm",
]
dynamic = ["version"]

[project.optional-dependencies]
# User collections
rec = ["mesa[network,viz]"]
all = ["mesa[network,viz,dev,examples,docs]"]
# Core dependencies
network = [
"networkx",
]
viz = [
"matplotlib",
"solara",
]
# Dev and CI stuff
dev = [
"ruff~=0.1.1", # Update periodically
"pytest >= 4.6",
"mesa[rec]",
"ruff",
"pytest",
"pytest-cov",
"sphinx",
"pytest-mock",
"cookiecutter",
quaquel marked this conversation as resolved.
Show resolved Hide resolved
]
examples = [
"pytest >= 4.6",
"scipy"
"mesa[rec]",
"pytest",
EwoutH marked this conversation as resolved.
Show resolved Hide resolved
"scipy",
]
docs = [
"sphinx",
"ipython",
"pydata_sphinx_theme",
"seaborn",
"myst-nb",
"myst-parser", # Markdown in Sphinx
"myst-parser", # Markdown in Sphinx
]

[project.urls]
Expand Down
Loading