Skip to content

Commit 94fb0eb

Browse files
authored
tips and docs about argcomplete (ipython#15103)
2 parents 25ba3a3 + 674d2d3 commit 94fb0eb

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

IPython/core/tips.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@
107107
]
108108
)
109109

110+
# Check if argcomplete is installed and add tip
111+
try:
112+
import argcomplete
113+
114+
_tips["random"].append(
115+
"Run `activate-global-python-argcomplete` from your shell to enable CLI completion for IPython"
116+
)
117+
except ModuleNotFoundError:
118+
pass
119+
110120

111121
def pick_tip() -> str:
112122
current_date = datetime.now()

docs/source/install/install.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,32 @@ The quickest way to get up and running with IPython is to install it with pip:
7878
That's it.
7979

8080

81+
Optional: Command-line completion
82+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83+
84+
IPython supports command-line completion via the ``argcomplete`` package.
85+
To enable tab completion for IPython and other Python programs that support
86+
argcomplete, install IPython with the ``terminal`` extra:
87+
88+
.. code-block:: bash
89+
90+
$ pip install ipython[all]
91+
$ activate-global-python-argcomplete
92+
93+
Alternatively, you can install argcomplete separately:
94+
95+
.. code-block:: bash
96+
97+
$ pip install argcomplete
98+
$ activate-global-python-argcomplete
99+
100+
This will enable shell completion for all Python programs that support argcomplete,
101+
including IPython. Note that you may need to restart your shell for the changes
102+
to take effect.
103+
104+
For more information, see the `argcomplete documentation <https://github.com/kislyuk/argcomplete>`_.
105+
106+
81107
.. _devinstall:
82108

83109
Installing the development version

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ matplotlib = [
9191
"matplotlib>3.9"
9292
]
9393
all = [
94-
"ipython[doc,matplotlib,test,test_extra]",
94+
"ipython[doc,matplotlib,terminal,test,test_extra]",
95+
"argcomplete>=3.0",
9596
]
9697

9798

0 commit comments

Comments
 (0)