question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

running `nbqa` from command-line

See original GitHub issue

throws an exception:

Traceback (most recent call last):
  File "/Users/amichayoren/venv/algo/lib/python3.8/site-packages/nbqa/cmdline.py", line 127, in parse_args
    args, cmd_args = parser.parse_known_args(raw_args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/argparse.py", line 1800, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/argparse.py", line 2034, in _parse_known_args
    self.error(_('the following arguments are required: %s') %
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/argparse.py", line 2520, in error
    self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/argparse.py", line 2507, in exit
    _sys.exit(status)
SystemExit: 2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MarcoGorellicommented, Nov 1, 2020

That’s a good point, maybe the traceback is too long and not helpful…reopening then, thanks for the feedback!

1reaction
MarcoGorellicommented, Nov 5, 2020

The latest release (0.4.0) shows

$ nbqa
usage: nbqa <code quality tool> <notebook or directory> <nbqa options> <code quality tool arguments>

Please specify:
- 1) a code quality tool (e.g. `black`, `pyupgrade`, `flake`, ...)
- 2) some notebooks (or, if supported by the tool, directories)
- 3) (optional) flags for nbqa (e.g. `--nbqa-mutate`)
- 4) (optional) flags for code quality tool (e.g. `--line-length` for `black`)

Examples:
    nbqa flake8 notebook.ipynb
    nbqa black notebook.ipynb --line-length=96
    nbqa pyupgrade notebook_1.ipynb notebook_2.ipynb

Mutation: to let `nbqa` modify your notebook(s), also pass `--nbqa-mutate`, e.g.:
    nbqa black notebook.ipynb --nbqa-mutate

See https://nbqa.readthedocs.io/en/latest/index.html for more details on how to run `nbqa`.
nbqa: error: the following arguments are required: command, root_dirs

along with several other improvements.

Next big to-dos are:

  • automatically detect when cell magics can be skipped, so we can extend support to custom cell magics defined via %load_ext
  • add --nbqa-diff, which would make demoing the tool a whole lot easier

Daniel I know you’re keen on the latter feature, we’ll let you know when it’s available, and now that some other issues have been resolved, the path is clear to do start implementing it!

Thanks all for your help in improving nbqa!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command-line examples — nbQA 1.5.3 documentation
Run your docstring tests with doctest: $ nbqa doctest my_notebook.ipynb **************** ...
Read more >
Short Introduction to nbqa - Calmcode
In this short introduction we're doing to demonstrate how to use nbqa. ... To run it on notebooks, you can prepend it with...
Read more >
nbqa - PyPI
Run any standard Python code quality tool on a Jupyter Notebook.
Read more >
Formatters — Using Automation To Support Quality Assured ...
Example difference output for nbqa black formatter. Running the command without the --nbqa-diff flag will cause the code cell in the notebook to...
Read more >
NbQA: Run Isort, Pyupgrade, Mypy,... on Jupyter Notebook
NbQA : Run isort, pyupgrade, mypy, pylint, flake8, mdformat, black, blacken-docs, and more on Jupyter Notebooks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found