1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-22 02:54:25 +01:00

Add instructions

This commit is contained in:
Satwik 2019-12-21 19:39:49 +05:30
parent 12b2fc008e
commit f914194a87
3 changed files with 599 additions and 569 deletions

View File

@ -34,7 +34,7 @@ STATEMENT_PREFIXES = ["...", ">>> ", "$ "]
HOSTED_NOTEBOOK_INSTRUCTIONS = """ HOSTED_NOTEBOOK_INSTRUCTIONS = """
# Hosted notebook instructions ## Hosted notebook instructions
This is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because, This is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because,
- they either require a version of Python that's not supported in the hosted runtime. - they either require a version of Python that's not supported in the hosted runtime.
@ -48,7 +48,7 @@ The expected outputs are already present in collapsed cells following the code c
# Prints out Python version here. # Prints out Python version here.
``` ```
That being said, most of tbe examples do work as expected. If you face any trouble, feel free to consult the original content on wtfpython and create an issue in the repo. Have fun! That being said, most of the examples do work as expected. If you face any trouble, feel free to consult the original content on wtfpython and create an issue in the repo. Have fun!
--- ---
""" """
@ -350,4 +350,5 @@ with open(fpath, 'r+', encoding="utf-8") as f:
except StopIteration as e: except StopIteration as e:
#pprint.pprint(result, indent=2) #pprint.pprint(result, indent=2)
pre_stuff.append(HOSTED_NOTEBOOK_INSTRUCTIONS) pre_stuff.append(HOSTED_NOTEBOOK_INSTRUCTIONS)
result.sort(key = lambda x: x["read_only"])
convert_to_notebook(pre_stuff, result, post_stuff) convert_to_notebook(pre_stuff, result, post_stuff)

26
irrelevant/notebook_instructions.md vendored Normal file
View File

@ -0,0 +1,26 @@
## Generating the notebook
- Expand the relative links in README.md to absolute ones
- Remove the TOC in README.md (because Google colab generates its own anyway)
- Reorder the examples, so that the ones that work are upfront.
- Run the `notebook_generator.py`, it will generate a notebook named `wtf.ipynb`
- Revert the README.md changes (optional)
# Hosted notebook instructions
This is just an experimental attempt of browsing wtfpython through jupyter notebooks. Some examples are read-only because,
- they either require a version of Python that's not supported in the hosted runtime.
- or they can't be reproduced in the notebook envrinonment.
The expected outputs are already present in collapsed cells following the code cells. The Google colab provides Python2 (2.7) and Python3 (3.6, default) runtimes. You can switch among these for Python2 specific examples. For examples specific to other minor versions, you can simply refer to collapsed outputs (it's not possible to control the minor version in hosted notebooks as of now). You can check the active version using
```py
>>> import sys
>>> sys.version
# Prints out Python version here.
```
That being said, most of tbe examples do work as expected. If you face any trouble, feel free to consult the original content on wtfpython and create an issue in the repo. Have fun!

1135
irrelevant/wtf.ipynb vendored

File diff suppressed because it is too large Load Diff