Skip to main content

dpaste_magic

Magic function that pushes or pulls code snippets out of pastebins. dpaste.org is currently supported.

Pushing code & cells

  %dpaste answer = 42
  https://dpaste.org/WXYZ

pushes line content & print the dpaste url.

  %%dpaste
  answer = 42
  https://dpaste.org/WXYZ

pushes cell content & print the dpaste url.

  %%dpaste {-1x -1h -1d -1w}
  answer = 42
  https://dpaste.org/WXYZ

returns a dpaste url with expires duration:

  • -1x: just for one read
  • -1h: one hour (default)
  • -1d: one day
  • -1w: one week

These are the supported expiration time supported by dpaste.org.

Options:

  • -o: return URL as value (for storage in a variable)
  • -s: silent mode (URL not printed)

my_url = %dpaste -o answer = 42 push code on line, prints & stores url in my_url variable.

my_url = %dpaste -o -s answer = 42 push code on line & stores url in my_url variable (silent mode, no print).

Getting back the paste

  %getdpaste WXYZ

retrieves snippet from WXYZ dpaste hash or URL and changes cell to:

  answer = 42
  %getdpaste -u WXYZ

add retrieved URL as a Python comment in first line:

  #https://dpaste.org/WXYZ/raw

  answer = 42

With %dpaste -g get option:

  %dpaste -g WXYZ

retrieves snippet from WXYZ dpaste hash or URL and changes cell to:

  answer = 42

Installation

Use: pip install dpaste-magic to install the magic command.

First load the magic in a cell:

%load_ext dpaste_magic

and then use the function in your cell to dpaste its content.

%%dpaste, %dpaste or %getdpaste.

TO DO

  • increase tests range
  • code unload function

Metadata

Release files for dpaste-magic 0.3.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 dpaste-magic 0.3.0
File Size Uploaded
dpaste_magic-0.3.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dpaste-magic 0.3.0
File Interpreter ABI Platform
dpaste_magic-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / dpaste_magic-0.3.0.tar.gz

Download URL dpaste_magic-0.3.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bc9597a92784c6094eaa75ee29089012441c4cc0459c2b49e52e348306b15f03
BLAKE2b-256 checksum
How to use checksums
db563c0327ca4cc2b82fcf3b743ba3fc9470c7477626fed56f155b139c583a2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / dpaste_magic-0.3.0-py3-none-any.whl

Download URL dpaste_magic-0.3.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da48c9d895dcb2dca3194364358592156b4cf6bbc4356c1203c68ddfca96d826
BLAKE2b-256 checksum
How to use checksums
fdd4a8c5c130b47a6f762054cf40277a2fd67a25836c887d4c4278a19e699a3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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