Skip to content

Fix __all__ imports in __init__.pys #2343

Open
@EwoutH

Description

@EwoutH

On a few places in Mesa uses __all__ imports in different __init__.pys files.

mesa/mesa/__init__.py

Lines 8 to 23 in 2cdbcb6

import mesa.space as space
import mesa.time as time
from mesa.agent import Agent
from mesa.batchrunner import batch_run
from mesa.datacollection import DataCollector
from mesa.model import Model
__all__ = [
"Model",
"Agent",
"time",
"space",
"DataCollector",
"batch_run",
"experimental",
]

from mesa.experimental import cell_space
from .solara_viz import JupyterViz, Slider, SolaraViz, make_text
__all__ = ["cell_space", "JupyterViz", "SolaraViz", "make_text", "Slider"]

This allows easier importing of modules, but does import modules that are not even necessary or used at all. This created some problems after #2265, because for some of those imports require dependencies that are not included by default.

Follow-up on #2265, fixes projectmesa/mesa-examples#198.

Metadata

Metadata

Assignees

Labels

bugRelease notes label

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions