Skip to main content

Setup

First, you need to load the extension with:

%load_ext interactive_system_magic

Now, you can start using it.

Running programs

If you make a code cell with:

%prog echo blah

then it will run the program echo blah and put the result in the output:

blah

So far, this is just like the ! system call syntax. However, it also allows you to send input into a program by using it in cell mode:

%%prog bc --quiet
1+1

which will call bc --quiet (the --quiet part is to suppress the info on startup) and then pass in 1+1 on the stdin. bc will read this and output the result:

2

If you want to use this to demonstrate what the user would see if they ran this manually on a terminal, i.e. to include the input as well as the output, you can use the interactive -i flag:

%%prog -i bc --quiet
1+1

which gives:

1+1
2

Finally, if you want to be able to respond to prompts in the program’s output, then you can use special syntax to specify the prompt you are looking for, and the thing to respond to it with. In this case, we are calling the python program and waiting for its >>> prompt and then sending print("hello")

%%prog -i -d [] python -q
[>>> ]print("hello")

which gives:

>>> print("hello")
hello
>>>

Run Python scripts

As a shortcut, you can also run any Python scripts you have using the same interpreter that IPython or the Jupyter notebook is running with. If you make a Python script with (or use an existing one of course):

%%writefile foo.py

print("This is a script")

you can call it with:

%run_python_script foo.py

and get:

..code-block:

This is a script

This magic supports the same cell-mode commands and interactive options as %%prog.

Metadata

Release files for interactive-system-magic 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interactive-system-magic 0.2.0
File Size Uploaded Provenance
interactive-system-magic-0.2.0.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for interactive-system-magic 0.2.0
File Interpreter ABI Platform
interactive_system_magic-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / interactive-system-magic-0.2.0.tar.gz

Download URL interactive-system-magic-0.2.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
34fa2a0edb43c0785f01c7630f2661dd96b48a872c1047cfeedc4f839813c572
BLAKE2b-256 checksum
How to use checksums
c8df542c7cedc6dcc5624b285692bf7ee6a1979a4646760f84f6e1d50d551f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Linux/5.15.0-1014-azure

Release files / interactive_system_magic-0.2.0-py3-none-any.whl

Download URL interactive_system_magic-0.2.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa73310d079d9b7b9da92018c15fc4f341c7e498701317ae7fec57782a5d70ce
BLAKE2b-256 checksum
How to use checksums
6bb877964f2ab746055d1578811b0ae5468b254f5892411faf1b9e02ddf256d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Linux/5.15.0-1014-azure

Security for interactive-system-magic 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page