https://github.com/iloveitaly/ipython-playground
Understand what is in your ipython playground.
https://github.com/iloveitaly/ipython-playground
ipython playground repl
Last synced: 14 days ago
JSON representation
Understand what is in your ipython playground.
- Host: GitHub
- URL: https://github.com/iloveitaly/ipython-playground
- Owner: iloveitaly
- License: mit
- Created: 2025-03-19T15:26:31.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2026-05-14T20:50:21.000Z (17 days ago)
- Last Synced: 2026-05-14T22:14:26.636Z (17 days ago)
- Topics: ipython, playground, repl
- Language: Python
- Homepage: https://github.com/iloveitaly/ipython-playground
- Size: 558 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/iloveitaly/ipython-playground/releases)
[](https://pepy.tech/project/ipython-playground)

[](https://opensource.org/licenses/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](https://github.com/iloveitaly/python-starter-template)):

## Installation
```bash
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 ``).
- 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](https://github.com/iloveitaly/python-package-template)*