Skip to content
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
2 changes: 0 additions & 2 deletions .github/workflows/build_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
include:
- os: ubuntu
python-version: "3.12"
- os: ubuntu
python-version: "3.11"
# Disabled for now. See https://github.com/projectmesa/mesa/issues/1253
#- os: ubuntu
# python-version: 'pypy-3.8'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py311-plus]
args: [--py312-plus]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 # Use the ref you want to point at
hooks:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/0_first_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"source": [
"### Tutorial Setup\n",
"\n",
"Create and activate a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/). *Python version 3.11 or higher is required*.\n",
"Create and activate a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/). *Python version 3.12 or higher is required*.\n",
"\n",
"Install Mesa:\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions mesa/discrete_space/cell_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from collections.abc import Callable, Iterable, Mapping
from functools import cached_property
from random import Random
from typing import TYPE_CHECKING, Generic, TypeVar
from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
from mesa.discrete_space.cell import Cell
Expand All @@ -29,7 +29,7 @@
T = TypeVar("T", bound="Cell")


class CellCollection(Generic[T]):
class CellCollection[T: Cell]:
"""An immutable collection of cells.

Attributes:
Expand Down
4 changes: 2 additions & 2 deletions mesa/discrete_space/discrete_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import warnings
from functools import cached_property
from random import Random
from typing import Generic, TypeVar
from typing import TypeVar

from mesa.agent import AgentSet
from mesa.discrete_space.cell import Cell
Expand All @@ -27,7 +27,7 @@
T = TypeVar("T", bound=Cell)


class DiscreteSpace(Generic[T]):
class DiscreteSpace[T: Cell]:
"""Base class for all discrete spaces.

Attributes:
Expand Down
4 changes: 2 additions & 2 deletions mesa/discrete_space/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from collections.abc import Sequence
from itertools import product
from random import Random
from typing import Any, Generic, TypeVar
from typing import Any, TypeVar

from mesa.discrete_space import Cell, DiscreteSpace
from mesa.discrete_space.property_layer import (
Expand Down Expand Up @@ -56,7 +56,7 @@ def unpickle_gridcell(parent, fields):
return instance


class Grid(DiscreteSpace[T], Generic[T], HasPropertyLayers):
class Grid(DiscreteSpace[T], HasPropertyLayers):
"""Base class for all grid classes.

Attributes:
Expand Down
2 changes: 1 addition & 1 deletion mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
F = TypeVar("F", bound=Callable[..., Any])


def accept_tuple_argument(wrapped_function: F) -> F:
def accept_tuple_argument[F: Callable[..., Any]](wrapped_function: F) -> F:
"""Decorator to allow grid methods that take a list of (x, y) coord tuples to also handle a single position.

Tuples are wrapped in a single-item list rather than forcing user to do it.
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "Mesa"
description = "Agent-based modeling (ABM) in Python"
license = { text = "Apache 2.0" }
requires-python = ">=3.11"
requires-python = ">=3.12"
authors = [
{ name = "Project Mesa Team", email = "maintainers@projectmesa.dev" },
]
Expand All @@ -25,7 +25,6 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
Expand Down Expand Up @@ -98,9 +97,9 @@ path = "mesa/__init__.py"

[tool.ruff]
# See https://github.com/charliermarsh/ruff#rules for error code definitions.
# Hardcode to Python 3.11.
# Hardcode to Python 3.12.
# Reminder to update mesa-examples if the value below is changed.
target-version = "py311"
target-version = "py312"
extend-exclude = ["build"]

[tool.ruff.lint]
Expand Down