From 21e3fe9f2b898b3d3c89d291cd27d49380e0c1c9 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Fri, 20 Sep 2024 14:06:56 +0200 Subject: [PATCH] Update tutorials and Readme with optional dependencies --- README.md | 23 ++++++++++++++++----- docs/tutorials/intro_tutorial.ipynb | 12 ++++++++--- docs/tutorials/visualization_tutorial.ipynb | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d7dd0faf206..2392b2bc9fc 100644 --- a/README.md +++ b/README.md @@ -30,25 +30,38 @@ can be displayed in browser windows or Jupyter.* To install our latest stable release (2.3.x), run: -``` bash +```bash pip install -U mesa ``` To install our latest pre-release (3.0.0 alpha), run: -``` bash +```bash pip install -U --pre mesa ``` +With Mesa 3.0, we don't install all our dependencies anymore by default. +```bash +# With our recommended dependencies +pip install -U --pre mesa[rec] +``` +```bash +# You can customize the dependencies you need, if you want. Available are: +pip install -U --pre mesa[network,viz,data,batch] +``` +```bash +# With all, including developer, dependencies: +pip install -U --pre mesa[all] +``` You can also use `pip` to install the latest GitHub version: -``` bash +```bash pip install -U -e git+https://github.com/projectmesa/mesa@main#egg=mesa ``` Or any other (development) branch on this repo or your own fork: -``` bash +```bash pip install -U -e git+https://github.com/YOUR_FORK/mesa@YOUR_BRANCH#egg=mesa ``` @@ -75,7 +88,7 @@ If you are a Mesa developer, first [install Docker Compose](https://docs.docker.com/compose/install/) and then, in the folder containing the Mesa Git repository, you run: -``` bash +```bash $ docker compose up # If you want to make it run in the background, you instead run $ docker compose up -d diff --git a/docs/tutorials/intro_tutorial.ipynb b/docs/tutorials/intro_tutorial.ipynb index a04d15729b1..c2c83c894b5 100644 --- a/docs/tutorials/intro_tutorial.ipynb +++ b/docs/tutorials/intro_tutorial.ipynb @@ -60,7 +60,13 @@ "\n", "Create and activate a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/). *Python version 3.10 or higher is required*.\n", "\n", - "Install Mesa:\n", + "Install Mesa with the recommended dependencies.\n", + "\n", + "```bash\n", + "pip install --upgrade mesa[rec]\n", + "```\n", + "\n", + "If you already have all the dependencies installed or are just updating, you can install Mesa without the recommended dependencies:\n", "\n", "```bash\n", "pip install --upgrade mesa\n", @@ -69,7 +75,7 @@ "If you want to use our newest features, you can also opt to install our latest pre-release version:\n", "\n", "```bash\n", - "pip install --upgrade --pre mesa\n", + "pip install --upgrade --pre mesa[rec]\n", "```\n", "\n", "Install Jupyter Notebook (optional):\n", @@ -96,7 +102,7 @@ "source": [ "# SKIP THIS CELL unless running in colab\n", "\n", - "%pip install --quiet mesa\n", + "%pip install --quiet mesa[rec]\n", "# The exclamation points tell jupyter to do the command via the command line" ] }, diff --git a/docs/tutorials/visualization_tutorial.ipynb b/docs/tutorials/visualization_tutorial.ipynb index f96baee812d..c23478fe97f 100644 --- a/docs/tutorials/visualization_tutorial.ipynb +++ b/docs/tutorials/visualization_tutorial.ipynb @@ -41,8 +41,8 @@ }, "outputs": [], "source": [ - "# Install and import the latest Mesa pre-release version\n", - "%pip install --quiet --upgrade --pre mesa\n", + "# Install and import the latest Mesa pre-release version with the recommended dependencies\n", + "%pip install --quiet --upgrade --pre mesa[rec]\n", "import mesa\n", "print(f\"Mesa version: {mesa.__version__}\")\n", "\n",