https://github.com/ipyflow/ipyflow Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} ipyflow / ipyflow Public * Notifications * Fork 16 * Star 752 Next-generation IPython kernel with reactivity, execution suggestions, syntax extensions, and more. License BSD-3-Clause license 752 stars 16 forks Star Notifications * Code * Issues 17 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights ipyflow/ipyflow This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 6 branches 128 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/i] Use Git or checkout with SVN using the web URL. [gh repo clone ipyflo] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @smacke smacke [no ci] bump version ... 3791bb8 May 10, 2023 [no ci] bump version 3791bb8 Git stats * 1,723 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows binder core frontend img notebooks scripts .gitattributes .gitignore CODE_OF_CONDUCT.md CONTRIBUTORS.md HISTORY.rst LICENSE.txt MANIFEST.in Makefile README.md requirements.txt requirements.txt.in setup.cfg setup.py versioneer.py View code [ ] IPyflow About Features Execution Suggestions Reactivity Syntax Extensions Integration with ipywidgets State API Quick Start Citing License README.md IPyflow [badge] Checked with mypy Code style: black License: BSD3 [6874747073] [6874747073] Binder About ipyflow is a next-generation Python kernel for Jupyter and other notebook interfaces that tracks dataflow relationships between symbols and cells during a given interactive session, thereby making it easier to reason about notebook state. If you'd like to skip the elevator pitch and skip straight to installation / activation instructions, jump to quick start below; otherwise, keep reading to learn about ipyflow's features. Features ipyflow ships with classic Jupyter + JupyterLab extensions that provide the following user-facing features. Execution Suggestions To keep the execution state consistent with the code in cells, rerun the turquoise-highlighted cells, and avoid the red-highlighted cells: [suggestion] A turquoise-highlighted input with red-highlighted output just means that the output may be out-of-sync. Reactivity Do you trust me? Good. It's time to free yourself of the burden of manual re-execution. Use ctrl+shift+enter (on Mac, cmd+shift+enter also works) to execute a cell and its (recursive) dependencies reactively: [reactive-h] You can also run the magic command %flow mode reactive in any cell to enable reactivity as the default execution mode: [reactivity] Disable by running %flow mode normal. Syntax Extensions Prefixing a symbol with $ in a load context will cause the referencing cell to re-execute itself, whenever the aforementioned symbol is updated (regardless of execution mode): [syntax-ext] You can also use the $ syntax in store contexts, which triggers cells that reference the corresponding symbol to re-execute, regardless of whether the reference is similarly $-prefixed: [syntax-ext] Finally, you can also prefix with $$ to trigger a cascading reactive update to all dependencies in the chain, recursively: [syntax-ext] Integration with ipywidgets ipyflow's reactive execution engine, as well as its APIs (see "State API" below) are fully compatible with ipywidgets, allowing cells to respond to slider changes, button clicks, and other events: [ipywidgets] This functionality can be paired with other extensions like stickyland to build fully reactive dashboards on top of JupyterLab + ipyflow. State API ipyflow must understand the underlying execution state at a deep level in order to provide its features. It exposes an API for interacting with some of this state, including a code function for obtaining the code necessary to reconstruct some symbol: # Cell 1 from ipyflow import code # Cell 2 x = 0 # Cell 3 y = x + 1 # Cell 4 code(y) # Output: """ # Cell 2 x = 0 # Cell 3 y = x + 1 """ You can also see the cell (1-indexed) and statement (0-indexed) of when a symbol was last updated with the timestamp function: from ipyflow import timestamp timestamp(y) # Timestamp(cell_num=3, stmt_num=0) To see dependencies and dependents of a particular symbol, use the deps and users fuctions, respectively: from ipyflow import deps, users deps(y) # [] users(x) # [] If you want to elevate a symbol to the representation used internally by ipyflow, use the lift function (at your own risk, of course): from ipyflow import lift y_sym = lift(y) y_sym.timestamp # Timestamp(cell_num=3, stmt_num=0) Finally, ipyflow also comes with some rudimentary support for watchpoints: # Cell 1 from ipyflow import watchpoints def watchpoint(obj, position, symbol_name): if obj <= 42: return cell, line = position print(f"{symbol_name} = {obj} exceeds 42 at {cell=}, {line=}") # Cell 2 y = 14 watchpoints(y).add(watchpoint) # Cell 3 y += 10 # Cell 4 y += 20 # y = 44 exceeds 42 at cell=4, line=1 Quick Start To install, run: pip install ipyflow To run an ipyflow kernel in JupyterLab, select "Python 3 (ipyflow)" from the list of available kernels in the Launcher tab. For classic Jupyter, similarly select "Python 3 (ipyflow)" from the list of notebook types in the "New" dropdown dialogue. JupyterLab Entrypoint: Classic Jupyter Entrypoint: [ipyflow-la] [ipyflow-no] Similarly, you can switch to / from ipyflow from an existing notebook by navigating to the "Change kernel" file menu item in either JupyterLab or classic Jupyter: JupyterLab Kernel Switcher: Classic Jupyter Kernel Switcher: [change-ker] [change-ker] Citing ipyflow started its life under the name nbsafety, which provided the initial suggestions and slicing functionality. For the execution suggestions: @article{macke2021fine, title={Fine-grained lineage for safer notebook interactions}, author={Macke, Stephen and Gong, Hongpu and Lee, Doris Jung-Lin and Head, Andrew and Xin, Doris and Parameswaran, Aditya}, journal={Proceedings of the VLDB Endowment}, volume={14}, number={6}, pages={1093--1101}, year={2021}, publisher={VLDB Endowment} } For the dynamic slicer (used for reactivity and for the code function, for example): @article{shankar2022bolt, title={Bolt-on, Compact, and Rapid Program Slicing for Notebooks}, author={Shankar, Shreya and Macke, Stephen and Chasins, Andrew and Head, Andrew and Parameswaran, Aditya}, journal={Proceedings of the VLDB Endowment}, volume={15}, number={13}, pages={4038--4047}, year={2022}, publisher={VLDB Endowment} } We don't have a paper written yet for the syntax extensions that implement the reactive algebra, but in the mean time, you can cite the ipyflow repo directly for that and anything else not covered by the previous publications: @misc{ipyflow, title = {{IPyflow: A Next-Generation, Dataflow-Aware IPython Kernel}}, howpublished = {\url{https://github.com/ipyflow/ipyflow}}, year = {2022}, } License Code in this project licensed under the BSD-3-Clause License. About Next-generation IPython kernel with reactivity, execution suggestions, syntax extensions, and more. Topics python jupyter static-code-analysis static-analysis highlighting pypi tracing developer-tools dataflow notebooks jupyter-notebooks lineage nbsafety ipyflow Resources Readme License BSD-3-Clause license Code of conduct Code of conduct Stars 752 stars Watchers 5 watching Forks 16 forks Report repository Releases 128 tags Packages 0 No packages published Contributors 5 * @smacke * @ruiduoray * @dependabot[bot] * @shreyashankar * @allcontributors[bot] Languages * Python 94.1% * TypeScript 4.2% * Shell 0.5% * CSS 0.5% * JavaScript 0.3% * Jupyter Notebook 0.2% * Makefile 0.2% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.