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

ci: Use jupyter-black pre-commit hook over nbqa-black #1598

Merged
merged 3 commits into from Sep 7, 2021

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Sep 7, 2021

Description

Resolves #1594

Wit the addition of the jupyter-black hook by @MarcoGorelli (c.f. psf/black#2357) in black v21.8b0 the nbqa-black hook has essentially been contributed to Black and now nbqa-black is no longer needed. This has the additional advantage of being tied to the Black version directly and doesn't require updating the Black version as an additional_dependencies of nbqa-black and also that the black hook id is now also contained in black-jupyter.

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Use jupyter-black pre-commit hook id from Black
   - black-jupyter will run on Python and pyi files, so it replaces the black hook id as well
* Remove nbqa-black pre-commit hook from nbQA
   - Marco Gorelli essentially contributed nbqa-black to Black in the form of jupyter-black

@matthewfeickert matthewfeickert added the CI CI systems, GitHub Actions label Sep 7, 2021
@matthewfeickert matthewfeickert self-assigned this Sep 7, 2021
@matthewfeickert matthewfeickert added this to In progress in v0.6.4 via automation Sep 7, 2021
@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #1598 (226f704) into master (347fd3a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1598   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          63       63           
  Lines        4050     4050           
  Branches      576      576           
=======================================
  Hits         3957     3957           
  Misses         54       54           
  Partials       39       39           
Flag Coverage Δ
contrib 25.43% <ø> (ø)
unittests 97.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 347fd3a...226f704. Read the comment docs.

Comment on lines 37 to 38
- id: black
- id: black-jupyter
Copy link
Contributor

Choose a reason for hiding this comment

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

black-jupyter will run on Python and pyi files as well, you probably only need that one

Copy link
Member Author

Choose a reason for hiding this comment

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

That's awesome. :)

@matthewfeickert matthewfeickert merged commit 4f18dbd into master Sep 7, 2021
@matthewfeickert matthewfeickert deleted the ci/update-to-black-jupyter-hook branch September 7, 2021 15:20
v0.6.4 automation moved this from In progress to Done Sep 7, 2021
matthewfeickert added a commit that referenced this pull request Feb 15, 2022
* Remove .coveragerc and consolidate pytest options to pyproject.toml.
* Apply 'configuring pytest' recommendations for pytest from Scikit-HEP
(c.f. https://scikit-hep.org/developer/pytest#configuring-pytest ).
   - '-ra' includes a report after pytest runs with a summary on all tests
     except those that passed. From 'pytest --help':
     > -r chars: show extra test summary info as specified by chars: (f)ailed,
     > (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output,
     > (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default
     > (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE').
   - '--showlocal' prints locals in tracebacks.
   - '--strict-markers' will complain if you use an unspecified fixture.
   - '--strict-config' will raise an error if there is a mistake in the pytest config.
   - 'log_cli_level = "info"' reports INFO and above log messages on a failure.
   - 'filterwarnings = ["error"]' sets all warnings to be errors and allows for
     some warnings to be ignored with -W warn control syntax.
     (c.f. https://docs.python.org/dev/using/cmdline.html#cmdoption-W )
* Remove `tests/__init__.py` as no reason to make the tests directory importable.
* Remove '-r sx' from pytest calls in CI jobs as pyproject.toml now applies '-ra'.
* Use 'with pytest.warns' to assert expected warnings in tests.
(c.f. https://docs.pytest.org/en/7.0.x/how-to/capture-warnings.html#warns )
* Override error on filterwarnings for the 'minimum supported dependencies' GHA workflow
as it is testing for the oldest releases that work with the latest API, not the oldest
releases that are warning free.
* Remove unused nbQA options for black from pyproject.toml.
   - Amends PR #1598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI CI systems, GitHub Actions
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Use black Jupyter hook for Jupyter notebooks over nbqa-black
2 participants