Conversation
…36b666f9f Autobump 2025-03-27T14:34:58Z
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
…eckout-5 Bump actions/checkout from 4 to 5
…tup-python-6 Bump actions/setup-python from 5 to 6
* Refactor SEG gauge test * Employ `ISBI_EVALUATION_SOFTWARE_PASSWORD` in CI * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Update .github/workflows/testsuite.yml * Trigger CI * Add `delta=1e-5` * Update .github/workflows/testsuite.yml Co-authored-by: Copilot <[email protected]> * Revert "Update .github/workflows/testsuite.yml" This reverts commit 79a3a65. --------- Co-authored-by: Copilot <[email protected]>
* Remove tests/isbi_seg.py * Add `AggregatedJaccardCoefficient` measure * Fix flake8 linting * Add `MeasureProtocol.postprocess` and `AggregatedJaccardCoefficient` * Add `AJCTest` * Add `AJC` column to expected test output * Update docstring * Revert "Remove tests/isbi_seg.py" This reverts commit f3bc5fb. * Rename `nominator` to `numerator` * Add `AJCTest.test__postprocess__empty` and fix * Update docstring * Fix `AJCTest.test__multiple_images`
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Refactor CLI and fix warnings
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…0b80cca78 Autobump 2026-02-21T02:34:23Z
|
Test coverage of 94a3317: 88% |
There was a problem hiding this comment.
Pull request overview
This PR updates the segmetrics package to version 1.6, adds the Aggregated Jaccard Coefficient (AJC) measure, and modernizes packaging/CLI/docs while adjusting the test suite (including removing network download of ISBI evaluation software).
Changes:
- Add
AggregatedJaccardCoefficientmeasure with new postprocessing support in the measure/study pipeline. - Replace the old CLI entrypoint (
segmetrics.cli) with apython -m segmetricsmodule CLI and update docs/tests accordingly. - Modernize packaging/versioning (setuptools,
__version__,python_requires,install_requires) and update CI/docs configs.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/testsuite.py |
Adds AJC coverage, updates CLI invocation, and adjusts dataframe comparison logic + ISBI SEG test gating. |
tests/isbi_seg.py |
Switches ISBI SEG “official” helper to use bundled .7z and a provided password (no network download). |
tests/full-study-test.csv |
Updates golden CSV output to include AJC and rounded numeric formatting. |
setup.py |
Migrates to setuptools, loads version from segmetrics/version.py, adds runtime requirements, sets python_requires. |
segmetrics/version.py |
Introduces canonical __version__ (1.6.0). |
segmetrics/study.py |
Extends result handling to allow intermediate representations and applies postprocess() before aggregation/output. |
segmetrics/regional.py |
Fixes minor naming/docs, and adds AggregatedJaccardCoefficient implementation. |
segmetrics/measures.py |
Adds a centralized measures module with explicit __all__ exports. |
segmetrics/measure.py |
Extends measure protocol to support intermediate outputs via postprocess(). |
segmetrics/contour.py |
Switches ndimage import style and uses scipy.ndimage directly for dilation/distance transform. |
segmetrics/__main__.py |
Implements new module CLI (python -m segmetrics) and dynamic measure construction. |
segmetrics/__init__.py |
Refactors exports, adds __version__, preserves VERSION alias for backward compatibility. |
README.rst |
Updates Galaxy link wording and copyright year. |
LICENSE |
Updates copyright year. |
docs/source/usage.rst |
Updates CLI usage examples and help reference to python -m segmetrics. |
docs/source/index.rst |
Removes changelog from the toctree. |
docs/source/conf.py |
Updates project name and copyright year. |
docs/source/changelog.rst |
Removes the changelog page content (file deleted). |
.readthedocs.yaml |
Updates RTD build OS/python and points Sphinx to docs/source/conf.py. |
.gitignore |
Adds .venv and macOS metadata files. |
.github/workflows/testsuite.yml |
Updates action versions, attempts to pass ISBI password into tests, adds setup-install smoke test job. |
Comments suppressed due to low confidence (1)
segmetrics/main.py:90
- The CLI still uses
eval(measure_spec, ..., measures_dict)to instantiate measures. Even with restricted globals/locals, this is exploitable because callers can access__globals__via any provided class (e.g.,Dice.__init__.__globals__[...]) and regain__import__/builtins. Please replaceevalwith a safe parser (e.g., parse the string withastand only allowCall(Name(...))with whitelisted class names/kwargs), or implement an explicit mapping from allowed measure names to constructors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def compare_dataframe(test, study_df, expected_csv_filepath, tag=None, precision=3): | ||
| study_df = study_df.round(precision) | ||
| expected_csv_filepath = pathlib.Path(expected_csv_filepath) | ||
| actual_csv_filepath = f'{expected_csv_filepath}-out-{tag}' if tag else f'{expected_csv_filepath}-out' | ||
| failure_message = f'Obtained results written to: {actual_csv_filepath}' | ||
| try: | ||
| test.assertTrue(expected_csv_filepath.is_file(), failure_message) | ||
| expected_df = pd.read_csv(str(expected_csv_filepath), sep=',', keep_default_na=False) | ||
| test.assertTrue(study_df.round(3).equals(expected_df.round(3)), failure_message) | ||
| test.assertTrue(study_df.equals(expected_df), failure_message) |
There was a problem hiding this comment.
compare_dataframe now relies on DataFrame.equals() for float comparisons, which is an exact (bitwise) equality check. This is likely to be flaky across platforms/Python/pandas versions due to float parsing/rounding differences; additionally only study_df is rounded while expected_df is not. Consider using pandas.testing.assert_frame_equal with a tolerance (or round both dataframes before comparing) so the test is robust while still enforcing the intended precision.
After merging, also the requirements in https://github.com/bioconda/bioconda-recipes/blob/master/recipes/segmetrics/meta.yaml need to be updated.