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):
Installation
pip install ipython-playground
Usage
- Run
ipython-playgroundto generate aplayground.py. - Execute
./playground.pyto 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, andsqlmodel. - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipython_playground-0.3.0.tar.gz.
File metadata
- Download URL: ipython_playground-0.3.0.tar.gz
- Upload date:
- Size: 352.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18924013af80942983efc1d9423a5bb0033131d9509d04e7606bc2d31c7898fc
|
|
| MD5 |
c1d3a58b39751ea00d871de74bdf774b
|
|
| BLAKE2b-256 |
26295252e66a39923d9a9aaaa769a64d9b34a74212b731604ceb844545ed0cfb
|
File details
Details for the file ipython_playground-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ipython_playground-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ad0ae1ae11a00a3227199b6b0e6c95c94360e0285808e35709e28c7713a1a4a
|
|
| MD5 |
f9e1410181dd7c0c6f6da5b26c7e0ed8
|
|
| BLAKE2b-256 |
2db001c01978b29b5297d5ab03b7635d1bf03afd6ef80604515319b5c2c36c69
|