Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Refactoring mesa.space

Open
#6 13 comments 0 reactions 1 assignee View on GitHub

@adamamer20 is already working on this.

Since Jan 10, 2024.

  • #28 by @adamamer20 — closed without merging
  • #29 by @adamamer20 — merged
  • #30 by @adamamer20 — merged
  • #32 by @adamamer20 — merged
  • #44 by @adamamer20 — merged

Assessment

This issue has not been assessed yet.

Description

enhancement

Roadmap

  • #39
  • #40
  • #41
  • #34
  • #35
  • #36
  • #37
  • #38
  • #47

Class Structure and Design

SpaceDF
  • Base class for all spaces
  • Defines a common interface for all spaces
  • Stores agent positions in the _agents attribute in a DataFrame/GeoDataFrame. This approach avoids many missing values in the AgentSetDF and reduces confusion when multiple spaces of the same type are present (e.g., an agent in both a grid and in a social network)
  • TODO: Implement a pos property for AgentContainer that performs an instant join with the space _agents DataFrame
MultiSpaceDF
  • Stores the collection of spaces in a model, similar to AgentsDF
DiscreteSpaceDF
  • Defines an interface for GridDF and NetworkDF
  • Supports setting cell properties at both class level (setting an attribute of the class) and cell level (using the set_cells method)
  • In addition to _agents stores cell properties in the _cells attribute in a DataFrame. The _cells DataFrame explicitly stores only cells that have agents or have specific properties different from the class level
ContinousSpaceDF
  • Stores agents in a GeoDataFrame (only geopandas in the future)
  • Bridges mesa and mesa-geo
  • All agents are geoagents and shapely objects
  • Can be used as a continuous space in mesa without setting CRS, or as a geospace in mesa-geo by setting CRS
GridDF
  • Implemented in both GridPolars and GridPandas versions
  • Supports multiple dimensions
  • The '_empty_grid' attribute stores the remaining capacity of the grid.
GeoGridDF
  • Position in the class hierarchy still to be determined
  • Is it possible to create a unique class or attempt to merge with GridDF? Probably not possible to merge as GridDF supports multiple dimensions, while shapely objects are limited to 2 dimensions.
Dominant language
Python
Stars
43
Forks
19
Avg merge
1m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mesa/mesa-frames

All issues in mesa/mesa-frames

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.