Modernize ripleyk package with tests, CI, and updated docs#4
Modernize ripleyk package with tests, CI, and updated docs#4SamPIngram merged 5 commits intomasterfrom
Conversation
This commit introduces a series of updates to modernize the `ripleyk` package, enhancing its maintainability, reliability, and usability. The key changes include: - **Added Tests**: A comprehensive test suite (`tests/test_ripleyk.py`) has been added using `pytest`. The tests cover the core functionality of the `calculate_ripley` function for both 2D and 3D calculations, including boundary correction and CSR normalization. The test data is generated deterministically to ensure consistent results. - **Updated Dependencies**: The `requirements.txt` file has been updated to use newer versions of `numpy` and `scipy`, with flexible version specifiers (`>=`). `pytest` has also been added as a development dependency. - **CI Workflow**: A GitHub Actions workflow (`.github/workflows/ci.yml`) has been created to automate testing. The workflow runs the test suite on Python versions 3.8, 3.9, 3.10, and 3.11. It also includes a release job to publish the package to PyPI when a new tag is pushed. - **Updated Documentation**: The `README.md` has been significantly improved. It now includes a CI badge, updated installation and contribution instructions, and modernized code examples. The output values in the examples have been updated to reflect the results from the new test suite, ensuring the documentation is accurate and consistent with the current version of the code.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. |
|
Please fix the following:
|
Thanks for the feedback! I've addressed all the points:
|
This commit addresses the feedback from the pull request review. The key changes include: - **Updated CI Workflow**: The GitHub Actions workflow in `.github/workflows/ci.yml` has been updated to test against Python 3.12 and 3.13, in addition to the existing versions. - **Added Linting with Pre-commit**: A `pre-commit` configuration (`.pre-commit-config.yaml`) has been added to enforce code quality standards. It uses `black` for consistent code formatting and `flake8` for linting. - **Configured Linters**: A `.flake8` configuration file has been added to align `flake8`'s rules with `black`'s formatting, ensuring the two tools work together seamlessly. - **Codebase Linting**: The entire codebase has been formatted and linted according to the new standards, resolving all reported issues. - **Development Dependencies**: A `requirements-dev.txt` file has been created to separate development dependencies (like `pytest` and `pre-commit`) from the core package dependencies.
This commit fixes the CI workflow by ensuring the package and its development dependencies are correctly installed before running the tests. The previous workflow was failing because it did not install the `ripleyk` package itself, leading to an `ImportError` when `pytest` tried to run. This has been resolved by: - Installing dependencies from `requirements-dev.txt` to ensure `pytest` is available. - Installing the package in editable mode (`pip install -e .`) so that it is available on the Python path for the test runner.
This commit resolves the CI failures by applying the necessary fixes to the correct workflow file and removing the unused one. The key changes include: - **Corrected CI Workflow**: The active `python-package.yml` workflow has been updated to correctly install the package and its development dependencies before running tests. This is achieved by installing `requirements-dev.txt` and then running `pip install -e .`. - **Expanded Python Versions**: The test matrix in `python-package.yml` has been expanded to include Python 3.12 and 3.13, as requested in the feedback. - **Removed Redundant Linting**: The old `flake8` linting step has been removed from the CI workflow, as linting is now handled more robustly by the `pre-commit` setup. - **Deleted Unused Workflow**: The inactive and incorrect `ci.yml` workflow file has been deleted to prevent future confusion.
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the ripleyk package by adding comprehensive testing, CI/CD infrastructure, and improved code formatting. The changes establish development best practices while maintaining backward compatibility.
- Adds pytest-based test suite with reproducible fixtures and comprehensive coverage
- Implements CI/CD workflow with multi-version Python testing and pre-commit hooks
- Modernizes code formatting and dependency management
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_ripleyk.py | Comprehensive test suite with fixtures for 2D/3D Ripley K calculations |
| ripleyk/ripleyk.py | Code formatting improvements and removal of unused import |
| ripleyk/init.py | Explicit imports replacing wildcard import |
| setup.py | Quote consistency fixes for string literals |
| .github/workflows/python-package.yml | Updated CI workflow with additional Python versions |
| .pre-commit-config.yaml | Pre-commit hooks for code quality |
| .flake8 | Linting configuration |
| requirements-dev.txt | Development dependencies |
| README.md | Updated documentation with CI badge and contribution guidelines |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This commit fixes a typo in an image URL within the `README.md` file. The URL for one of the 3D equation images had "https" repeated, which has now been corrected.
This update adds a test suite, a CI/CD workflow, and updates dependencies and documentation to modernize the
ripleykpackage.PR created automatically by Jules for task 14244301436799868913