Skip to main content

A versatile Jupyter cell magic that allows running a cell with any command line utility.

Project description

AnyCmd

    Do the provided cell magics not quite fit your needs? AnyCmd is a versatile Jupyter cell magic that allows you to run a cell with any command line utility. Simply specify the command you want to run as arguments after the magic. Access the contents of the cell as a file using the literal string "%FILE" or "%FILE.someExtension"
    By default, the command specified after the magic will be run from a temporary working directory. However, you may use -d/--dir to chdir into a custom directory before running the cell command. Use "-d ." to run it in the current working directory.
    Use -i/--inplace if you would like to write the cell contents temp files in the specified working directory, rather than the temporary directory (has no effect without --dir). This may help with compilers that reference libraries in the same directory, for instance.
    Use "-p/--print" to print command output live, instead of outputting to the cell. This may improve readability, and make it easier to debug long-running commands.
     --nonewline prevents adding a newline character before the cell contents in the temporary file to offset the first line taken up by the cell magic in order to fix line numbers from error messages. [Changed in 0.1.4: this is now the default behavior and --lines was removed].

You may install this package via PyPi:

!pip install anycmd-jupyter-magic
%load_ext anycmd

Example (compiling and running c++):


%%any -p -l -- clang++ -O3 %FILE.cpp -o file && ./file

#include <iostream>  
using namespace std;  
int main(int argc, const char** argv) {  
  cout << "Hello World\n";  
}  

Result:
Hello World

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anycmd_jupyter_magic-0.1.4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anycmd_jupyter_magic-0.1.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file anycmd_jupyter_magic-0.1.4.tar.gz.

File metadata

  • Download URL: anycmd_jupyter_magic-0.1.4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for anycmd_jupyter_magic-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e1887d46f8ba111503b4d5fb7080573ce86a76bcd7bdf2e9875164d16b303dc6
MD5 62681cc5ee288e82abab45518d1fe155
BLAKE2b-256 c7c223f1fda47d20feb8aa6c17767f44abbd7c008cafe094af27adf130936228

See more details on using hashes here.

File details

Details for the file anycmd_jupyter_magic-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for anycmd_jupyter_magic-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a2f8c4688150bf7595e751c1cca5e9b91c8a3c479f547e6d95ee7badb37faf89
MD5 548d8a92c19f3f44ac3e48385adaf1ad
BLAKE2b-256 fca6ba01ecf28a9db62a473391f345929043bb6a9255eeabee4557a6b68d5965

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page