Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Repo-Review rules #2075

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Aug 10, 2024

https://learn.scientific-python.org/development/guides/repo-review/?repo=zarr-developers%2Fzarr-python&branch=v3

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

Comment on lines +43 to +45
- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review
- repo: https://github.com/scientific-python/repo-review
rev: 0.11
hooks:
- id: repo-review

I think better to use the repo-review repository itself?

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Aug 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand sp-repo-review/cookie should be used to evaluate repos against the guidelines in the Scientific Python Library Development Guide. The repo-review framework has sp-repo-review and validate-pyproject plugins.

The repo-review documentation suggests we should directly use the plugin we're interested in:

Pre-commit

You can also use this from pre-commit:

- repo: https://github.com/scientific-python/repo-review
  rev: <version>
  hooks:
    - id: repo-review
      additional_dependencies: ["repo-review[cli]", "sp-repo-review==<version>"]

(Insert the current version above, and ideally pin the plugin version, as long as you have a way to auto-update it.)

Though check your favorite plugin, which might directly support running from pre-commit, and then pre-commit’s pinning system will pin on your plugin, rather than the framework (repo-review).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that example they use https://github.com/scientific-python/repo-review instead of https://github.com/scientific-python/cookie, so I think it's best to change it from cookie to repo-review?

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on who applied the relevant commit. Let me investigate.

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It goes on with:

⚠ Warning

This currently has a couple of weird quirks. Pre-commit will not report the correct version for repo-review (it’s always 0.1), and it will lose the cli requirements if you add additional dependencies (which you always do, it’s a plugin framework, so it needs plugins). To counter this, plugins can avoid lower bounds and you can manually add repo-review[cli], as seen above, or plugins can provide their own hooks (like sp-repo-review also does).

In the future, a mirror will be set up so that we can avoid these issues.

pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks 👍 - just another question about which repository we should be running the pre-commit hook from

@dstansby dstansby merged commit de075de into zarr-developers:v3 Sep 5, 2024
26 checks passed
@DimitriPapadopoulos DimitriPapadopoulos deleted the repo-review branch September 6, 2024 09:35
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.

2 participants