Closed MarcoGorelli closed 4 years ago
Merging #40 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #40 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 358 358
Branches 51 51
=========================================
Hits 358 358
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 28ecc21...3e1a456. Read the comment docs.
Do we need to add black
and other dependencies to the respective requirements-*.txt
files? Is this one-off formatting or will it auto-trigger for the notebooks each time?
I see this is happening via a GH action. Not via cli, good work! Thanx I'll merge it now
@MarcoGorelli I have a question, what additional config and docs should I add to the repo for contributors and myself to use nbqa
locally.
Also is it possible for the pre-commit to run only for changes inside the notebooks
folder?
Thanks @neomatrix369 !
If you want to run this locally, all you need to do is:
pre-commit
: pip install pre-commit
pre-commit
: pre-commit install
then, any time you do a commit, nbqa-black
will run on the notebooks you've staged. You can also run it manually with
pre-commit run --all
By default, this hook will only run on Jupyter Notebooks. If you only want to limit it to run on Jupyter Notebooks from notebooks
, you can change .pre-commit-config.yaml
to be
repos:
- repo: https://www.github.com/nbQA-dev/nbQA
rev: pre-commit-hooks
hooks:
- id: nbqa-black
files: ^notebooks/
Thanks @neomatrix369 !
If you want to run this locally, all you need to do is:
- install
pre-commit
:pip install pre-commit
- enable
pre-commit
:pre-commit install
then, any time you do a commit,
nbqa-black
will run on the notebooks you've staged. You can also run it manually withpre-commit run --all
By default, this hook will only run on Jupyter Notebooks. If you only want to limit it to run on Jupyter Notebooks from
notebooks
, you can addfiles: ^notebooks/
to
.pre-commit-config.yaml
Awesome, thanks, the next step is to apply a couple of the code formatting and convention checking plugins to the library i.e. black
and
Just an example of how to add nbqa to your workflow - this will apply the
black
autoformatter to your notebooksTo be able to merge a pull request, there are a few checks:
TL;DR
[ ] clear title and description to the Pull Request has been provided [ ] you have read the Contributing doc and Developer Guide [ ] the pull request should pass the tests (
./test-coverage "tests slow-tests"``) - this will be visible via the Code coverage report and CI/CD task on the Pull Request [ ] you have performed some kind of smoke test by running your changes in an isolated environment i.e. Docker container, Google Colab, Kaggle, etc... [ ] the notebooks are updated (see
notebooksfolder) [ ]
CHANGELOG.md` has been updated (please follow the existing format)Goal or purpose of the PR
{ Short description outlining what the Pull Request does, and reference the related GitHub issue(s):
Changes implemented in the PR
{ Please explain what you implemented, why your changes are the best way to achieve the goal(s) above. Also please describe a high-level flow of the implementation and if necessary add some code-level details. If possible provide examples, screen-shots or references to other resources.
This would allow the reviewer to understand your intentions in the code much better.}