ipython-postfix-completion 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,8 @@ DEFAULT_TEMPLATES: dict[str, str] = {
53
53
  "len": "len({expr})",
54
54
  "not": "not {expr}",
55
55
  "par": "({expr})",
56
+ "var": "{expr} = ",
57
+ "await": "await {expr}",
56
58
  "return": "return {expr}",
57
59
  "if": "if {expr}:\n{indent} ",
58
60
  "while": "while {expr}:\n{indent} ",
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: ipython-postfix-completion
3
+ Version: 0.1.1
4
+ Summary: Configurable postfix completion extension for IPython.
5
+ Author: IPython Postfix Completion Contributors
6
+ License-Expression: BSD-3-Clause
7
+ Keywords: ipython,completion,postfix,extension
8
+ Classifier: Framework :: IPython
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: ipython>=9.0
20
+ Requires-Dist: traitlets>=5.13
21
+ Provides-Extra: test
22
+ Requires-Dist: pytest>=7; extra == "test"
23
+ Provides-Extra: dev
24
+ Requires-Dist: build; extra == "dev"
25
+ Requires-Dist: twine; extra == "dev"
26
+ Requires-Dist: ipython-postfix-completion[test]; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # IPython Postfix Completion
30
+
31
+ Configurable postfix completion extension for IPython.
32
+
33
+ Package on PyPI: `ipython-postfix-completion`
34
+
35
+ ## Install
36
+
37
+ Install into the current Python environment with `uv`:
38
+
39
+ ```bash
40
+ uvx --with ipython-postfix-completion ipython
41
+ ```
42
+
43
+ Install into the current ipython environment with `uv`:
44
+
45
+ ```bash
46
+ uv tool install ipython --with ipython-postfix-completion
47
+ ```
48
+
49
+ ## Load
50
+
51
+ Inside IPython:
52
+
53
+ ```python
54
+ %load_ext ipython_postfix_completion
55
+ ```
56
+
57
+ To load it automatically, add this to `ipython_config.py`:
58
+
59
+ ```python
60
+ c.InteractiveShellApp.extensions = ["ipython_postfix_completion"]
61
+ ```
62
+
63
+ ## Quick Example: Add a `for` Template
64
+
65
+ Add a template for the current IPython session:
66
+
67
+ ```python
68
+ %postfix_template add for "for item in {expr}:\n{indent} "
69
+ ```
70
+
71
+ Use it:
72
+
73
+ ```python
74
+ items.for<Tab>
75
+ ```
76
+
77
+ It expands to:
78
+
79
+ ```python
80
+ for item in items:
81
+
82
+ ```
83
+
84
+ Runtime templates only affect the current IPython session. Put templates in
85
+ `ipython_config.py` if you want them to persist.
86
+
87
+ ## Runtime Magic
88
+
89
+ List effective templates:
90
+
91
+ ```python
92
+ %postfix_template list
93
+ ```
94
+
95
+ Add or override a template for the current session:
96
+
97
+ ```python
98
+ %postfix_template add debug "print({expr}=)"
99
+ %postfix_template add forin "for item in {expr}:\n{indent} "
100
+ ```
101
+
102
+ Disable a template for the current session:
103
+
104
+ ```python
105
+ %postfix_template remove tuple
106
+ ```
107
+
108
+ Reset one runtime change:
109
+
110
+ ```python
111
+ %postfix_template reset forin
112
+ ```
113
+
114
+ Reset all runtime changes:
115
+
116
+ ```python
117
+ %postfix_template reset --all
118
+ ```
119
+
120
+ ## Persistent Config
121
+
122
+ Add persistent templates in `ipython_config.py`:
123
+
124
+ ```python
125
+ c.PostfixCompletionConfig.templates = {
126
+ "debug": "print({expr}=)",
127
+ "forin": "for item in {expr}:\n{indent} ",
128
+ }
129
+
130
+ c.PostfixCompletionConfig.disabled_templates = ["tuple"]
131
+ ```
132
+
133
+ Template names must match `[A-Za-z_][A-Za-z0-9_]*`.
134
+
135
+ Templates must include `{expr}` and may also use `{indent}`. No other template
136
+ fields are allowed.
137
+
138
+ ## Built-in Templates
139
+
140
+ Default templates:
141
+
142
+ | Name | Expansion |
143
+ | --- | --- |
144
+ | `print` | `print({expr})` |
145
+ | `len` | `len({expr})` |
146
+ | `not` | `not {expr}` |
147
+ | `par` | `({expr})` |
148
+ | `var` | `{expr} = ` |
149
+ | `await` | `await {expr}` |
150
+ | `return` | `return {expr}` |
151
+ | `if` | `if {expr}:\n{indent} ` |
152
+ | `while` | `while {expr}:\n{indent} ` |
153
+ | `raise` | `raise {expr}` |
154
+ | `yield` | `yield {expr}` |
155
+ | `str` | `str({expr})` |
156
+ | `list` | `list({expr})` |
157
+ | `set` | `set({expr})` |
158
+ | `dict` | `dict({expr})` |
159
+ | `tuple` | `tuple({expr})` |
160
+
161
+ Use `%postfix_template list` in IPython to see the exact effective set, including
162
+ custom and disabled templates.
163
+
164
+ ## Local Validation
165
+
166
+ Run tests:
167
+
168
+ ```bash
169
+ uv run --extra test pytest -q
170
+ ```
171
+
172
+ Build and check release artifacts:
173
+
174
+ ```bash
175
+ uv run --extra dev python -m build
176
+ uv run --extra dev python -m twine check dist/*
177
+ ```
178
+
179
+ Validate the wheel in a clean local virtual environment:
180
+
181
+ ```bash
182
+ uv venv .venv-check
183
+ uv pip install --python .venv-check/bin/python dist/*.whl
184
+ .venv-check/bin/ipython
185
+ ```
186
+
187
+ Then inside IPython:
188
+
189
+ ```python
190
+ %load_ext ipython_postfix_completion
191
+ %postfix_template add for "for item in {expr}:\n{indent} "
192
+ %postfix_template list
193
+ ```
194
+
195
+ ## Publish
196
+
197
+ Publishing uses GitHub Actions and PyPI Trusted Publishing. Configure the
198
+ existing PyPI project once under **Manage > Publishing > Add a new publisher**:
199
+
200
+ | Setting | Value |
201
+ | --- | --- |
202
+ | Owner | `fishandsheep` |
203
+ | Repository | `ipython-postfix-completion` |
204
+ | Workflow | `publish.yml` |
205
+ | Environment | `pypi` |
206
+
207
+ For each release, update `project.version` in `pyproject.toml`, commit and push
208
+ the change, then create a matching `v` tag. For example, after changing the
209
+ version to `0.1.1`:
210
+
211
+ ```bash
212
+ git tag v0.1.1
213
+ git push origin v0.1.1
214
+ ```
215
+
216
+ The workflow verifies the tag against `project.version`, runs tests, builds and
217
+ checks both distributions, then publishes them to PyPI using a short-lived OIDC
218
+ credential. The already-published `0.1.0` release cannot be uploaded again.
@@ -0,0 +1,6 @@
1
+ ipython_postfix_completion/__init__.py,sha256=Ihs9zrkmwcmDydHIxRn4KU7yeRR_NWxHpB9WaidvyXs,18145
2
+ ipython_postfix_completion-0.1.1.dist-info/licenses/LICENSE,sha256=omLR-7QW1K3l6AG7ih1N5L8Z58UY-ROrQL82ANN9PnM,1547
3
+ ipython_postfix_completion-0.1.1.dist-info/METADATA,sha256=10PHgmlDTJQVOwdahbiqMKFEdkxQvdCEvWyO1jo3uQk,4960
4
+ ipython_postfix_completion-0.1.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
5
+ ipython_postfix_completion-0.1.1.dist-info/top_level.txt,sha256=W2sJCvsBheoCB2nbzJeD7-p5PR6lVDNicVLxNxmeraY,27
6
+ ipython_postfix_completion-0.1.1.dist-info/RECORD,,
@@ -1,150 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ipython-postfix-completion
3
- Version: 0.1.0
4
- Summary: Configurable postfix completion extension for IPython.
5
- Author: IPython Postfix Completion Contributors
6
- License-Expression: BSD-3-Clause
7
- Keywords: ipython,completion,postfix,extension
8
- Classifier: Framework :: IPython
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Requires-Python: >=3.11
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: ipython>=9.0
20
- Requires-Dist: traitlets>=5.13
21
- Provides-Extra: test
22
- Requires-Dist: pytest>=7; extra == "test"
23
- Provides-Extra: dev
24
- Requires-Dist: build; extra == "dev"
25
- Requires-Dist: twine; extra == "dev"
26
- Requires-Dist: ipython-postfix-completion[test]; extra == "dev"
27
- Dynamic: license-file
28
-
29
- # IPython Postfix Completion
30
-
31
- Configurable postfix completion extension for IPython.
32
-
33
- ## Install
34
-
35
- From a local checkout:
36
-
37
- ```bash
38
- python -m pip install -e .
39
- ```
40
-
41
- From PyPI after publishing:
42
-
43
- ```bash
44
- python -m pip install ipython-postfix-completion
45
- ```
46
-
47
- ## Load
48
-
49
- Inside IPython:
50
-
51
- ```python
52
- %load_ext ipython_postfix_completion
53
- ```
54
-
55
- To load it automatically, add this to `ipython_config.py`:
56
-
57
- ```python
58
- c.InteractiveShellApp.extensions = ["ipython_postfix_completion"]
59
- ```
60
-
61
- ## Runtime Templates
62
-
63
- Add a template for the current session:
64
-
65
- ```python
66
- %postfix_template add forin "for item in {expr}:\n{indent} "
67
- ```
68
-
69
- Use it:
70
-
71
- ```python
72
- items.forin<Tab>
73
- ```
74
-
75
- This expands to:
76
-
77
- ```python
78
- for item in items:
79
-
80
- ```
81
-
82
- List effective templates:
83
-
84
- ```python
85
- %postfix_template list
86
- ```
87
-
88
- Disable a template for the current session:
89
-
90
- ```python
91
- %postfix_template remove tuple
92
- ```
93
-
94
- Reset one runtime change:
95
-
96
- ```python
97
- %postfix_template reset forin
98
- ```
99
-
100
- Reset all runtime changes:
101
-
102
- ```python
103
- %postfix_template reset --all
104
- ```
105
-
106
- ## Persistent Config
107
-
108
- Add persistent templates in `ipython_config.py`:
109
-
110
- ```python
111
- c.PostfixCompletionConfig.templates = {
112
- "debug": "print({expr}=)",
113
- "forin": "for item in {expr}:\n{indent} ",
114
- }
115
-
116
- c.PostfixCompletionConfig.disabled_templates = ["tuple"]
117
- ```
118
-
119
- Template names must match `[A-Za-z_][A-Za-z0-9_]*`.
120
-
121
- Templates must include `{expr}` and may also use `{indent}`. No other template fields are allowed.
122
-
123
- ## Development
124
-
125
- Run tests:
126
-
127
- ```bash
128
- python -m pip install -e ".[test]"
129
- python -m pytest
130
- ```
131
-
132
- Build release artifacts:
133
-
134
- ```bash
135
- python -m pip install build twine
136
- python -m build
137
- python -m twine check dist/*
138
- ```
139
-
140
- Publish to TestPyPI:
141
-
142
- ```bash
143
- python -m twine upload --repository testpypi dist/*
144
- ```
145
-
146
- Publish to PyPI:
147
-
148
- ```bash
149
- python -m twine upload dist/*
150
- ```
@@ -1,6 +0,0 @@
1
- ipython_postfix_completion/__init__.py,sha256=DRxZk3AHYjxgytPi07L7mumRC35xpxJIvFQmqING7Hs,18092
2
- ipython_postfix_completion-0.1.0.dist-info/licenses/LICENSE,sha256=omLR-7QW1K3l6AG7ih1N5L8Z58UY-ROrQL82ANN9PnM,1547
3
- ipython_postfix_completion-0.1.0.dist-info/METADATA,sha256=TufiR1ICd7vXLBVvvdj7zYPaiiSkiySe3Ub9wkxDneo,2850
4
- ipython_postfix_completion-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
5
- ipython_postfix_completion-0.1.0.dist-info/top_level.txt,sha256=W2sJCvsBheoCB2nbzJeD7-p5PR6lVDNicVLxNxmeraY,27
6
- ipython_postfix_completion-0.1.0.dist-info/RECORD,,