Metadata-Version: 2.4
Name: ipython-postfix-completion
Version: 0.1.0
Summary: Configurable postfix completion extension for IPython.
Author: IPython Postfix Completion Contributors
License-Expression: BSD-3-Clause
Keywords: ipython,completion,postfix,extension
Classifier: Framework :: IPython
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ipython>=9.0
Requires-Dist: traitlets>=5.13
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: ipython-postfix-completion[test]; extra == "dev"
Dynamic: license-file

# IPython Postfix Completion

Configurable postfix completion extension for IPython.

## Install

From a local checkout:

```bash
python -m pip install -e .
```

From PyPI after publishing:

```bash
python -m pip install ipython-postfix-completion
```

## Load

Inside IPython:

```python
%load_ext ipython_postfix_completion
```

To load it automatically, add this to `ipython_config.py`:

```python
c.InteractiveShellApp.extensions = ["ipython_postfix_completion"]
```

## Runtime Templates

Add a template for the current session:

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

Use it:

```python
items.forin<Tab>
```

This expands to:

```python
for item in items:
    
```

List effective templates:

```python
%postfix_template list
```

Disable a template for the current session:

```python
%postfix_template remove tuple
```

Reset one runtime change:

```python
%postfix_template reset forin
```

Reset all runtime changes:

```python
%postfix_template reset --all
```

## Persistent Config

Add persistent templates in `ipython_config.py`:

```python
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:

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

Build release artifacts:

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

Publish to TestPyPI:

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

Publish to PyPI:

```bash
python -m twine upload dist/*
```
