Codex modernize packaging ci#1
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the project’s packaging and CI setup by migrating metadata to pyproject.toml, adding a GitHub Actions workflow, and introducing a proper installed CLI entrypoint, alongside new pytest coverage for the CLI and core Classifications behavior.
Changes:
- Replace legacy
setup.pypackaging with a PEP 621pyproject.toml(deps, dev extras, console script) and update README install/usage docs. - Add a
pyniverse.climodule and wire both the console script and existingbin/wrapper to it. - Add CI (black/ruff/pytest) and introduce new tests plus Matplotlib test configuration.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_cli.py |
Adds CLI integration tests (expected PDFs + private project flag behavior). |
tests/test_classifications.py |
Adds unit tests for input validation, filtering, and error handling. |
tests/conftest.py |
Configures Matplotlib backend/config dir for test execution. |
setup.py |
Removes legacy setuptools configuration in favor of pyproject.toml. |
README.md |
Updates installation and CLI usage instructions for the new packaging/entrypoint. |
pyproject.toml |
Defines build system, dependencies, dev extras, lint/format/test tool config, and console script. |
pyniverse/ZooniverseClassifications.py |
Modernizes core class behavior (validation, filtering, plotting, error handling). |
pyniverse/cli.py |
Introduces the new argparse-based CLI implementation. |
pyniverse/__init__.py |
Exposes Classifications via __all__. |
bin/zooniverse-classifications-analyse.py |
Converts legacy script into a thin wrapper around pyniverse.cli:main. |
.gitignore |
Ignores Matplotlib config dir created during tests. |
.github/workflows/ci.yml |
Adds multi-Python-version CI running black, ruff, and pytest. |
Comments suppressed due to low confidence (1)
pyniverse/ZooniverseClassifications.py:245
plot_user_classification_distribution()saves a Matplotlib figure but never closes it. In CLI/test runs this can accumulate open figures and memory (especially when called repeatedly).
axes1.set_xlabel("cumulative contributors")
axes1.set_ylabel("cumulative classifications")
fig.savefig(stem + file_extension, transparent=True)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
140
to
158
| @@ -154,29 +143,34 @@ def __repr__(self): | |||
| top_10 = ( | |||
| 100 * self.users.classifications[:10].sum() | |||
| ) / self.total_classifications | |||
| line += "%30s %7.1f %%\n" % ("Top 10 users have done:", top_10) | |||
| line += f"{'Top 10 users have done:':>30} {top_10:7.1f} %\n" | |||
| top_100 = ( | |||
| 100 * self.users.classifications[:100].sum() | |||
| ) / self.total_classifications | |||
| line += "%30s %7.1f %%\n" % ("Top 100 users have done:", top_100) | |||
| line += f"{'Top 100 users have done:':>30} {top_100:7.1f} %\n" | |||
| top_1000 = ( | |||
| 100 * self.users.classifications[:1000].sum() | |||
| ) / self.total_classifications | |||
| line += "%30s %7.1f %%\n" % ("Top 1000 users have done:", top_1000) | |||
| line += f"{'Top 1000 users have done:':>30} {top_1000:7.1f} %\n" | |||
|
|
|||
| # sort the table so the top users are last | |||
| # restore descending order after reporting headline numbers | |||
| self.users.sort_values(["classifications"], ascending=False, inplace=True) | |||
|
|
|||
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
No description provided.