Skip to main content

Elvis has left the building - A REPL template engine that remembers

Project description

Elvis Has Left the Building

Generate Python code strings to recreate objects with their current state. Perfect for:

  • Saving exact object recreation code
  • Working in terminals where copy-paste is painful
  • Quick templating of repetitive code

Some say it's pointless. Some say it's brilliant. Elvis doesn't care either way - Elvis has already left the building.

Install

pip install elvis-repl

Usage

from elvis_repl import elvis

# Generate object creation code
elvis("df = pd.read_csv(\"{file}\", skiprows={skip})", 
      file="data.csv", skip=2)
# Output: df = pd.read_csv("data.csv", skiprows=2)

# Reuse with changed variables
elvis._vars['skip'] = 3
elvis("df = pd.read_csv(\"{file}\", skiprows={skip})")

# Generate multiple similar objects
for i in range(2):
    elvis("obj_{id} = MyClass(\"{name}\")", id=i, name=f"instance_{i}")

Features

  • Remember variables between templates
  • Preview code before execution with .show()
  • Execute when ready with .run()
  • Works in both Jupyter and CLI

Remember: When your session crashes, Elvis makes sure you know how to rebuild everything exactly as it was.

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

elvis_repl-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

elvis_repl-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file elvis_repl-0.1.1.tar.gz.

File metadata

  • Download URL: elvis_repl-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0

File hashes

Hashes for elvis_repl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 34035ed43982c181f69ed3c2a8d94e1c6a6a476747d65704daec5ee167cdb1b4
MD5 1afa645675174dcc009673556915b267
BLAKE2b-256 7cc224a30103f536584932dec0dd9e83a777872d9b8d30e0c6a2e4bcd795f658

See more details on using hashes here.

File details

Details for the file elvis_repl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: elvis_repl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0

File hashes

Hashes for elvis_repl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ce63e61e09467b4c9cc15d8a1c269c269f43e4420df1730b864f4c755e86e0d
MD5 79a2b4d32a152ce3785f03527fbbf154
BLAKE2b-256 8837e2be1d918fad882d4cf9f147e9a702b37908c291ab5f09d6f675f85692fd

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