Skip to main content

Configurable postfix completion extension for IPython.

Project description

IPython Postfix Completion

Configurable postfix completion extension for IPython.

Install

From a local checkout:

python -m pip install -e .

From PyPI after publishing:

python -m pip install 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"]

Runtime Templates

Add a template for the current session:

%postfix_template add forin "for item in {expr}:\n{indent}    "

Use it:

items.forin<Tab>

This expands to:

for item in items:
    

List effective templates:

%postfix_template list

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.

Development

Run tests:

python -m pip install -e ".[test]"
python -m pytest

Build release artifacts:

python -m pip install build twine
python -m build
python -m twine check dist/*

Publish to TestPyPI:

python -m twine upload --repository testpypi dist/*

Publish to PyPI:

python -m twine upload dist/*

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_postfix_completion-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

ipython_postfix_completion-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file ipython_postfix_completion-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ipython_postfix_completion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2bd9b3023c0e9482814d25a7da316b4e12c8a20a50832efd4cf8f7ff6e21fbc8
MD5 01aec54399c8c8333f4f81be8e8a0d5a
BLAKE2b-256 9b955bd40b5eca503767894c9edd15e358e580bbc58605cf02135dace173a807

See more details on using hashes here.

File details

Details for the file ipython_postfix_completion-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ipython_postfix_completion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c10c36f542492d75f0dd42bbbc60172b704fab0015f34c4445ed794370bba5a8
MD5 89dc848c1e5d1d01a43963f2f2f897dc
BLAKE2b-256 925fa5b09ef7b3574d161ebb25d511831badabbc624e2375cb56f96a778d2e67

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