Skip to main content

Release Notes Downloads GitHub CI Status License: MIT

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

uv add 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.
  • Monkey patches Enum.__repr__ to provide a cleaner, concise display of enum members in the REPL (e.g. MyEnum.MEMBER instead of <MyEnum.MEMBER: 1>).
  • 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.


This project was created from iloveitaly/python-package-template

Metadata

Release files for ipython-playground 0.7.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 ipython-playground 0.7.0
File Size Uploaded
ipython_playground-0.7.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipython-playground 0.7.0
File Interpreter ABI Platform
ipython_playground-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / ipython_playground-0.7.0.tar.gz

Download URL ipython_playground-0.7.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4b6432c6b0cef7e88c90a766d5cee293f15dadec9fc65e7b12a0724cb33562e6
BLAKE2b-256 checksum
How to use checksums
c85055118cd287fb7f9a260ab0cb3fa550e572f7ec7231696ff6580e9348a3b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ipython_playground-0.7.0-py3-none-any.whl

Download URL ipython_playground-0.7.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48c729d545f13693d6c4229542c4233051d09bff5bdc524d2e001d2f1c888c06
BLAKE2b-256 checksum
How to use checksums
3e77231ebc697b5ea7171b7d5b9c6c6225736813b79a43535d37f0b785bbae5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.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