Configurable postfix completion extension for IPython.
Project description
IPython Postfix Completion
Configurable postfix completion extension for IPython.
Package on PyPI: ipython-postfix-completion
Install
Install into the current Python environment with uv:
uvx --with ipython-postfix-completion ipython
Install into the current ipython environment with uv:
uv tool install ipython --with ipython-postfix-completion
Load
Inside IPython:
%load_ext ipython_postfix_completion
To load it automatically, add this to ipython_config.py:
c.InteractiveShellApp.extensions = ["ipython_postfix_completion"]
Quick Example: Add a for Template
Add a template for the current IPython session:
%postfix_template add for "for item in {expr}:\n{indent} "
Use it:
items.for<Tab>
It expands to:
for item in items:
Runtime templates only affect the current IPython session. Put templates in
ipython_config.py if you want them to persist.
Runtime Magic
List effective templates:
%postfix_template list
Add or override a template for the current session:
%postfix_template add debug "print({expr}=)"
%postfix_template add forin "for item in {expr}:\n{indent} "
Disable a template for the current session:
%postfix_template remove tuple
Reset one runtime change:
%postfix_template reset forin
Reset all runtime changes:
%postfix_template reset --all
Persistent Config
Add persistent templates in ipython_config.py:
c.PostfixCompletionConfig.templates = {
"debug": "print({expr}=)",
"forin": "for item in {expr}:\n{indent} ",
}
c.PostfixCompletionConfig.disabled_templates = ["tuple"]
Template names must match [A-Za-z_][A-Za-z0-9_]*.
Templates must include {expr} and may also use {indent}. No other template
fields are allowed.
Built-in Templates
Default templates:
| Name | Expansion |
|---|---|
print |
print({expr}) |
len |
len({expr}) |
not |
not {expr} |
par |
({expr}) |
var |
{expr} = |
await |
await {expr} |
return |
return {expr} |
if |
if {expr}:\n{indent} |
while |
while {expr}:\n{indent} |
raise |
raise {expr} |
yield |
yield {expr} |
str |
str({expr}) |
list |
list({expr}) |
set |
set({expr}) |
dict |
dict({expr}) |
tuple |
tuple({expr}) |
Use %postfix_template list in IPython to see the exact effective set, including
custom and disabled templates.
Local Validation
Run tests:
uv run --extra test pytest -q
Build and check release artifacts:
uv run --extra dev python -m build
uv run --extra dev python -m twine check dist/*
Validate the wheel in a clean local virtual environment:
uv venv .venv-check
uv pip install --python .venv-check/bin/python dist/*.whl
.venv-check/bin/ipython
Then inside IPython:
%load_ext ipython_postfix_completion
%postfix_template add for "for item in {expr}:\n{indent} "
%postfix_template list
Publish
Publishing uses GitHub Actions and PyPI Trusted Publishing. Configure the existing PyPI project once under Manage > Publishing > Add a new publisher:
| Setting | Value |
|---|---|
| Owner | fishandsheep |
| Repository | ipython-postfix-completion |
| Workflow | publish.yml |
| Environment | pypi |
For each release, update project.version in pyproject.toml, commit and push
the change, then create a matching v tag. For example, after changing the
version to 0.1.1:
git tag v0.1.1
git push origin v0.1.1
The workflow verifies the tag against project.version, runs tests, builds and
checks both distributions, then publishes them to PyPI using a short-lived OIDC
credential. The already-published 0.1.0 release cannot be uploaded again.
Project details
Release history Release notifications | RSS feed
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_postfix_completion-0.1.1.tar.gz.
File metadata
- Download URL: ipython_postfix_completion-0.1.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0813285e1632b519cb58bd8b4a05207210935853cbc345dad183917c0092b127
|
|
| MD5 |
17b89fc0e6b4e94b3f3bb8a4c729e5fd
|
|
| BLAKE2b-256 |
88c98b9a2758c8b01fc68f3ec5ffb8007382b0c39c40708173e835540783bd2f
|
Provenance
The following attestation bundles were made for ipython_postfix_completion-0.1.1.tar.gz:
Publisher:
publish.yml on fishandsheep/ipython-postfix-completion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipython_postfix_completion-0.1.1.tar.gz -
Subject digest:
0813285e1632b519cb58bd8b4a05207210935853cbc345dad183917c0092b127 - Sigstore transparency entry: 2136044187
- Sigstore integration time:
-
Permalink:
fishandsheep/ipython-postfix-completion@96f0151f514aa5cb4f18a8ba384c79cfda8ea2d2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fishandsheep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@96f0151f514aa5cb4f18a8ba384c79cfda8ea2d2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ipython_postfix_completion-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ipython_postfix_completion-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e591a4f41bb68fcbe6a42e2d92e245469f4456e92559d2a5637980bfb1efdb
|
|
| MD5 |
fc43b44b9c50f1344d2391d3cbad2bf9
|
|
| BLAKE2b-256 |
e548cc245b7e4f9b7ce6dd349b97a3044d906034df7271bc51d4cf986583f657
|
Provenance
The following attestation bundles were made for ipython_postfix_completion-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on fishandsheep/ipython-postfix-completion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ipython_postfix_completion-0.1.1-py3-none-any.whl -
Subject digest:
15e591a4f41bb68fcbe6a42e2d92e245469f4456e92559d2a5637980bfb1efdb - Sigstore transparency entry: 2136044294
- Sigstore integration time:
-
Permalink:
fishandsheep/ipython-postfix-completion@96f0151f514aa5cb4f18a8ba384c79cfda8ea2d2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fishandsheep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@96f0151f514aa5cb4f18a8ba384c79cfda8ea2d2 -
Trigger Event:
push
-
Statement type: