Skip to content

Fix CI and align versions#123

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

Fix CI and align versions#123
SongshGeo merged 722 commits intomasterfrom
dev

Conversation

@SongshGeo
Copy link
Copy Markdown
Collaborator

@SongshGeo SongshGeo commented Oct 29, 2025

Summary by CodeRabbit

  • Chores
    • Streamlined CI/CD pipelines for improved build reliability and testing efficiency.
    • Consolidated GitHub Actions workflows to reduce pipeline complexity and standardize development tooling.

SongshGeo and others added 30 commits April 8, 2024 22:57
Fix some bugs for setting/getting values and typos in docs
Fixed random list problem
refactored nature patches for more convenience and consistency
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.
… and enhancing uv integration

This commit simplifies the GitHub Actions workflows by removing the optional Poetry paths and related steps, focusing solely on the `uv` setup for dependency management and documentation deployment. The `gh-page.yml` file is updated to ensure that all documentation build and deployment steps utilize `uv`, while the `tests.yml` file is restructured to consolidate testing jobs and improve clarity. Additionally, the linting and type checking steps are integrated into the testing workflow, enhancing the overall CI process.
… with uv

This commit modifies the GitHub Actions workflow for testing notebooks by replacing the manual installation of `uv` with a direct action setup. Additionally, the testing command is updated to utilize `uv` for running pytest on Jupyter notebooks, enhancing the efficiency and clarity of the CI process. This change aligns with the project's focus on improved dependency management and testing capabilities.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR consolidates CI/CD workflows by removing Poetry support and making UV the exclusive dependency manager across all workflows. It restructures test execution by merging multiple fragmented jobs into unified lint and test jobs with dedicated linting and type-check steps, while also enhancing notebook testing.

Changes

Cohort / File(s) Summary
UV-only migration
\.github/workflows/gh-page\.yml
Removes Poetry conditional branches and workflow input. Makes UV setup and dependency installation unconditional. Eliminates Poetry caches, installation, and fallback logic. Replaces conditional notebook conversion note with build-time handling comment. Standardizes all deploy commands to UV-only.
Notebook testing enhancement
\.github/workflows/test-notebooks\.yml
Replaces pip install uv with astral-sh/setup-uv@v4 action. Enhances nbmake step with early-exit logic, conditional notebook discovery under docs/**/*.ipynb, verbose output, and explicit uv run pytest --nbmake invocation.
Test job consolidation
\.github/workflows/tests\.yml
Collapses multiple jobs (foundation-tests, scenario-tests, test, performance-tests, test-matrix-summary) into single lint job and matrix-based tests job. Adds dedicated linting (ruff) and type-checking (mypy) steps in lint job. Replaces pytest calls with make test-all target. Consolidates coverage upload to Python 3.11 on ubuntu-latest only. Simplifies caching to single UV cache approach.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant Setup as Setup Phase
    participant Lint as Lint Job
    participant Test as Tests Job (Matrix)
    participant Deploy as Deploy Phase

    rect rgb(240, 248, 255)
    Note over GH,Deploy: Previous: Multiple conditional jobs (Poetry/UV branches, separate test pipelines)
    end

    rect rgb(200, 230, 201)
    Note over GH,Setup: New: Unified UV-only setup
    GH->>Setup: Trigger workflow
    Setup->>Setup: setup-uv@v4 (always)
    Setup->>Setup: uv install dependencies (always)
    end

    rect rgb(255, 243, 224)
    Note over Lint,Test: Python 3.11 only
    Lint->>Lint: ruff (linting)
    Lint->>Lint: mypy (type-check)
    end

    rect rgb(225, 245, 254)
    Note over Test,Test: Matrix: OS × Python versions
    Test->>Test: make test-all
    alt Python 3.11 + ubuntu-latest
        Test->>Test: Upload coverage
    end
    end

    rect rgb(240, 230, 240)
    Note over Deploy,Deploy: UV-only deploy commands
    Deploy->>Deploy: mike deploy (uv-based)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • .github/workflows/tests.yml: Significant structural reorganization with multiple job consolidations, matrix changes, and new conditional logic for coverage uploads requires careful verification of test coverage continuity.
  • .github/workflows/gh-page.yml: Multiple conditional branch removals across setup, build, and deploy phases need validation that no Poetry-dependent paths are missed.
  • .github/workflows/test-notebooks.yml: Bash logic expansion with early-exit conditions and notebook discovery filtering needs careful validation of edge cases.

Poem

🐰 No more Poetry, just UV so true,
Jobs consolidated, the old ones withdrew.
Linting and testing in harmony blend,
A cleaner CI/CD—this tale comes to end! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title refers to real and substantial changes present in the changeset: the CI workflows have been significantly refactored (gh-page.yml migrated from Poetry to UV, new test-notebooks.yml workflow added, tests.yml restructured), and versions have been aligned (pyproject.toml version updated, docs version updated to 0.8.x). However, these CI and version-alignment changes represent only a portion of this changeset, which also includes major feature additions (new plotting module, actor evaluation/movement methods, spatial utilities, extensive test infrastructure, and tutorial modernization). The title captures real aspects of the change but does not highlight the primary scope of the PR's modifications.
Docstring Coverage ✅ Passed Docstring coverage is 81.09% which is sufficient. The required threshold is 80.00%.

📜 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 ef462ce and 04bc1cd.

📒 Files selected for processing (3)
  • .github/workflows/gh-page.yml (1 hunks)
  • .github/workflows/test-notebooks.yml (2 hunks)
  • .github/workflows/tests.yml (3 hunks)

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

This commit updates the GitHub Actions workflow for testing Jupyter notebooks by implementing a check for the presence of notebooks before running tests. If no notebooks are found, the process will skip testing, improving efficiency. The command now dynamically lists notebooks to test, ensuring that only relevant files are included in the testing process. This change aligns with the project's focus on robust CI practices and streamlined testing workflows.
@SongshGeo SongshGeo merged commit 036c09e into master Oct 29, 2025
6 of 13 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