neomatrix369 / nlp_profiler

A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Other
243 stars 37 forks source link

run nbqa-black #40

Closed MarcoGorelli closed 4 years ago

MarcoGorelli commented 4 years ago

Just an example of how to add nbqa to your workflow - this will apply the black autoformatter to your notebooks


To 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 (seenotebooksfolder) [ ]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.}

codecov[bot] commented 4 years ago

Codecov Report

Merging #40 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            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.

neomatrix369 commented 4 years ago

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?

neomatrix369 commented 4 years ago

I see this is happening via a GH action. Not via cli, good work! Thanx I'll merge it now

neomatrix369 commented 4 years ago

@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?

MarcoGorelli commented 4 years ago

Thanks @neomatrix369 !

If you want to run this locally, all you need to do is:

  1. install pre-commit: pip install pre-commit
  2. 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 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/
neomatrix369 commented 4 years ago

Thanks @neomatrix369 !

If you want to run this locally, all you need to do is:

  1. install pre-commit: pip install pre-commit
  2. 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 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 add

files: ^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 .