Skip to content

Commit fe13b1d

Browse files
authored
chore: Update pyproject.toml to use PEP 735 dependency groups (#158)
* fix: update dependency versions and improve project metadata in pyproject.toml * fix: update development dependencies and improve version specifications in uv.lock * fix: standardize YAML formatting and improve build workflow steps
1 parent 4dcf44f commit fe13b1d

File tree

3 files changed

+177
-188
lines changed

3 files changed

+177
-188
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: build
33
on:
44
push:
55
branches:
6-
- main
7-
- release**
6+
- main
7+
- release**
88
paths-ignore:
99
- '**.md'
1010
pull_request:
@@ -24,40 +24,43 @@ concurrency:
2424
jobs:
2525
build:
2626
runs-on: ${{ matrix.os }}-latest
27-
# We need an explicit timeout because sometimes the batch_runner test never
28-
# completes.
2927
timeout-minutes: 6
28+
3029
strategy:
31-
fail-fast: False
30+
fail-fast: false
3231
matrix:
3332
os: [windows, ubuntu, macos]
34-
python-version: ["3.13"]
33+
python-version: ['3.13']
3534
include:
3635
- os: ubuntu
37-
python-version: "3.11"
36+
python-version: '3.11'
3837
- os: ubuntu
39-
python-version: "3.12"
40-
# Disabled for now. See https://github.com/projectmesa/mesa/issues/1253
41-
#- os: ubuntu
42-
# python-version: 'pypy-3.8'
38+
python-version: '3.12'
4339

4440
steps:
45-
- uses: actions/checkout@v4
46-
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v5
48-
with:
49-
python-version: ${{ matrix.python-version }}
50-
cache: 'pip'
51-
- name: Install uv
52-
run: pip install uv
53-
- name: Install mesa-frames
54-
# See https://github.com/astral-sh/uv/issues/1945
55-
run: |
56-
uv pip install --system .[dev]
57-
- name: Test with pytest
58-
run: pytest --durations=10 --cov=mesa_frames tests/ --cov-report=xml
59-
- if: matrix.os == 'ubuntu'
60-
name: Codecov
61-
uses: codecov/codecov-action@v4
62-
with:
63-
token: ${{ secrets.CODECOV_TOKEN }}
41+
- uses: actions/checkout@v4
42+
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
cache: 'pip'
48+
49+
- name: Install uv via GitHub Action
50+
uses: astral-sh/setup-uv@v6
51+
52+
- name: Install mesa-frames + dev dependencies
53+
run: |
54+
# 1. Install the project itself
55+
uv pip install --system .
56+
# 2. Install everything under the "dev" dependency group
57+
uv pip install --group dev --system
58+
59+
- name: Test with pytest
60+
run: pytest --durations=10 --cov=mesa_frames tests/ --cov-report=xml
61+
62+
- if: matrix.os == 'ubuntu'
63+
name: Codecov
64+
uses: codecov/codecov-action@v4
65+
with:
66+
token: ${{ secrets.CODECOV_TOKEN }}

pyproject.toml

Lines changed: 97 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,130 @@
1+
# ──────────────────────────────────────────────────────────────────────────────
2+
# Build system (unchanged)
3+
# ──────────────────────────────────────────────────────────────────────────────
14
[build-system]
2-
requires = ["hatchling"]
3-
build-backend = "hatchling.build"
5+
requires = ["hatchling"]
6+
build-backend = "hatchling.build"
47

8+
9+
# ──────────────────────────────────────────────────────────────────────────────
10+
# Project metadata (updated dependency versions)
11+
# ──────────────────────────────────────────────────────────────────────────────
512
[project]
6-
name = "mesa_frames"
7-
description = "An extension to the Mesa framework which uses Polars DataFrames for enhanced performance"
8-
authors = [
13+
name = "mesa_frames"
14+
description = "An extension to the Mesa framework which uses Polars DataFrames for enhanced performance"
15+
authors = [
916
{ name = "Project Mesa Team", email = "projectmesa@googlegroups.com" },
10-
{ name = "Adam Amer"},
11-
]
12-
license = { text = "MIT" }
13-
readme = "README.md"
14-
keywords = [
15-
"simulation",
16-
"simulation-environment",
17-
"gis",
18-
"simulation-framework",
19-
"agent-based-modeling",
20-
"complex-systems",
21-
"spatial-models",
22-
"mesa",
23-
"complexity-analysis",
24-
"modeling-agents",
25-
"agent-based-modelling"
17+
{ name = "Adam Amer" },
2618
]
27-
classifiers = [
28-
"Development Status :: 3 - Alpha",
29-
"Intended Audience :: Science/Research",
30-
"License :: OSI Approved :: MIT License",
31-
"Programming Language :: Python :: 3",
32-
"Topic :: Scientific/Engineering :: Artificial Life",
19+
license = { text = "MIT" }
20+
readme = "README.md"
21+
keywords = [
22+
"simulation", "simulation-environment", "gis", "simulation-framework",
23+
"agent-based-modeling", "complex-systems", "spatial-models", "mesa",
24+
"complexity-analysis", "modeling-agents", "agent-based-modelling",
3325
]
34-
dependencies = [
35-
"numpy>=2.0.2",
36-
"pyarrow",
37-
## polars
38-
"polars>=1.0.0", #polars._typing (see mesa_frames.types) added in 1.0.0
39-
#"geopolars" (currently in pre-alpha)
26+
classifiers = [
27+
"Development Status :: 3 - Alpha",
28+
"Intended Audience :: Science/Research",
29+
"License :: OSI Approved :: MIT License",
30+
"Programming Language :: Python :: 3",
31+
"Topic :: Scientific/Engineering :: Artificial Life",
4032
]
4133
requires-python = ">=3.11"
42-
dynamic = [
43-
"version"
34+
dependencies = [
35+
"numpy>=2.0.2",
36+
"pyarrow>=20.0.0",
37+
# polars._typing added in 1.0.0
38+
"polars>=1.30.0",
4439
]
45-
46-
40+
dynamic = ["version"]
4741

4842
[project.urls]
4943
Documentation = "https://projectmesa.github.io/mesa-frames"
50-
Repository = "https://github.com/projectmesa/mesa-frames.git"
51-
52-
[project.optional-dependencies]
53-
mkdocs = [
54-
"mkdocs-material",
55-
"mkdocs-jupyter",
56-
"mkdocs-git-revision-date-localized-plugin",
57-
"mkdocs-minify-plugin",
58-
"mkdocs-include-markdown-plugin"
59-
]
44+
Repository = "https://github.com/projectmesa/mesa-frames.git"
6045

61-
sphinx = [
62-
"sphinx",
63-
"sphinx-rtd-theme",
64-
"numpydoc",
65-
"pydata-sphinx-theme",
66-
"sphinx-copybutton",
67-
"sphinx-design",
68-
"autodocsumm"
69-
]
7046

71-
docs = [
72-
"mesa_frames[mkdocs, sphinx]",
73-
# Readme Script
74-
"perfplot",
75-
"seaborn"
76-
]
47+
# ──────────────────────────────────────────────────────────────────────────────
48+
# Dependency groups (PEP 735) – local-only, never shipped to PyPI
49+
# ──────────────────────────────────────────────────────────────────────────────
50+
[dependency-groups]
7751

7852
test = [
79-
"pytest",
80-
"pytest-cov",
81-
"beartype",
53+
"pytest>=8.3.5",
54+
"pytest-cov>=6.1.1",
55+
"beartype>=0.21.0",
56+
]
57+
58+
docs = [
59+
"mkdocs-material>=9.6.14",
60+
"mkdocs-jupyter>=0.25.1",
61+
"mkdocs-git-revision-date-localized-plugin>=1.4.7",
62+
"mkdocs-minify-plugin>=0.8.0",
63+
"mkdocs-include-markdown-plugin>=7.1.5",
64+
"sphinx>=7.4.7",
65+
"sphinx-rtd-theme>=3.0.2",
66+
"numpydoc>=1.8.0",
67+
"pydata-sphinx-theme>=0.16.1",
68+
"sphinx-copybutton>=0.5.2",
69+
"sphinx-design>=0.6.1",
70+
"autodocsumm>=0.2.14",
71+
"perfplot>=0.10.2",
72+
"seaborn>=0.13.2",
8273
]
8374

75+
# dev = test ∪ docs ∪ extra tooling
8476
dev = [
85-
"mesa_frames[test, docs]",
77+
{ include-group = "test" },
78+
{ include-group = "docs" },
8679
"mesa~=2.3.4",
87-
"numba>=0.60",
80+
"numba>=0.60.0",
8881
"ruff>=0.11.12",
8982
"pre-commit>=4.2.0",
9083
]
9184

85+
86+
# ──────────────────────────────────────────────────────────────────────────────
87+
# Hatch configuration
88+
# ──────────────────────────────────────────────────────────────────────────────
89+
[tool.hatch.version]
90+
path = "mesa_frames/__init__.py"
91+
92+
# Ask Hatch to use uv as the installer everywhere for speed.
93+
[tool.hatch.envs.default]
94+
installer = "uv"
95+
96+
# Testing environment ‒ installs ONLY the "test" group
9297
[tool.hatch.envs.test]
93-
features = ["test"]
98+
dependencies = [{ include-group = "test" }]
99+
100+
# Docs build environment
101+
[tool.hatch.envs.docs]
102+
dependencies = [{ include-group = "docs" }]
94103

95-
[tool.hatch.envs.dev] #Allows installing dev as virtual env
96-
features = ["dev"]
104+
# Dev environment (inherits uv installer)
105+
[tool.hatch.envs.dev]
106+
dependencies = [{ include-group = "dev" }]
97107
env = { MESA_FRAMES_RUNTIME_TYPECHECKING = "true" }
98108

109+
# Wheel build – unchanged
99110
[tool.hatch.build.targets.wheel]
100111
packages = ["mesa_frames"]
101112

102-
[tool.hatch.version]
103-
path = "mesa_frames/__init__.py"
104113

114+
# ──────────────────────────────────────────────────────────────────────────────
115+
# uv configuration
116+
# ──────────────────────────────────────────────────────────────────────────────
117+
[tool.uv]
118+
# Install the dev stack by default when you run `uv sync`
119+
default-groups = ["dev"]
120+
121+
[tool.uv.sources]
122+
mesa-frames = { workspace = true }
123+
124+
125+
# ──────────────────────────────────────────────────────────────────────────────
126+
# Ruff linter – unchanged
127+
# ──────────────────────────────────────────────────────────────────────────────
105128
[tool.ruff.lint]
106129
select = ["D"]
107130
ignore = ["D101", "D102", "D105"]
@@ -110,15 +133,6 @@ ignore = ["D101", "D102", "D105"]
110133
convention = "numpy"
111134

112135
[tool.ruff.lint.per-file-ignores]
113-
"tests/*" = ["D"]
136+
"tests/*" = ["D"]
114137
"examples/*" = ["D"]
115-
"docs/*" = ["D"]
116-
117-
[tool.uv.sources]
118-
mesa-frames = { workspace = true }
119-
120-
[dependency-groups]
121-
dev = [
122-
"mesa-frames[dev]",
123-
]
124-
138+
"docs/*" = ["D"]

0 commit comments

Comments
 (0)