Skip to content

✅ Fix CI workflows#122

Merged
SongshGeo merged 718 commits intomasterfrom
dev
Oct 29, 2025
Merged

✅ Fix CI workflows#122
SongshGeo merged 718 commits intomasterfrom
dev

Conversation

@SongshGeo
Copy link
Copy Markdown
Collaborator

@SongshGeo SongshGeo commented Oct 29, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added visualization utilities for spatial raster data with dictionary-based color mapping support.
    • Enhanced actor evaluation with candidate scoring and state rollback capabilities.
    • Introduced dictionary-based spatial filtering for advanced cell selection.
    • Added agent counting and batch processing functions for spatial modules.
    • New quick-start example notebooks for fire spread, Hotelling's Law, and Schelling segregation models.
    • Expanded plotting API with dynamic attribute access and improved data extraction.
  • Documentation

    • Published API stability guarantee document.
    • Updated all examples with comprehensive English guides and practical code examples.
    • Added tutorial notebooks demonstrating new plotting and batch operation features.
  • Testing

    • Implemented multi-layered test framework with foundation, scenario, and performance tests.
    • Added comprehensive test fixtures and validation utilities.

SongshGeo and others added 30 commits April 7, 2024 12:35
fix(docs): 📝 adding authors' orcid of the paper
Fix some bugs for setting/getting values and typos in docs
Fixed random list problem
refactored nature patches for more convenience and consistency
…ctor data application

This commit modifies the `PatchModule` class to ensure that providing an `attr_name` automatically applies raster data, maintaining backward compatibility with version 0.7.x behavior. The changes include updating the logic for applying raster data and removing unnecessary parameters from the initialization process. Additionally, new tests are added to verify that both raster and vector data are correctly applied when `attr_name` is provided, ensuring consistent behavior across different module creation methods.
…ndency management

This commit updates the project to use `uv` instead of `poetry` for environment and dependency management. Key changes include:

- Removed Poetry hooks from the pre-commit configuration.
- Updated the `contributing.md` and other documentation to reflect the use of `uv` for environment setup and dependency installation.
- Modified the Makefile to utilize `uv` commands for installing dependencies, running tests, and serving documentation.
- Adjusted the GitHub Actions workflows to install and cache `uv`, ensuring a streamlined CI/CD process.

These changes aim to simplify dependency management and enhance the development workflow.
…to uv

This commit removes the `poetry.lock` file and updates the `pyproject.toml` to reflect the new dependency management approach using `uv`. Key changes include:

- Migration of dependency specifications to the new format in `pyproject.toml`.
- Addition of dependency groups for development and documentation.
- Update of the `uv.lock` file to include the necessary packages and their versions.
- Adjustments to the Python version requirements to ensure compatibility.

These changes aim to streamline dependency management and enhance the overall development workflow.
…ne command

This commit modifies the `tox.ini` file to remove the `extras` specification, simplifying the dependency management. Additionally, the GitHub Actions workflow is updated to use `uv sync --dev` instead of `uv sync --all-extras`, ensuring a more focused installation of development dependencies. These changes aim to enhance the clarity and efficiency of the project's dependency management process.
…sting and linting

This commit modifies the `pyproject.toml` to enhance pytest configuration by adding coverage reporting for the `abses` module. Additionally, it refines the Ruff configuration to better manage linting rules, including the addition of specific error and warning selections. The GitHub Actions workflow is updated to improve cache key generation by including the `uv.lock` file, ensuring more efficient caching. Lastly, the migration guide is updated to clarify logging practices in hooks. These changes aim to streamline testing and linting processes while improving documentation clarity.
This commit modifies the GitHub Actions workflow configuration to remove the `dev` branch from the list of branches that trigger tests on push events. The `pull_request` event configuration remains unchanged, continuing to include `main`, `master`, and `dev`. These changes aim to streamline the testing process by focusing on the primary branches.
This commit updates the GitHub Actions workflow configuration to include concurrency settings, allowing for better management of in-progress jobs. The `concurrency` group is defined to ensure that only one job runs at a time for a given pull request, improving resource utilization and reducing unnecessary job runs. The changes aim to streamline the CI/CD process and enhance the efficiency of testing workflows.
This major refactoring introduces a protocol-based type system and reorganizes
the module structure while maintaining backward compatibility for public APIs.

Key Changes:
- Introduce base classes: BaseModelElement, BaseModule, BaseObservable, BaseSubSystem
- Protocol definitions for better type safety
- Module reorganization: abses.cells → abses.space.cells, abses.tools → abses.utils
- TimeDriver decoupling from model steps
- Enhanced type checking configurations (mypy strict mode)

Breaking Changes:
- Module import paths changed (use public API: from abses import ... to avoid)
- _do_each() → do_each() (private to public)
- create_module(how=...) parameter removed
- agents.select/has signature changes (use agent_type parameter)
- agents.apply() removed (use for loop instead)

Migration:
- Public API users: Zero changes needed ✅
- Internal API users: 15-30 minutes migration
- Complete guide: docs/wiki/migration_guide_v0.7.md
- Compatibility validated with real research projects

Testing:
- 33/33 internal example tests passing (100%)
- 2/2 external projects compatibility verified
  - shifting_baseline: zero changes needed
  - South China Livelihood: 3 minor updates
- Test coverage improved by 230% (10 → 33 tests)

Examples Enhanced:
- fire_spread: Fixed config + detailed README
- wolf_sheep: 9 API updates + 15 tests + detailed README
- schelling: 8 new tests + detailed README
- All examples now showcase framework advantages
Previously used direct attribute access (than.metric) which would fail
if 'metric' was a variable name rather than a literal attribute.

Changed to use getattr(than, metric) for proper dynamic attribute access.

Line 244: than = getattr(than, metric)  # was: than = than.metric
…nd CI integration

This commit introduces a comprehensive set of layered test commands in the Makefile, allowing for structured testing of core functionalities, user scenarios, and backward compatibility. New commands include `test-foundation`, `test-scenarios`, and `test-compatibility`, among others, to facilitate targeted testing. Additionally, the GitHub Actions workflow is updated to include dedicated jobs for foundation and scenario tests, improving CI/CD efficiency. Documentation is also added to guide users on utilizing the new testing framework effectively.
This commit introduces a comprehensive set of UML documentation for the ABSESpy library, including class and sequence diagrams for core, agents, space, and human modules, as well as user scenarios and internal flows. The `mkdocs.yml` configuration is updated to include new navigation entries for UML documentation, ensuring easy access. Additionally, JavaScript support for Mermaid diagrams is added to enhance visual representation. The `pyproject.toml` and `uv.lock` files are updated to include necessary dependencies for documentation generation. These changes aim to improve the clarity and accessibility of the project's architecture and usage patterns.
…y-style indexing

This commit adds the __getitem__ method to the PatchModule class, enabling numpy-style indexing to access cells and return an ActorsList. The method supports various indexing patterns, including single cell, column, row, subregion, and full array selections. Comprehensive tests are introduced to validate the functionality and ensure correct behavior across different scenarios. Additionally, the ListRandom class is updated to enhance random generation capabilities, and the fire spread model is modified to utilize the new indexing features for improved tree placement and ignition operations.
… and colormap functionality

This commit introduces a new test suite for the visualization utilities, including the `plot_raster` and `quick_plot` functions. The tests ensure proper visualization of spatial data from `PatchModule` instances, validating functionality with dictionary colormaps, custom titles, and save capabilities. Additionally, a new test for the `PlotableAttribute` class is added to verify dynamic attribute access and plotting methods. The `test_colormap.py` file is also created to demonstrate colormap functionality with enum-based states, enhancing the overall testing coverage for visualization features.
…tion

This commit sets the environment variable LOGURU_AUTOINIT to "0" in the __init__.py file to disable loguru's default output. This change ensures that loguru does not add default handlers automatically, allowing users to configure logging explicitly through model settings. Additionally, the tutorial notebook is updated to remove unnecessary log output, enhancing clarity and focus on the model's functionality.
…thod in PatchModule

This commit introduces a new `move_to` method in the `Actor` class, allowing actors to move to specified locations or randomly. Additionally, a `count_agents` method is added to the `PatchModule` class, enabling the counting of agents of a specific type across the module, with options for returning data as either a numpy array or an xarray DataArray. Both methods include comprehensive docstrings and typing annotations to enhance clarity and usability.
…mics

This commit adds a new `config.yaml` file for the Wolf-Sheep model, allowing for customizable simulation parameters. Key enhancements in the model include increased energy levels for animals, improved reproduction mechanics, and the addition of properties to track sheep and wolf populations, as well as grass coverage. The README and quick start notebook are updated to reflect these changes, providing clearer instructions and showcasing the model's capabilities.
…guration and quick start notebook

This commit deletes the obsolete `agents.py`, `analysis.ipynb`, and `README_EN.md` files, streamlining the project structure. A new `config.yaml` file is introduced to allow customizable simulation parameters for the Schelling model. Additionally, a `schelling_quick_start.ipynb` notebook is added, providing a beginner-friendly guide to running the model, complete with step-by-step instructions and visualizations. The model's dynamics are enhanced to improve agent behavior and data collection.
…nd modify pytest command

This commit updates the `tox.ini` file to include the `skip_missing_interpreters` option, allowing for smoother environment setup. Additionally, the pytest command is modified to run using `python -m pytest`, ensuring compatibility and consistency across different environments.
…properties and methods

This commit introduces several enhancements across the agents and space modules. In the `_AgentsContainer` class, a new `lst` property is added to retrieve the list of agents, improving attribute access. The `ActorsList` class now includes a `linked_agents` property to return agents based on list content, along with new properties `is_cells`, `is_actors`, and `is_mixed` to check the type of elements in the list. Additionally, the `PatchCell` class gains an `is_empty` property to determine if a cell has any agents. The `apply_agents` method in `PatchModule` is updated to support more flexible agent processing, including enhanced error handling and output options. Comprehensive tests for the `apply_agents` method are added to ensure robust functionality across various scenarios.
…th rollback functionality

This commit introduces the `evaluate` method in the `Actor` class, allowing for the evaluation of candidates based on a scoring function. The method supports optional rollback of attributes and position, enhancing the flexibility of agent decision-making. Additionally, comprehensive tests for the `evaluate` method are added to ensure its correctness and robustness. The `Customer` and `Shop` classes in the Hotelling model are updated to utilize this new method, improving their functionality and performance. A new Jupyter notebook demonstrating the Hotelling model is also included, providing a quick start guide for users.
…ation structure

This commit adds several new tutorials at the intermediate and advanced levels, including topics on containers and indexing, evaluation and decision-making, logging and configuration, and protocols and extensions. Additionally, the existing tutorials are reorganized to improve navigation and clarity. The `mkdocs.yml` file is updated to reflect these changes, ensuring that the new tutorials are properly categorized. The `pyproject.toml` and `uv.lock` files are also updated to include the `nbmake` dependency for enhanced notebook testing capabilities. A new `pytest.ini` file is introduced to configure pytest options for testing notebooks, further improving the project's testing framework.
…files

This commit enhances the documentation structure by updating the `.gitignore` file to exclude auto-generated markdown files and Jupyter notebook checkpoints, while ensuring that manually written guides are tracked. The `mkdocs.yml` file is modified to reflect changes in the tutorial navigation, including the addition of new tutorials and the reorganization of existing ones. Furthermore, dependencies in `pyproject.toml` and `uv.lock` are updated to include `mkdocs-static-i18n` and `nbconvert`, improving the project's documentation and testing capabilities. Several obsolete tutorial notebooks are removed to streamline the content.
…configuration

This commit deletes outdated documentation files, including Chinese translations and UML diagrams, to streamline the project structure. The `mkdocs.yml` file is updated to remove references to these deleted files, ensuring the documentation reflects the current state of the project. This cleanup enhances clarity and maintainability of the documentation resources.
This commit updates the Makefile to improve testing commands by adding new options for running Jupyter notebook tests and multi-version tests with tox. The `test-all` command is modified to include notebook tests, and new commands `test-notebooks`, `test-notebook`, and `test-all-notebooks` are introduced for better notebook testing management. Additionally, the installation of `nbmake` is included in the test tools setup, enhancing the project's testing capabilities.
…cumentation

This commit updates the `.gitignore` file to exclude local environment files, ensuring sensitive information is not committed. The `pyproject.toml` file is modified to clarify the installation instructions for `mkdocs-material-insiders`, emphasizing that it should be installed locally via an environment variable. Additionally, the `uv.lock` file is updated to remove the direct reference to `mkdocs-material` and to reflect the latest version. The `index.md` file is also updated to reflect the new version of the documentation, enhancing clarity and maintainability.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The PR introduces notebook conversion workflows, expands test infrastructure with layered testing, adds new Agent evaluation and linking methods, enhances PatchModule with indexing and spatial operations, introduces a plotting API for rasters, modernizes examples with updated patterns, and refreshes tutorials and documentation across the codebase.

Changes

Cohort / File(s) Summary
GitHub Actions & CI Workflows
.github/workflows/gh-page.yml, .github/workflows/test-notebooks.yml, .github/workflows/tests.yml
Added notebook-to-markdown conversion steps in gh-page workflow; introduced test-notebooks workflow for notebook execution; expanded tests.yml with new jobs (foundation-tests, scenario-tests, performance-tests, integration-tests, regression-tests) and updated test-matrix-summary dependencies.
Project Configuration & Build
makefile, mkdocs.yml, pyproject.toml, pytest.ini, tox.ini
Expanded Makefile with layered test targets (foundation, scenarios, compatibility, notebooks); updated mkdocs.yml with Mermaid diagram support and navigation entries; added pytest.ini with test discovery and nbmake configuration; modified pyproject.toml with doc/notebook dependencies; updated tox.ini test command invocation.
Ignore & Changelog
.gitignore, CHANGELOG.md
Extended .gitignore with generated Markdown from notebooks, type checker caches, and notebook artifacts; removed release notes from 0.8.5 through 0.7.5 in CHANGELOG.md.
Core Agent/Actor Enhancements
abses/agents/actor.py
Added move_to() method and evaluate() method for scoring candidates with optional state rollback and selection by best score.
Agent Container & Sequences
abses/agents/container.py, abses/agents/sequences.py
Introduced lst property on _AgentsContainer; added linked_agents property and is_cells/is_actors/is_mixed properties on ActorsList; extended item() with default parameter; updated better() for Agent input handling.
Spatial Module Features
abses/space/cells.py, abses/space/patch.py
Added is_empty property to PatchCell; introduced getitem, getattr, enhanced select() with dict filtering, count_agents(), and apply_agents() methods on PatchModule.
Core Model & Type System
abses/core/model.py, abses/core/types.py, abses/core/base_subsystem.py, abses/__init__.py
Updated Model initialization with State setting; added Dict to CellFilter type; improved getattr attribute resolution in subsystem; added Loguru auto-init disabling in package init.
Visualization API
abses/viz/__init__.py, abses/viz/plotting.py
Created new plotting.py module with PlotableAttribute, plot_raster(), and quick_plot() functions; exposed via viz package all.
Utilities
abses/utils/func.py, abses/utils/random.py
Enhanced get_only_item() with default parameter; refactored ListRandom to inherit from Random with seed initialization from model.
Documentation Files
docs/api/stability_guarantee.md, docs/examples/official.md, docs/index.md, docs/javascripts/mermaid-init.js
Added API stability guarantee documentation; updated official examples with reformatted links and descriptions; updated index metadata (date/version); added Mermaid initialization script.
Tutorial Notebooks
docs/tutorial/advanced/geodata.ipynb, docs/tutorial/advanced/viz_model.ipynb, docs/tutorial/beginner/*.ipynb, docs/tutorial/completing/linking_actors.ipynb
Updated notebook imports, API usage patterns (plot_raster, direct imports), cell selections, and visualization workflows; changed execution_count metadata; updated TimeDriver API references and deprecated method calls.
Example Models
examples/fire_spread/model.py, examples/fire_spread/config.yaml, examples/hotelling_law/model.py, examples/hotelling_law/hotelling_quick_start.ipynb, examples/schelling/model.py, examples/schelling/config.yaml, examples/schelling/schelling_quick_start.ipynb, examples/wolf_sheep/model.py, examples/wolf_sheep/config.yaml
Refactored fire_spread with IntEnum states and batch operations; enhanced Hotelling with vectorized preference logic; introduced Schelling model via ABSESpy patterns; updated wolf_sheep with lifecycle changes and energy mechanics; added example notebooks and configuration files.
Example Documentation
examples/fire_spread/README.md, examples/fire_spread/README_EN.md, examples/fire_spread/README_ZH.md, examples/schelling/Readme.md, examples/wolf_sheep/README.md
Rewrote READMEs from Chinese-centric to English-focused; expanded feature descriptions, added configuration examples, batch experiment workflows, and comparative analysis; added comprehensive Chinese README for fire_spread.
Test Infrastructure
tests/api/test_actor_evaluate.py, tests/api/test_apply_agents.py, tests/api/test_main.py, tests/api/test_nature.py, tests/examples/test_schelling.py, tests/examples/test_sheep_wolf.py, tests/fixtures/test_data.py, tests/foundation/test_basic_functionality.py, tests/scenarios/test_simple_scenarios.py, tests/test_backward_compatibility.py, tests/utils/assertions.py, tests/viz/test_plotting.py, tests/viz/__init__.py
Added comprehensive test suites for new Actor.evaluate, PatchModule.apply_agents, indexing; introduced foundation and scenario test layers; added test data fixtures and assertion helpers; expanded backward compatibility coverage; added plotting tests; updated example model tests for new APIs.
Test Support
test_colormap.py
Added standalone test script for IntEnum-to-color-mapping validation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • abses/agents/actor.py - New evaluate() method with state rollback logic and scorer callback handling; complex control flow for position/attribute preservation
  • abses/space/patch.py - Multiple new methods (__getitem__, __getattr__, count_agents(), apply_agents()) with dict-based filtering and dtype coercion; interacts with xarray/numpy
  • abses/viz/plotting.py - New visualization module with colormap conversion (dict-to-ListedColormap) and matplotlib integration
  • examples/hotelling_law/model.py and examples/fire_spread/model.py - Significant refactoring with new batch operations and state management patterns
  • Tutorial notebooks - API changes (TimeDriver.ticking_mode → is_tick_mode, import path migrations, plot_raster usage); several breaking changes in cell selection/access patterns
  • Test infrastructure - Large addition of test files with new patterns; backward compatibility test suite should validate no regressions
  • abses/core/model.py - Initialization sequence change (initialize() called before _initialize); Loguru auto-init disabling affects logging behavior globally

Possibly related PRs

Poem

🐰 Notebooks bloom in markdown rows,
Tests in layers, knowledge flows,
Evaluate agents, plot with flair,
Patch and link with spatial care—
ABSESpy grows, refined and bright!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efc8370 and 98ea4e2.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (63)
  • .github/workflows/gh-page.yml (1 hunks)
  • .github/workflows/test-notebooks.yml (1 hunks)
  • .github/workflows/tests.yml (3 hunks)
  • .gitignore (2 hunks)
  • CHANGELOG.md (0 hunks)
  • abses/__init__.py (2 hunks)
  • abses/agents/actor.py (3 hunks)
  • abses/agents/container.py (2 hunks)
  • abses/agents/sequences.py (5 hunks)
  • abses/core/base_subsystem.py (2 hunks)
  • abses/core/model.py (3 hunks)
  • abses/core/types.py (2 hunks)
  • abses/space/cells.py (1 hunks)
  • abses/space/patch.py (6 hunks)
  • abses/utils/func.py (1 hunks)
  • abses/utils/random.py (2 hunks)
  • abses/viz/__init__.py (1 hunks)
  • abses/viz/plotting.py (1 hunks)
  • docs/api/stability_guarantee.md (1 hunks)
  • docs/examples/official.md (1 hunks)
  • docs/index.md (1 hunks)
  • docs/javascripts/mermaid-init.js (1 hunks)
  • docs/tutorial/advanced/geodata.ipynb (10 hunks)
  • docs/tutorial/advanced/viz_model.ipynb (11 hunks)
  • docs/tutorial/beginner/actors.ipynb (4 hunks)
  • docs/tutorial/beginner/hotelling_tutorial.ipynb (9 hunks)
  • docs/tutorial/beginner/organize_model_structure.ipynb (12 hunks)
  • docs/tutorial/beginner/predation_tutorial.ipynb (5 hunks)
  • docs/tutorial/beginner/time_control.ipynb (11 hunks)
  • docs/tutorial/completing/linking_actors.ipynb (5 hunks)
  • examples/fire_spread/README.md (2 hunks)
  • examples/fire_spread/README_EN.md (3 hunks)
  • examples/fire_spread/README_ZH.md (1 hunks)
  • examples/fire_spread/config.yaml (1 hunks)
  • examples/fire_spread/model.py (2 hunks)
  • examples/hotelling_law/hotelling_quick_start.ipynb (1 hunks)
  • examples/hotelling_law/model.py (1 hunks)
  • examples/schelling/Readme.md (3 hunks)
  • examples/schelling/config.yaml (1 hunks)
  • examples/schelling/model.py (4 hunks)
  • examples/schelling/schelling_quick_start.ipynb (1 hunks)
  • examples/wolf_sheep/README.md (1 hunks)
  • examples/wolf_sheep/config.yaml (1 hunks)
  • examples/wolf_sheep/model.py (7 hunks)
  • makefile (1 hunks)
  • mkdocs.yml (4 hunks)
  • pyproject.toml (3 hunks)
  • pytest.ini (1 hunks)
  • test_colormap.py (1 hunks)
  • tests/api/test_actor_evaluate.py (1 hunks)
  • tests/api/test_apply_agents.py (1 hunks)
  • tests/api/test_main.py (1 hunks)
  • tests/api/test_nature.py (1 hunks)
  • tests/examples/test_schelling.py (6 hunks)
  • tests/examples/test_sheep_wolf.py (2 hunks)
  • tests/fixtures/test_data.py (1 hunks)
  • tests/foundation/test_basic_functionality.py (1 hunks)
  • tests/scenarios/test_simple_scenarios.py (1 hunks)
  • tests/test_backward_compatibility.py (1 hunks)
  • tests/utils/assertions.py (1 hunks)
  • tests/viz/__init__.py (1 hunks)
  • tests/viz/test_plotting.py (1 hunks)
  • tox.ini (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@SongshGeo SongshGeo merged commit ef462ce into master Oct 29, 2025
10 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants