pipescript 0.0.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pipescript/__init__.py ADDED
@@ -0,0 +1,47 @@
1
+ """
2
+ pipescript: powerful pipeline syntax for IPython and Jupyter.
3
+ Just run `%load_ext pipescript` to begin using pipe operators, placeholders, and more.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from IPython.core.interactiveshell import InteractiveShell
9
+
10
+ from . import _version # noqa: E402
11
+ from .completion_patch import patch_completer, unpatch_completer
12
+
13
+ __version__ = _version.get_versions()["version"]
14
+
15
+
16
+ def load_ipython_extension(shell: InteractiveShell) -> None:
17
+ from ipyflow.shell.interactiveshell import IPyflowInteractiveShell
18
+
19
+ from pipescript.macro_tracer import MacroTracer
20
+ from pipescript.pipeline_tracer import PipelineTracer
21
+
22
+ if not isinstance(shell, IPyflowInteractiveShell):
23
+ shell.run_line_magic("load_ext", "ipyflow.shell")
24
+ shell.run_line_magic("flow", "deregister all")
25
+ assert isinstance(shell, IPyflowInteractiveShell)
26
+ shell.run_line_magic(
27
+ "flow", f"register {PipelineTracer.__module__}.{PipelineTracer.__name__}"
28
+ )
29
+ shell.run_line_magic(
30
+ "flow",
31
+ f"register {MacroTracer.__module__}.{MacroTracer.__name__}",
32
+ )
33
+ patch_completer(shell.Completer)
34
+
35
+
36
+ def unload_ipython_extension(shell: InteractiveShell) -> None:
37
+ from pipescript.macro_tracer import MacroTracer
38
+ from pipescript.pipeline_tracer import PipelineTracer
39
+
40
+ unpatch_completer(shell.Completer)
41
+ shell.run_line_magic(
42
+ "flow",
43
+ f"deregister {MacroTracer.__module__}.{MacroTracer.__name__}",
44
+ )
45
+ shell.run_line_magic(
46
+ "flow", f"deregister {PipelineTracer.__module__}.{PipelineTracer.__name__}"
47
+ )