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

Replace custom magics parsing with something from ipython itself #8

Closed
ceball opened this issue Mar 13, 2018 · 1 comment · Fixed by #19
Closed

Replace custom magics parsing with something from ipython itself #8

ceball opened this issue Mar 13, 2018 · 1 comment · Fixed by #19

Comments

@ceball
Copy link
Member

ceball commented Mar 13, 2018

In nbsmoke/__init__.py: "# TODO: instead of this hacky custom magics handling, should find and use ipython's own"

@ceball
Copy link
Member Author

ceball commented Jun 14, 2019

This is done now (will be finished in #19). nbconvert first converts the notebook into python using ipython's ipython2python() (e.g. turning %%magic1 … into get_ipython().run_cell_magic("magic1", …, [rest of cell]), then nbsmoke re-runs ipython2python() again on [rest of cell]. So nbsmoke now just contains knowledge about what the get_ipython().run_cell_magic() and get_ipython().run_line_magic() calls look like - it doesn't have to detect magics/do any hacky line by line parsing.

ceball added a commit that referenced this issue Sep 14, 2019
Adds some basic missing features, and cleans up some internals.

Note: some ipython magic handling has changed (should be an improvement/more consistent behavior).

New features:

  * support for flake messages to ignore (by regex) - fixes #22
  
  * support for magics blacklist (i.e. magics that if present cause a flake) - fixes #21

  * added support for script & capture cell magics (mainly as a demo) - fixes #24

  * increased the number of builtin magics that will be silently ignored (as they don't interact with the python process), e.g. bookmark, edit, who, etc - fixes #24

  * lint failures can be set to be warnings only (potentially useful for systems that report warnings)

Internal changes:

  * Separated out parts into modules:
  
      * the original/basic functionality (checking notebooks run without errors)
  
      * "verifying" (copied from datashader, which was copied from bokeh?)
      
      * lint/flake checking (using pyflakes)
  
      * magics handling for flakes
  
  * Improve lint/magics debugging by storing various intermediate files.
  
  * Simplify lint checking of magics, making behavior more consistent.
  
  * Replaced custom/hacky magics parsing with stuff from ipython itself (fixes #8)

  * MAGICS_TO_IGNORE and SIMPLE_MAGICS: separated cell and line magics (internal change to support more magics) - fixes #23 

  * Improved unit test coverage (think all code is now covered except "verify").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant