Repository navigation
[test] benchmark comment workflow - #17
Open
codebreaker32 wants to merge 152 commits into
Open
codebreaker32 wants to merge 152 commits into
codebreaker32 wants to merge 152 commits into
Conversation
….py` (mesa#3482) * Add diffing engine to core.py * Remove observe usage from ComputedState * Rename _add_parent * fix indentation --------- Co-authored-by: Jan Kwakkel <[email protected]>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.12 → v0.15.15](astral-sh/ruff-pre-commit@v0.15.12...v0.15.15) - [github.com/errata-ai/vale: v3.14.1 → v3.14.2](vale-cli/vale@v3.14.1...v3.14.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…terval validation (mesa#3729)
…esa#3731) * fix:Preserve read_only property layers across Grid pickling and deepcopy * Track read_only layers explicitly in a set instead of inferring via fset
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6 to 7. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v6...v7) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add informative __repr__ and __str__ to AgentSet and GroupBy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Show group identifiers and sizes in GroupBy repr --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: show only stable version in switcher * docs: update switcher to latest and v3.5.1 * Update regarding the en in v3.5.1 * fixing the json switcher in the latest * final fix of json switcher and stable version problem * ci: added workflow to auto-update version switcher on release * docs: updated the release steps * final change for fix of v3.5.1 --------- Co-authored-by: Tom Pike <[email protected]>
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The VoronoiGrid.__init__ docstring documented a 'capacity_function' parameter, but that is a local variable, not an argument. The actual 'capacity' parameter accepts an int or a Callable; document that instead and drop the nonexistent 'capacity_function' entry.
updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.15 → v0.15.20](astral-sh/ruff-pre-commit@v0.15.15...v0.15.20) - [github.com/errata-ai/vale: v3.14.2 → v3.15.1](vale-cli/vale@v3.14.2...v3.15.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…#3774) * Add peek method to HasEmitters * Add tests
Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@v8...v9) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: '9' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* initial implementation of DiskStore * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * move provenance gathering into write_scenarios based on RunConfiguration * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * reorganize tests * imporving tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * shift to uuid * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update disk_writer.py * Update disk_writer.py * Update runner.py * add optional schema * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update disk_writer.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * import test * unit tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * codespell fix * make uuid safe across different fork/spawn mechanisms * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updates * fixes for @codebreaker32 feedback * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update disk_store.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…rning (mesa#4012) Every CI job that runs pytest with `-Werror` now dies before collecting a single test: Error while loading plugin "pytest11". solara/test/pytest_plugin.py:29: from solara.server.starlette import ServerStarlette solara/server/starlette.py:27: import websockets.legacy.http E DeprecationWarning: websockets.legacy is deprecated pytest 9.2.0 shipped pytest-dev/pytest#12697, which makes warnings raised while importing entry-point plugins go through the normal filter pipeline. Solara registers a pytest plugin by entry point, that plugin imports `websockets.legacy`, and `websockets.legacy.__init__` has emitted a `DeprecationWarning` since websockets 14.0. Under `-Werror` it is now promoted to an error, so pytest exits 3 with zero tests run. Nothing in mesa changed. `build (ubuntu, 3.14)` was green on `main` at 2026-10-27 10:15 and has failed on every run since, and the `coverage` job is the only one still passing because it is the only one that does not pass `-Werror`. Add a message-scoped ignore for that one warning, in the same style as the `-Wdefault::PendingDeprecationWarning` carve-out already on both commands. Verified against the versions CI installs (pytest 9.2.0, solara 1.64.1, websockets 17.3): - `-Werror` alone: exit 3 at plugin load - with the ignore: collection and the run proceed normally - an unrelated `DeprecationWarning` raised in a test still fails, so `-Werror` keeps its value A `filterwarnings` entry in `pyproject.toml` does not work here: a command-line `-W` takes precedence over the ini option, so the `-Werror` on these commands overrides it and the run still exits 3. Tested. Co-authored-by: Claude Opus 5 <[email protected]>
Ten modules under `mesa/` carry `>>>` examples, and eight of them fail when collected with `pytest --doctest-modules`. None of the failures are typos in prose; each is an example that cannot execute as written: - `portrayal_components.py`: continuation lines start with `>>>` instead of `...`, so doctest hands the continuation to the interpreter as a fresh statement and it raises `IndentationError`. - `meta_agents_api.py`: the `create` and `at_level` examples use `[...]` placeholders where a list of agents belongs, and discard nothing from `add_member`, whose return value then shows up as unexpected output. Both are now self-contained, with the setup taken from `docs/apis/meta_agents.md`. - `solara_viz.py` and `command_console.py`: the examples build Solara components or need a live UI callback, so they cannot run headless. They are marked `# doctest: +SKIP`, and `ModelCreator`'s dict literal continuation is fixed to `...`. `pytest --doctest-modules mesa --ignore=mesa/examples` goes from 8 failed / 2 passed to 8 passed / 2 skipped. No behaviour changes: every edit is inside a docstring. This is the first half of mesa#3864, split on request so each half can be reviewed on its own. The CI job that keeps these green is the second half. Part of mesa#3825. Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Jan Kwakkel <[email protected]>
MultiLevelAllianceModel, PdGrid and EpsteinCivilViolence take their parameters from a Scenario since mesa#3493, but their docstrings still listed the old keyword arguments (n/mean/std_dev/rng, width/height/ activation_order/payoffs, seed). Document them under scenario instead. Co-authored-by: Jan Kwakkel <[email protected]>
* update tutorials; strip out cell diffs * websocket pin to prevent build failure --------- Co-authored-by: Jan Kwakkel <[email protected]>
Collect maintainer knowledge that was scattered across issues, PRs, discussions and the wiki into a developer guide in docs/development/: - index: how we work (problem -> concept -> implementation), when to open what, pathfinding PRs, and expectations for AI tool use - principles: design principles and the trade-offs Mesa makes - standards: code, API, exception, determinism, performance, test, docs, examples and deprecation conventions - review: how to review contributions in stage order, and how to give warm, actionable feedback - decisions: log of cross-cutting project decisions and rejected ideas - maintainers: roles and the release process CONTRIBUTING.md becomes a short front door that links into the guide. AGENTS.md instructs AI coding assistants how to work on Mesa (problem before code, small PRs, verify claims, let contributors speak for themselves) and points to the guide; CLAUDE.md imports it. Drafts were generated from ~2,600 maintainer-reviewed threads (2021-2026) and checked against current code; they still need maintainer review.
Co-authored-by: Jan Kwakkel <[email protected]>
When no agent data has been recorded (e.g. before collect() is called or when collect() runs on a model with zero agents), all_records is an empty generator. Passing an empty generator to pd.DataFrame.from_records with an index parameter causes pandas to misparse the index labels as row entries, producing a non-empty DataFrame of length 2 containing spurious all-NaN rows instead of an empty DataFrame of length 0. Materialize all_records to a list before constructing the DataFrame, matching the behavior and fix established in get_agenttype_vars_dataframe (mesa#3797). Co-authored-by: Gracy769 <[email protected]>
…esa#3920) * feat(agentset): warn when one mutable object is shared across agents Signed-off-by: Rudra Dudhat <[email protected]> * only warn for shared mutable containers Signed-off-by: Rudra Dudhat <[email protected]> --------- Signed-off-by: Rudra Dudhat <[email protected]>
`mesa/` carries `>>>` examples in ten modules, and nothing runs them, so
they rot silently. Add a `doctest` job to build_lint.yml that runs
pytest --doctest-modules mesa --ignore=mesa/examples
on Python 3.14, matching the existing coverage job.
It is a separate job rather than part of the `build` matrix or the docs
build so that a rotten docstring is reported on its own, instead of
appearing as a unit-test failure or a docs-build failure. That is
@falloficaruss's suggestion on mesa#3825.
`mesa/examples` is excluded: it has no doctests, every `app.py` builds a
model and a renderer at import time, and `st_app.py` imports streamlit,
which is not a dependency.
`pyproject.toml` gains `doctest_optionflags = ["ELLIPSIS",
"NORMALIZE_WHITESPACE"]` under `[tool.pytest.ini_options]`. There is no
`addopts`, so the normal suite is untouched: `pytest tests/ --collect-only`
reports 1016 tests both with and without the block.
This is the second half of mesa#3864, split on request. The first half, the
docstring repairs in mesa#4010, is merged, so this job is green on arrival.
Closes mesa#3825.
Co-authored-by: Claude Opus 5 <[email protected]>
Emergency pass thru due to simplicity and upcoming Mesa tutorial
) After `copy.deepcopy` or a pickle round trip of a `Grid`, the property-layer accessors only work on the first cell. Every other cell raises `AttributeError` for `cell.<layer>`, `cell.empty` silently stops writing to the `"empty"` layer, and the restored grid cannot be pickled a second time. Anything that deep-copies or pickles a model holding a grid, for example to save and restore it or to hand it to another process, hits this.
…mesa#4026) `Grid.select_random_empty_cell` catches the `IndexError` from `random.choice` on a full grid and re-raises it with a message naming the real problem. `DiscreteSpace.select_random_empty_cell`, which `Network` and `VoronoiGrid` inherit unchanged, does not: return self.random.choice(list(self.empties)) On a full space that surfaces the stdlib IndexError: Cannot choose from an empty sequence from inside `random.py`, which says nothing about the space being full and points at a line the user never wrote. A Schelling-style model moving agents on a `Network` hits this as soon as the last cell fills. Guard the empty case and raise `SpaceException` with an actionable message. The list is materialised anyway, so the check costs a `len` and replaces the try/except the grid path needs. `SpaceException` rather than a built-in because the raw `IndexError` leaks an internal (that the lookup is a `random.choice` over a materialised list) and `mesa/exceptions.py` already carries `SpaceException` for discrete-space errors, which is what `docs/development/standards.md` asks for. No new exception type is added. Deliberately not touching `Grid.select_random_empty_cell`, which raises `ValueError` for the same condition. Changing it is a breaking change, it is pinned by `test_infinite_loop_on_full_grid`, and in mesa#4001 @quaquel ruled that `ValueError` is wrong for methods that receive no value, with the outcome there being to move such cases to `SpaceException`. Aligning the grid path belongs with that migration, not here. Tests cover `Network` and `VoronoiGrid` on a full space, and a space with one cell left so the guard cannot fire early. Both new cases fail on main with the stdlib `IndexError`. Co-authored-by: Claude Opus 5 <[email protected]>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.16.10 → v0.17.3](astral-sh/ruff-pre-commit@v0.16.10...v0.17.3) - [github.com/asottile/pyupgrade: v3.21.2 → v3.22.0](asottile/pyupgrade@v3.21.2...v3.22.0) - [github.com/errata-ai/vale: v3.24.0 → v3.26.0](vale-cli/vale@v3.24.0...v3.26.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jan Kwakkel <[email protected]>
workflow_run.pull_requests is always empty when the PR head lives in a fork, so since mesa#3622 the comment job failed with "No pull request found on workflow_run payload." on nearly every PR. Look the PR up with pulls.list using the head owner, branch, and SHA from the event payload instead. Those values come from GitHub, not from the uploaded artifact, so the tampering protection from mesa#3622 is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop error messages that still referred to the workflow_run payload, collapse the duplicate SHA-match failures into one, use optional chaining for the head repository lookup, and pass the PR number to the comment step through env instead of interpolating it into the script.
|
Performance benchmarks:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporary PR to test the benchmark comment fix. Will be closed.