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
jupyter notebooks from examples #1778
Conversation
Hello @arokem, Thank you for updating !
Comment last updated at 2019-05-08 19:43:26 UTC |
Still needs some more cleaning up. The rendered notebooks will include (for example) figure blocks from the original rst and other crufy, so we need to process the cells even further. Will follow up with that, before marking this as "ready for review" |
940ee97
to
046527b
Compare
cells.append(textcells[i]) | ||
cells.append(codecells[i]) | ||
except: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just pass
is not best practice... :)
""" | ||
|
||
file_path = os.path.join(directory, fname) | ||
f = open(file_path, "r") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather use with
statement
with open(file_path, 'r') as fp:
fdata = fp.read()
"""Get the valid examples to be converted""" | ||
flist_name = pjoin(os.path.dirname(os.getcwd()), 'doc', 'examples', | ||
'valid_examples.txt') | ||
flist = open(flist_name, "r") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, rather use with
statement
for example in validated_examples: | ||
fullpath = pjoin(EG_SRC_DIR, example) | ||
if not example.endswith(".py"): | ||
print("%s not a python file, skipping." % example) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not using logging
module?
Now we just need to clean things up in the rst => ipynb conversion.
046527b
to
a81705b
Compare
This continues the work in #1022 and supersedes it.