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

Apply SciPy-like repository suggestions #1910

Merged
merged 16 commits into from
Sep 17, 2024
Merged

Conversation

Zeitsperre
Copy link
Collaborator

@Zeitsperre Zeitsperre commented Sep 9, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGELOG.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Applies several linting suggestions adopted by the scipy community
  • Replaces isort with ruff formatting
  • Adds Markdown file formatting
  • Adds a few strongly encouraged ruff checks (bugbear, pyupgrade)
  • Adjust mypy checks

Does this PR introduce a breaking change?

Yes. isort is no longer required. Code checks are marginally stricter.

Other information:

https://github.com/scientific-python/repo-review

If we wanted to replace black as well, this is feasible with ruff, as it nearly replicates its functionality 1-to-1. To be revisited.

I've staged the python-check-blanket-noqa and python-check-blanket-type-ignore hooks since there are several instances where these won't work (numba-based code blocks). These statements should be followed up on at some point, likely when we address more things with mypy.

Repo checks:

(xclim) ~/git/xclim git:[repo-suggestions]
python -m repo_review
General:

 • Detected build backend: flit_core.buildapi                                                                                                                                                                                    
 • Detected license(s): Apache Software License                                                                                                                                                                                  

├── PY001 Has a pyproject.toml ✅
├── PY002 Has a README.(md|rst) file ✅
├── PY003 Has a LICENSE* file ✅
├── PY004 Has docs folder ✅
├── PY005 Has tests folder ✅
├── PY006 Has pre-commit config ✅
└── PY007 Supports an easy task runner (nox or tox) ✅

PyProject:
├── PP002 Has a proper build-system table ✅
├── PP003 Does not list wheel as a build-dep ✅
├── PP301 Has pytest in pyproject ✅
├── PP302 Sets a minimum pytest to at least 6 ✅
├── PP303 Sets the test paths ✅
├── PP304 Sets the log level in pytest ✅
├── PP305 Specifies xfail_strict ✅                                                                                                                                                                                                                       
├── PP306 Specifies strict config ✅
├── PP307 Specifies strict markers ✅
├── PP308 Specifies useful pytest summary ✅
└── PP309 Filter warnings specified ✅

GitHub Actions:
├── GH100 Has GitHub Actions config ✅
├── GH101 Has nice names ✅
├── GH102 Auto-cancel on repeated PRs ✅
├── GH103 At least one workflow with manual dispatch trigger ✅
├── GH104 Use unique names for upload-artifact ✅
├── GH200 Maintained by Dependabot ✅
├── GH210 Maintains the GitHub action versions with Dependabot ✅
├── GH211 Do not pin core actions as major versions ✅
└── GH212 Require GHA update grouping ✅

Pre-commit:
├── PC100 Has pre-commit-hooks ✅
├── PC110 Uses black or ruff-format ✅
├── PC111 Uses blacken-docs ❌
│   Must have https://github.com/adamchainz/blacken-docs in .pre-commit-config.yaml                                                                                                                                              
├── PC140 Uses a type checker ❌
│   Must have https://github.com/pre-commit/mirrors-mypy in .pre-commit-config.yaml                                                                                                                                              
├── PC160 Uses a spell checker ✅
├── PC170 Uses PyGrep hooks (only needed if rST present) ✅
├── PC180 Uses a markdown formatter ✅
├── PC190 Uses Ruff ✅
├── PC191 Ruff show fixes if fixes enabled ✅
└── PC901 Custom pre-commit CI message ✅

MyPy:
├── MY100 Uses MyPy (pyproject config) ✅
├── MY101 MyPy strict mode ✅
├── MY102 MyPy show_error_codes deprecated ✅
├── MY103 MyPy warn unreachable ✅
├── MY104 MyPy enables ignore-without-code ✅
├── MY105 MyPy enables redundant-expr ✅
└── MY106 MyPy enables truthy-bool ✅

Ruff:
├── RF001 Has Ruff config ✅
├── RF002 Target version must be set ✅
├── RF003 src directory doesn't need to be specified anymore (0.6+) [skipped]
├── RF101 Bugbear must be selected ✅
├── RF102 isort must be selected ✅
├── RF103 pyupgrade must be selected ✅
├── RF201 Avoid using deprecated config settings ✅
└── RF202 Use (new) lint config section ✅

Documentation:
├── RTD100 Uses ReadTheDocs (pyproject config) ✅
├── RTD101 You have to set the RTD version number to 2 ✅
├── RTD102 You have to set the RTD build image ✅
└── RTD103 You have to set the RTD python version ✅

@Zeitsperre Zeitsperre self-assigned this Sep 9, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added sdba Issues concerning the sdba submodule. CI Automation and Contiunous Integration API Interfacing and User Concerns docs Improvements to documenation labels Sep 9, 2024
@Zeitsperre Zeitsperre changed the title Apply Scipy-like repository suggestions Apply SciPy-like repository suggestions Sep 9, 2024
Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

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

Looks good!

@github-actions github-actions bot added approved Approved for additional tests indicators Climate indices and indicators labels Sep 10, 2024
@Zeitsperre Zeitsperre merged commit 167dfad into use-more-caching Sep 17, 2024
18 of 19 checks passed
@Zeitsperre Zeitsperre deleted the repo-suggestions branch September 17, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Interfacing and User Concerns approved Approved for additional tests CI Automation and Contiunous Integration docs Improvements to documenation indicators Climate indices and indicators sdba Issues concerning the sdba submodule.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants