https://github.com/deathbeds/nowidget
https://github.com/deathbeds/nowidget
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deathbeds/nowidget
- Owner: deathbeds
- License: mit
- Created: 2020-10-11T00:42:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-25T00:42:17.000Z (about 5 years ago)
- Last Synced: 2025-02-02T22:36:22.997Z (11 months ago)
- Language: Python
- Size: 2.21 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# `nowidget`
`nowidget` is a pure-python suite of interactive widgets based off of `traitlets` that do not explicitly require an javascript extensions.
import nowidget
probably the most useful `nowidget` object is `nowidget.Template`, it is `jinja2` display objects using `IPython`'s rich display. `nowidget.Template` is interactive and updates on cell exection or widget events. for example, in a notebook, the `nowidget.Template` will automatically discover the value of `cookies`.
cookies = 3
nowidget.Template("When you eat {{cookies}} cookies, you consume {{cookies*50}} calories.")
`nowidget.Template` will update when a cell is run. in the example above, if `cookie` were changed in a later cell then template will update. updating can be disabled with the `enabled` flag.
nowidget.Template("When you eat {{cookies}} cookies, you consume {{cookies*50}} calories.",
enabled=True
)
the `nowidget` extension adds some new traits to `IPython`'s interactive shell:
```ipython
%load_ext nowidget
```
1. `shell.test` is a primary default feature of the `nowidget` extension.
it provides formal `doctest and unittest`sto be executed with each cell execution. as an example.
def test_me():
function being with `"test_*"` are executed as tests.
shell = __import__("IPython").get_ipython()
if shell:
1. `shell.display_manager` manages updating `IPython` display objects when shell events occur.
3. `shell.trace` uses `monkeytype` to generate type stubs from the interactive computing experience.
turn tracing on and off with
shell.trace.on()
shell.trace.off()
or as a context manager
with shell.trace:
...
## developer tasks
a suite of tasks based off of `doit`.
def task_book():
build the docs using jupyter book.
return dict(actions=["jb build ."], file_dep=['_toc.yml'], targets=['_build/html'])
def task_pdf():
export a pdf version of the docs.
return dict(actions=["jb build . --builder pdfhtml"], file_dep=['_toc.yml'], targets=['_build/pdf/book.pdf'])