Skip to main content

Understand what is in your ipython playground.

Project description

IPython Playground

I'm a big fan of playgrounds. Every repo should have a playground.py to make it easy to jump right into REPL-driven development.

However, it's hard to understand what's in the playground.py once it gets big. This project eliminates this problem (example from this project):

alt text

Installation

pip install ipython-playground

Usage

  1. Run ipython-playground to generate a playground.py.
  2. Execute ./playground.py to start an IPython session with additional setup.

How extras.py and the all() hook work

The ipython_playground/extras.py file provides logic to automatically import and expose useful modules and objects in your playground session. The main entry point is the all() function, which:

  • Loads common app modules (like app.models, app.commands, app.jobs) if available.
  • Attempts to import helpful libraries such as funcy_pipe, sqlalchemy, and sqlmodel.
  • Optionally discovers all SQLModel classes in your models module and adds them to the namespace.
  • If a database URL is available (either passed in or imported from your app config), sets up a SQLAlchemy engine and session, and exposes helpers for running and compiling SQL statements.

When you run playground.py, it calls globals().update(ipython_playground.all_extras()), which injects all these objects into your interactive session, making them immediately available for experimentation.

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

ipython_playground-0.4.1.tar.gz (355.2 kB view details)

Uploaded Source

Built Distribution

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

ipython_playground-0.4.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file ipython_playground-0.4.1.tar.gz.

File metadata

  • Download URL: ipython_playground-0.4.1.tar.gz
  • Upload date:
  • Size: 355.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for ipython_playground-0.4.1.tar.gz
Algorithm Hash digest
SHA256 eaad8bfc66d7069be6f2df4a014bc598f81bd4f8249afb1cfbfe3f8681fa7096
MD5 b8931e5988ee1ada920c4016ecf5720c
BLAKE2b-256 65b2a006b9be6d955592d1d4d22ef9cb688c879b08c1890506f08215127dc623

See more details on using hashes here.

File details

Details for the file ipython_playground-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ipython_playground-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8b3925f60ee10a432360f43bbfe340ba099fcc7c0520e7e0634d8ae909a60d6
MD5 03057f3b0c9f4407f7487d233446bcf7
BLAKE2b-256 bea0e41cb6b6dd8bb1e927485cf73a068c19ec10952d95acf4e7f3610011a7d6

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