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

Move examples into mesa #2387

Merged
merged 5 commits into from
Oct 18, 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
4 changes: 2 additions & 2 deletions docs/tutorials/visualization_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"\n",
"# You can either define the BoltzmannWealthModel (aka MoneyModel) or install it\n",
"\n",
"from mesa.examples.basic import BoltzmannWealthModel"
"from mesa.examples import BoltzmannWealthModel"
]
},
{
Expand Down Expand Up @@ -87,7 +87,7 @@
"outputs": [],
"source": [
"model_params = {\n",
" \"N\": {\n",
" \"n\": {\n",
" \"type\": \"SliderInt\",\n",
" \"value\": 50,\n",
" \"label\": \"Number of agents:\",\n",
Expand Down
13 changes: 0 additions & 13 deletions examples/basic/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions mesa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import datetime

import mesa.examples as examples
import mesa.experimental as experimental
import mesa.space as space
import mesa.time as time
Expand All @@ -22,7 +21,6 @@
"DataCollector",
"batch_run",
"experimental",
"examples",
]

__title__ = "mesa"
Expand Down
3 changes: 0 additions & 3 deletions mesa/examples.py

This file was deleted.

File renamed without changes.
13 changes: 13 additions & 0 deletions mesa/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from mesa.examples.basic.boid_flockers.model import BoidFlockers
from mesa.examples.basic.boltzmann_wealth_model.model import BoltzmannWealthModel
from mesa.examples.basic.conways_game_of_life.model import ConwaysGameOfLife
from mesa.examples.basic.schelling.model import Schelling
from mesa.examples.basic.virus_on_network.model import VirusOnNetwork

__all__ = [
"BoidFlockers",
"BoltzmannWealthModel",
"ConwaysGameOfLife",
"Schelling",
"VirusOnNetwork",
]
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ repository = "https://github.com/projectmesa/mesa"
mesa = "mesa.main:cli"

[tool.hatch.build.targets.wheel]
packages = ["mesa", "examples"]
packages = ["mesa"]

[tool.hatch.version]
path = "mesa/__init__.py"
Expand All @@ -97,7 +97,7 @@ path = "mesa/__init__.py"
# Hardcode to Python 3.10.
# Reminder to update mesa-examples if the value below is changed.
target-version = "py310"
extend-exclude = ["docs", "build", "examples/advanced"] # TODO: Remove examples/advanced
extend-exclude = ["docs", "build", "mesa/examples/advanced"] # TODO: Remove examples/advanced

[tool.ruff.lint]
select = [
Expand Down Expand Up @@ -149,7 +149,7 @@ extend-ignore = [
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]
# Ignore all docstring errors in examples
per-file-ignores = {"examples/*"= ["D"]}
per-file-ignores = {"mesa/examples/*"= ["D"]}

[tool.ruff.lint.pydocstyle]
convention = "google"
6 changes: 4 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def test_examples_imports():
"""Test examples imports."""
from mesa.examples.basic import (
from mesa.examples import (
BoidFlockers,
BoltzmannWealthModel,
ConwaysGameOfLife,
Expand Down Expand Up @@ -38,7 +38,9 @@ class TestExamples(unittest.TestCase):
details of each example's model.
"""

EXAMPLES = os.path.abspath(os.path.join(os.path.dirname(__file__), "../examples"))
EXAMPLES = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../mesa/examples")
)

@contextlib.contextmanager
def active_example_dir(self, example):
Expand Down
Loading