ipython 9.2.0__py3-none-any.whl → 9.3.0__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.
- IPython/core/completer.py +93 -7
- IPython/core/guarded_eval.py +23 -8
- IPython/core/interactiveshell.py +12 -10
- IPython/core/release.py +1 -1
- IPython/terminal/interactiveshell.py +8 -5
- IPython/terminal/shortcuts/auto_suggest.py +22 -9
- IPython/utils/_sysinfo.py +1 -1
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/METADATA +1 -1
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/RECORD +15 -15
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/WHEEL +1 -1
- {ipython-9.2.0.data → ipython-9.3.0.data}/data/share/man/man1/ipython.1 +0 -0
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/entry_points.txt +0 -0
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/licenses/COPYING.rst +0 -0
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/licenses/LICENSE +0 -0
- {ipython-9.2.0.dist-info → ipython-9.3.0.dist-info}/top_level.txt +0 -0
IPython/core/completer.py
CHANGED
|
@@ -203,15 +203,11 @@ from types import SimpleNamespace
|
|
|
203
203
|
from typing import (
|
|
204
204
|
Iterable,
|
|
205
205
|
Iterator,
|
|
206
|
-
List,
|
|
207
|
-
Tuple,
|
|
208
206
|
Union,
|
|
209
207
|
Any,
|
|
210
208
|
Sequence,
|
|
211
|
-
Dict,
|
|
212
209
|
Optional,
|
|
213
210
|
TYPE_CHECKING,
|
|
214
|
-
Set,
|
|
215
211
|
Sized,
|
|
216
212
|
TypeVar,
|
|
217
213
|
Literal,
|
|
@@ -236,10 +232,12 @@ from traitlets import (
|
|
|
236
232
|
List as ListTrait,
|
|
237
233
|
Unicode,
|
|
238
234
|
Dict as DictTrait,
|
|
235
|
+
DottedObjectName,
|
|
239
236
|
Union as UnionTrait,
|
|
240
237
|
observe,
|
|
241
238
|
)
|
|
242
239
|
from traitlets.config.configurable import Configurable
|
|
240
|
+
from traitlets.utils.importstring import import_item
|
|
243
241
|
|
|
244
242
|
import __main__
|
|
245
243
|
|
|
@@ -987,7 +985,7 @@ class Completer(Configurable):
|
|
|
987
985
|
|
|
988
986
|
- ``forbidden``: no evaluation of code is permitted,
|
|
989
987
|
- ``minimal``: evaluation of literals and access to built-in namespace;
|
|
990
|
-
no item/attribute
|
|
988
|
+
no item/attribute evaluation, no access to locals/globals,
|
|
991
989
|
no evaluation of any operations or comparisons.
|
|
992
990
|
- ``limited``: access to all namespaces, evaluation of hard-coded methods
|
|
993
991
|
(for example: :any:`dict.keys`, :any:`object.__getattr__`,
|
|
@@ -995,7 +993,9 @@ class Completer(Configurable):
|
|
|
995
993
|
:any:`dict`, :any:`list`, :any:`tuple`, ``pandas.Series``),
|
|
996
994
|
- ``unsafe``: evaluation of all methods and function calls but not of
|
|
997
995
|
syntax with side-effects like `del x`,
|
|
998
|
-
- ``dangerous``: completely arbitrary evaluation.
|
|
996
|
+
- ``dangerous``: completely arbitrary evaluation; does not support auto-import.
|
|
997
|
+
|
|
998
|
+
To override specific elements of the policy, you can use ``policy_overrides`` trait.
|
|
999
999
|
""",
|
|
1000
1000
|
).tag(config=True)
|
|
1001
1001
|
|
|
@@ -1031,6 +1031,35 @@ class Completer(Configurable):
|
|
|
1031
1031
|
""",
|
|
1032
1032
|
).tag(config=True)
|
|
1033
1033
|
|
|
1034
|
+
policy_overrides = DictTrait(
|
|
1035
|
+
default_value={},
|
|
1036
|
+
key_trait=Unicode(),
|
|
1037
|
+
help="""Overrides for policy evaluation.
|
|
1038
|
+
|
|
1039
|
+
For example, to enable auto-import on completion specify:
|
|
1040
|
+
|
|
1041
|
+
.. code-block::
|
|
1042
|
+
|
|
1043
|
+
ipython --Completer.policy_overrides='{"allow_auto_import": True}' --Completer.use_jedi=False
|
|
1044
|
+
|
|
1045
|
+
""",
|
|
1046
|
+
).tag(config=True)
|
|
1047
|
+
|
|
1048
|
+
auto_import_method = DottedObjectName(
|
|
1049
|
+
default_value="importlib.import_module",
|
|
1050
|
+
allow_none=True,
|
|
1051
|
+
help="""\
|
|
1052
|
+
Provisional:
|
|
1053
|
+
This is a provisional API in IPython 9.3, it may change without warnings.
|
|
1054
|
+
|
|
1055
|
+
A fully qualified path to an auto-import method for use by completer.
|
|
1056
|
+
The function should take a single string and return `ModuleType` and
|
|
1057
|
+
can raise `ImportError` exception if module is not found.
|
|
1058
|
+
|
|
1059
|
+
The default auto-import implementation does not populate the user namespace with the imported module.
|
|
1060
|
+
""",
|
|
1061
|
+
).tag(config=True)
|
|
1062
|
+
|
|
1034
1063
|
def __init__(self, namespace=None, global_namespace=None, **kwargs):
|
|
1035
1064
|
"""Create a new completer for the command line.
|
|
1036
1065
|
|
|
@@ -1134,6 +1163,48 @@ class Completer(Configurable):
|
|
|
1134
1163
|
# we simple attribute matching with normal identifiers.
|
|
1135
1164
|
_ATTR_MATCH_RE = re.compile(r"(.+)\.(\w*)$")
|
|
1136
1165
|
|
|
1166
|
+
def _strip_code_before_operator(self, code: str) -> str:
|
|
1167
|
+
o_parens = {"(", "[", "{"}
|
|
1168
|
+
c_parens = {")", "]", "}"}
|
|
1169
|
+
|
|
1170
|
+
# Dry-run tokenize to catch errors
|
|
1171
|
+
try:
|
|
1172
|
+
_ = list(tokenize.generate_tokens(iter(code.splitlines()).__next__))
|
|
1173
|
+
except tokenize.TokenError:
|
|
1174
|
+
# Try trimming the expression and retrying
|
|
1175
|
+
trimmed_code = self._trim_expr(code)
|
|
1176
|
+
try:
|
|
1177
|
+
_ = list(
|
|
1178
|
+
tokenize.generate_tokens(iter(trimmed_code.splitlines()).__next__)
|
|
1179
|
+
)
|
|
1180
|
+
code = trimmed_code
|
|
1181
|
+
except tokenize.TokenError:
|
|
1182
|
+
return code
|
|
1183
|
+
|
|
1184
|
+
tokens = _parse_tokens(code)
|
|
1185
|
+
encountered_operator = False
|
|
1186
|
+
after_operator = []
|
|
1187
|
+
nesting_level = 0
|
|
1188
|
+
|
|
1189
|
+
for t in tokens:
|
|
1190
|
+
if t.type == tokenize.OP:
|
|
1191
|
+
if t.string in o_parens:
|
|
1192
|
+
nesting_level += 1
|
|
1193
|
+
elif t.string in c_parens:
|
|
1194
|
+
nesting_level -= 1
|
|
1195
|
+
elif t.string != "." and nesting_level == 0:
|
|
1196
|
+
encountered_operator = True
|
|
1197
|
+
after_operator = []
|
|
1198
|
+
continue
|
|
1199
|
+
|
|
1200
|
+
if encountered_operator:
|
|
1201
|
+
after_operator.append(t.string)
|
|
1202
|
+
|
|
1203
|
+
if encountered_operator:
|
|
1204
|
+
return "".join(after_operator)
|
|
1205
|
+
else:
|
|
1206
|
+
return code
|
|
1207
|
+
|
|
1137
1208
|
def _attr_matches(
|
|
1138
1209
|
self, text: str, include_prefix: bool = True
|
|
1139
1210
|
) -> tuple[Sequence[str], str]:
|
|
@@ -1141,9 +1212,12 @@ class Completer(Configurable):
|
|
|
1141
1212
|
if not m2:
|
|
1142
1213
|
return [], ""
|
|
1143
1214
|
expr, attr = m2.group(1, 2)
|
|
1215
|
+
try:
|
|
1216
|
+
expr = self._strip_code_before_operator(expr)
|
|
1217
|
+
except tokenize.TokenError:
|
|
1218
|
+
pass
|
|
1144
1219
|
|
|
1145
1220
|
obj = self._evaluate_expr(expr)
|
|
1146
|
-
|
|
1147
1221
|
if obj is not_found:
|
|
1148
1222
|
return [], ""
|
|
1149
1223
|
|
|
@@ -1234,6 +1308,8 @@ class Completer(Configurable):
|
|
|
1234
1308
|
globals=self.global_namespace,
|
|
1235
1309
|
locals=self.namespace,
|
|
1236
1310
|
evaluation=self.evaluation,
|
|
1311
|
+
auto_import=self._auto_import,
|
|
1312
|
+
policy_overrides=self.policy_overrides,
|
|
1237
1313
|
),
|
|
1238
1314
|
)
|
|
1239
1315
|
done = True
|
|
@@ -1247,6 +1323,14 @@ class Completer(Configurable):
|
|
|
1247
1323
|
expr = self._trim_expr(expr)
|
|
1248
1324
|
return obj
|
|
1249
1325
|
|
|
1326
|
+
@property
|
|
1327
|
+
def _auto_import(self):
|
|
1328
|
+
if self.auto_import_method is None:
|
|
1329
|
+
return None
|
|
1330
|
+
if not hasattr(self, "_auto_import_func"):
|
|
1331
|
+
self._auto_import_func = import_item(self.auto_import_method)
|
|
1332
|
+
return self._auto_import_func
|
|
1333
|
+
|
|
1250
1334
|
def get__all__entries(obj):
|
|
1251
1335
|
"""returns the strings in the __all__ attribute"""
|
|
1252
1336
|
try:
|
|
@@ -2787,6 +2871,8 @@ class IPCompleter(Completer):
|
|
|
2787
2871
|
locals=self.namespace,
|
|
2788
2872
|
evaluation=self.evaluation, # type: ignore
|
|
2789
2873
|
in_subscript=True,
|
|
2874
|
+
auto_import=self._auto_import,
|
|
2875
|
+
policy_overrides=self.policy_overrides,
|
|
2790
2876
|
),
|
|
2791
2877
|
)
|
|
2792
2878
|
|
IPython/core/guarded_eval.py
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
from copy import copy
|
|
1
2
|
from inspect import isclass, signature, Signature
|
|
2
|
-
from pygments.formatters.terminal256 import Terminal256Formatter
|
|
3
3
|
from typing import (
|
|
4
4
|
Annotated,
|
|
5
5
|
AnyStr,
|
|
6
6
|
Callable,
|
|
7
|
-
Dict,
|
|
8
7
|
Literal,
|
|
9
8
|
NamedTuple,
|
|
10
9
|
NewType,
|
|
11
10
|
Optional,
|
|
12
11
|
Protocol,
|
|
13
|
-
Set,
|
|
14
12
|
Sequence,
|
|
15
|
-
Tuple,
|
|
16
|
-
Type,
|
|
17
13
|
TypeGuard,
|
|
18
14
|
Union,
|
|
19
15
|
get_args,
|
|
@@ -97,6 +93,7 @@ class EvaluationPolicy:
|
|
|
97
93
|
allow_builtins_access: bool = False
|
|
98
94
|
allow_all_operations: bool = False
|
|
99
95
|
allow_any_calls: bool = False
|
|
96
|
+
allow_auto_import: bool = False
|
|
100
97
|
allowed_calls: set[Callable] = field(default_factory=set)
|
|
101
98
|
|
|
102
99
|
def can_get_item(self, value, item):
|
|
@@ -330,6 +327,10 @@ class EvaluationContext(NamedTuple):
|
|
|
330
327
|
#: Whether the evaluation of code takes place inside of a subscript.
|
|
331
328
|
#: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
|
|
332
329
|
in_subscript: bool = False
|
|
330
|
+
#: Auto import method
|
|
331
|
+
auto_import: Callable[list[str], ModuleType] | None = None
|
|
332
|
+
#: Overrides for evaluation policy
|
|
333
|
+
policy_overrides: dict = {}
|
|
333
334
|
|
|
334
335
|
|
|
335
336
|
class _IdentitySubscript:
|
|
@@ -463,6 +464,17 @@ def _find_dunder(node_op, dunders) -> Union[tuple[str, ...], None]:
|
|
|
463
464
|
return dunder
|
|
464
465
|
|
|
465
466
|
|
|
467
|
+
def get_policy(context: EvaluationContext) -> EvaluationPolicy:
|
|
468
|
+
policy = copy(EVALUATION_POLICIES[context.evaluation])
|
|
469
|
+
|
|
470
|
+
for key, value in context.policy_overrides.items():
|
|
471
|
+
if hasattr(policy, key):
|
|
472
|
+
setattr(policy, key, value)
|
|
473
|
+
else:
|
|
474
|
+
print(f"Incorrect policy override key: {key}")
|
|
475
|
+
return policy
|
|
476
|
+
|
|
477
|
+
|
|
466
478
|
def eval_node(node: Union[ast.AST, None], context: EvaluationContext):
|
|
467
479
|
"""Evaluate AST node in provided context.
|
|
468
480
|
|
|
@@ -490,7 +502,8 @@ def eval_node(node: Union[ast.AST, None], context: EvaluationContext):
|
|
|
490
502
|
The purpose of this function is to guard against unwanted side-effects;
|
|
491
503
|
it does not give guarantees on protection from malicious code execution.
|
|
492
504
|
"""
|
|
493
|
-
policy =
|
|
505
|
+
policy = get_policy(context)
|
|
506
|
+
|
|
494
507
|
if node is None:
|
|
495
508
|
return None
|
|
496
509
|
if isinstance(node, ast.Expression):
|
|
@@ -711,7 +724,7 @@ def _resolve_annotation(
|
|
|
711
724
|
|
|
712
725
|
|
|
713
726
|
def _eval_node_name(node_id: str, context: EvaluationContext):
|
|
714
|
-
policy =
|
|
727
|
+
policy = get_policy(context)
|
|
715
728
|
if policy.allow_locals_access and node_id in context.locals:
|
|
716
729
|
return context.locals[node_id]
|
|
717
730
|
if policy.allow_globals_access and node_id in context.globals:
|
|
@@ -719,6 +732,8 @@ def _eval_node_name(node_id: str, context: EvaluationContext):
|
|
|
719
732
|
if policy.allow_builtins_access and hasattr(builtins, node_id):
|
|
720
733
|
# note: do not use __builtins__, it is implementation detail of cPython
|
|
721
734
|
return getattr(builtins, node_id)
|
|
735
|
+
if policy.allow_auto_import and context.auto_import:
|
|
736
|
+
return context.auto_import(node_id)
|
|
722
737
|
if not policy.allow_globals_access and not policy.allow_locals_access:
|
|
723
738
|
raise GuardRejection(
|
|
724
739
|
f"Namespace access not allowed in {context.evaluation} mode"
|
|
@@ -728,7 +743,7 @@ def _eval_node_name(node_id: str, context: EvaluationContext):
|
|
|
728
743
|
|
|
729
744
|
|
|
730
745
|
def _eval_or_create_duck(duck_type, node: ast.Call, context: EvaluationContext):
|
|
731
|
-
policy =
|
|
746
|
+
policy = get_policy(context)
|
|
732
747
|
# if allow-listed builtin is on type annotation, instantiate it
|
|
733
748
|
if policy.can_call(duck_type) and not node.keywords:
|
|
734
749
|
args = [eval_node(arg, context) for arg in node.args]
|
IPython/core/interactiveshell.py
CHANGED
|
@@ -290,7 +290,7 @@ class ExecutionResult:
|
|
|
290
290
|
"""
|
|
291
291
|
|
|
292
292
|
execution_count: Optional[int] = None
|
|
293
|
-
error_before_exec: Optional[
|
|
293
|
+
error_before_exec: Optional[BaseException] = None
|
|
294
294
|
error_in_exec: Optional[BaseException] = None
|
|
295
295
|
info = None
|
|
296
296
|
result = None
|
|
@@ -314,6 +314,7 @@ class ExecutionResult:
|
|
|
314
314
|
return '<%s object at %x, execution_count=%s error_before_exec=%s error_in_exec=%s info=%s result=%s>' %\
|
|
315
315
|
(name, id(self), self.execution_count, self.error_before_exec, self.error_in_exec, repr(self.info), repr(self.result))
|
|
316
316
|
|
|
317
|
+
|
|
317
318
|
@functools.wraps(io_open)
|
|
318
319
|
def _modified_open(file, *args, **kwargs):
|
|
319
320
|
if file in {0, 1, 2}:
|
|
@@ -331,7 +332,7 @@ class InteractiveShell(SingletonConfigurable):
|
|
|
331
332
|
|
|
332
333
|
_instance = None
|
|
333
334
|
_user_ns: dict
|
|
334
|
-
_sys_modules_keys: set[str
|
|
335
|
+
_sys_modules_keys: set[str]
|
|
335
336
|
|
|
336
337
|
inspector: oinspect.Inspector
|
|
337
338
|
|
|
@@ -1572,7 +1573,7 @@ class InteractiveShell(SingletonConfigurable):
|
|
|
1572
1573
|
if isinstance(variables, str):
|
|
1573
1574
|
vlist = variables.split()
|
|
1574
1575
|
else:
|
|
1575
|
-
vlist = variables
|
|
1576
|
+
vlist = list(variables)
|
|
1576
1577
|
vdict = {}
|
|
1577
1578
|
cf = sys._getframe(1)
|
|
1578
1579
|
for name in vlist:
|
|
@@ -1887,11 +1888,12 @@ class InteractiveShell(SingletonConfigurable):
|
|
|
1887
1888
|
with self.builtin_trap:
|
|
1888
1889
|
info = self._object_find(oname)
|
|
1889
1890
|
if info.found:
|
|
1890
|
-
|
|
1891
|
-
sphinxify
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1891
|
+
if self.sphinxify_docstring:
|
|
1892
|
+
if sphinxify is None:
|
|
1893
|
+
raise ImportError("Module ``docrepr`` required but missing")
|
|
1894
|
+
docformat = sphinxify(self.object_inspect(oname))
|
|
1895
|
+
else:
|
|
1896
|
+
docformat = None
|
|
1895
1897
|
return self.inspector._get_info(
|
|
1896
1898
|
info.obj,
|
|
1897
1899
|
oname,
|
|
@@ -2196,7 +2198,7 @@ class InteractiveShell(SingletonConfigurable):
|
|
|
2196
2198
|
except KeyboardInterrupt:
|
|
2197
2199
|
print('\n' + self.get_exception_only(), file=sys.stderr)
|
|
2198
2200
|
|
|
2199
|
-
def _showtraceback(self, etype, evalue, stb: str):
|
|
2201
|
+
def _showtraceback(self, etype, evalue, stb: list[str]):
|
|
2200
2202
|
"""Actually show a traceback.
|
|
2201
2203
|
|
|
2202
2204
|
Subclasses may override this method to put the traceback on a different
|
|
@@ -3599,7 +3601,7 @@ class InteractiveShell(SingletonConfigurable):
|
|
|
3599
3601
|
if mode == "exec":
|
|
3600
3602
|
mod = Module([node], [])
|
|
3601
3603
|
elif mode == "single":
|
|
3602
|
-
mod = ast.Interactive([node])
|
|
3604
|
+
mod = ast.Interactive([node])
|
|
3603
3605
|
with compiler.extra_flags(
|
|
3604
3606
|
getattr(ast, "PyCF_ALLOW_TOP_LEVEL_AWAIT", 0x0)
|
|
3605
3607
|
if self.autoawait
|
IPython/core/release.py
CHANGED
|
@@ -475,7 +475,7 @@ class TerminalInteractiveShell(InteractiveShell):
|
|
|
475
475
|
allow_none=True,
|
|
476
476
|
help="""\
|
|
477
477
|
Provisional:
|
|
478
|
-
This is a
|
|
478
|
+
This is a provisional API in IPython 8.32, before stabilisation
|
|
479
479
|
in 9.0, it may change without warnings.
|
|
480
480
|
|
|
481
481
|
class to use for the `NavigableAutoSuggestFromHistory` to request
|
|
@@ -507,13 +507,16 @@ class TerminalInteractiveShell(InteractiveShell):
|
|
|
507
507
|
elif provider == "NavigableAutoSuggestFromHistory":
|
|
508
508
|
# LLM stuff are all Provisional in 8.32
|
|
509
509
|
if self._llm_provider_class:
|
|
510
|
-
|
|
511
|
-
|
|
510
|
+
|
|
511
|
+
def init_llm_provider():
|
|
512
|
+
llm_provider_constructor = import_item(self._llm_provider_class)
|
|
513
|
+
return llm_provider_constructor(**self.llm_constructor_kwargs)
|
|
514
|
+
|
|
512
515
|
else:
|
|
513
|
-
|
|
516
|
+
init_llm_provider = None
|
|
514
517
|
self.auto_suggest = NavigableAutoSuggestFromHistory()
|
|
515
518
|
# Provisinal in 8.32
|
|
516
|
-
self.auto_suggest.
|
|
519
|
+
self.auto_suggest._init_llm_provider = init_llm_provider
|
|
517
520
|
|
|
518
521
|
name = self.llm_prefix_from_history
|
|
519
522
|
|
|
@@ -171,16 +171,19 @@ class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):
|
|
|
171
171
|
# another request.
|
|
172
172
|
_llm_task: asyncio.Task | None = None
|
|
173
173
|
|
|
174
|
-
# This is the
|
|
175
|
-
# to generate inline completions.
|
|
176
|
-
|
|
174
|
+
# This is the constructor of the LLM provider from jupyter-ai
|
|
175
|
+
# to which we forward the request to generate inline completions.
|
|
176
|
+
_init_llm_provider: Callable | None
|
|
177
|
+
|
|
178
|
+
_llm_provider_instance: Any | None
|
|
177
179
|
_llm_prefixer: Callable = lambda self, x: "wrong"
|
|
178
180
|
|
|
179
181
|
def __init__(self):
|
|
180
182
|
super().__init__()
|
|
181
183
|
self.skip_lines = 0
|
|
182
184
|
self._connected_apps = []
|
|
183
|
-
self.
|
|
185
|
+
self._llm_provider_instance = None
|
|
186
|
+
self._init_llm_provider = None
|
|
184
187
|
self._request_number = 0
|
|
185
188
|
|
|
186
189
|
def reset_history_position(self, _: Buffer) -> None:
|
|
@@ -317,6 +320,16 @@ class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):
|
|
|
317
320
|
"LLM task not cancelled, does your provider support cancellation?"
|
|
318
321
|
)
|
|
319
322
|
|
|
323
|
+
@property
|
|
324
|
+
def _llm_provider(self):
|
|
325
|
+
"""Lazy-initialized instance of the LLM provider.
|
|
326
|
+
|
|
327
|
+
Do not use in the constructor, as `_init_llm_provider` can trigger slow side-effects.
|
|
328
|
+
"""
|
|
329
|
+
if self._llm_provider_instance is None and self._init_llm_provider:
|
|
330
|
+
self._llm_provider_instance = self._init_llm_provider()
|
|
331
|
+
return self._llm_provider_instance
|
|
332
|
+
|
|
320
333
|
async def _trigger_llm(self, buffer) -> None:
|
|
321
334
|
"""
|
|
322
335
|
This will ask the current llm provider a suggestion for the current buffer.
|
|
@@ -325,14 +338,14 @@ class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):
|
|
|
325
338
|
"""
|
|
326
339
|
# we likely want to store the current cursor position, and cancel if the cursor has moved.
|
|
327
340
|
try:
|
|
328
|
-
import
|
|
341
|
+
import jupyter_ai_magics
|
|
329
342
|
except ModuleNotFoundError:
|
|
330
|
-
|
|
343
|
+
jupyter_ai_magics = None
|
|
331
344
|
if not self._llm_provider:
|
|
332
345
|
warnings.warn("No LLM provider found, cannot trigger LLM completions")
|
|
333
346
|
return
|
|
334
|
-
if
|
|
335
|
-
warnings.warn("LLM Completion requires `
|
|
347
|
+
if jupyter_ai_magics is None:
|
|
348
|
+
warnings.warn("LLM Completion requires `jupyter_ai_magics` to be installed")
|
|
336
349
|
|
|
337
350
|
self._cancel_running_llm_task()
|
|
338
351
|
|
|
@@ -359,7 +372,7 @@ class NavigableAutoSuggestFromHistory(AutoSuggestFromHistory):
|
|
|
359
372
|
provider to stream it's response back to us iteratively setting it as
|
|
360
373
|
the suggestion on the current buffer.
|
|
361
374
|
|
|
362
|
-
Unlike with JupyterAi, as we do not have multiple
|
|
375
|
+
Unlike with JupyterAi, as we do not have multiple cells, the cell id
|
|
363
376
|
is always set to `None`.
|
|
364
377
|
|
|
365
378
|
We set the prefix to the current cell content, but could also insert the
|
IPython/utils/_sysinfo.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# GENERATED BY setup.py
|
|
2
|
-
commit = "
|
|
2
|
+
commit = "e87cb2a40"
|
|
@@ -10,7 +10,7 @@ IPython/core/async_helpers.py,sha256=4x_ZSrPImXi0oXzwImaLc3eXlkdLi-4RXh2HcX8YDQg
|
|
|
10
10
|
IPython/core/autocall.py,sha256=zw7siKc1ocagCuXn4OuT0o7YbyZSuW3a7la204ANRk4,1983
|
|
11
11
|
IPython/core/builtin_trap.py,sha256=4Bls1x1Xaf3oGbj6GFXE--G6qZlNq7AYFjp_vyu55p8,3006
|
|
12
12
|
IPython/core/compilerop.py,sha256=tA8xHh10gp85brI2OYmvl7kW0TgDghdKbzmZE7nS4sw,6990
|
|
13
|
-
IPython/core/completer.py,sha256=
|
|
13
|
+
IPython/core/completer.py,sha256=xczIOWv2i6fKjt2neeSLCeMvBMPIV-OQbE7ggBQB_PU,129815
|
|
14
14
|
IPython/core/completerlib.py,sha256=C_1uFwR4eiqIsemMRbluMQV1WJ3qSfnGxO01PsGSpr8,12641
|
|
15
15
|
IPython/core/crashhandler.py,sha256=8-kyI6aNkqbaB_lBlbNKAOFv34HDBCpLggMfiu4oIDg,8747
|
|
16
16
|
IPython/core/debugger.py,sha256=I3LA4HQFEP5cy-kbbRvJqlLlSgVHSWBbp0cbPs3nU8M,41806
|
|
@@ -25,12 +25,12 @@ IPython/core/events.py,sha256=U-Qm93khPgrLrB09zqH8Hvb6QldPVES-LIuSdGsxLXk,5243
|
|
|
25
25
|
IPython/core/extensions.py,sha256=KgohNiowl71W-V0WYXWKw7g-q85QN9c_FxtraJoEOvY,5020
|
|
26
26
|
IPython/core/formatters.py,sha256=9hyrvbkIxbO26VQvOsKVI3xbnLgJOAmJiQUo8U95V6k,36500
|
|
27
27
|
IPython/core/getipython.py,sha256=RjTylt9N3c8AFZ-Y440A8My4tfFCgO-lVkyOL0xoOzQ,894
|
|
28
|
-
IPython/core/guarded_eval.py,sha256=
|
|
28
|
+
IPython/core/guarded_eval.py,sha256=MglgA6KSJNHibvs5Ygjaaol6DB4NMagNwwx7HbiIhqA,29901
|
|
29
29
|
IPython/core/history.py,sha256=5hmGOe1H93tCtWj_d8HdFixDCr0kdEqahGJ-zUo03RQ,41183
|
|
30
30
|
IPython/core/historyapp.py,sha256=5H38INsWXRacscKz_5PQHYrEnHEayDtc1D1qcSyHRBU,5847
|
|
31
31
|
IPython/core/hooks.py,sha256=xBWTZqycxZi97yj01IFc-SoJBzV5B73IoDHbAAlKUpQ,5193
|
|
32
32
|
IPython/core/inputtransformer2.py,sha256=7sRleytrcAbp5PZMOrDw59MjUAGXg5BbaRbPkSW83-I,28909
|
|
33
|
-
IPython/core/interactiveshell.py,sha256=
|
|
33
|
+
IPython/core/interactiveshell.py,sha256=nFDmQXdbYO85nExVC_OhCwyvu1mtImI7RNsWxSNo7dw,159075
|
|
34
34
|
IPython/core/latex_symbols.py,sha256=DzFecvqWVSsdN7vWAsp0mlYAHRDQKfZGAmvuDUh0M-s,30127
|
|
35
35
|
IPython/core/logger.py,sha256=Iwe4xKMmxEdvSwHYPMfsTWkmdaqVCgvZT3R3I3qTmrU,8436
|
|
36
36
|
IPython/core/macro.py,sha256=OhvXWNhLe393rI2wTpMgbUVHWSnmC_ycHiYqzqSHXZU,1726
|
|
@@ -44,7 +44,7 @@ IPython/core/prefilter.py,sha256=JHQ3feaD4bhoBDqZcEgmlDjQ2sfRXC1DNjgJhpaMU7E,257
|
|
|
44
44
|
IPython/core/profileapp.py,sha256=bFMFIyehxeF9pDUtxw_6D3b0nxeqsupKTe7XhH7GMkc,10711
|
|
45
45
|
IPython/core/profiledir.py,sha256=-vjOa1I_UajMZJblJRYXh16Y0RaAUn5a2swQBsw2qEU,8459
|
|
46
46
|
IPython/core/pylabtools.py,sha256=LfNV9xCJ3flCfJXmv1NaCRYj9jZDtHAQ5oSEHWo3Gmg,17376
|
|
47
|
-
IPython/core/release.py,sha256=
|
|
47
|
+
IPython/core/release.py,sha256=7T2aiCX5S_TTkk9TYSdLgJR90mt0IAtGO8eUJ6DNNNE,1505
|
|
48
48
|
IPython/core/shellapp.py,sha256=oZIzj_sqIXrN3qyyhinZ1gLXvFviKYHkmS4H3wVEb74,19307
|
|
49
49
|
IPython/core/splitinput.py,sha256=bAX1puQjvYB-otJyqiqeOhWj6dooWuQeNVx2YdaKQs8,5006
|
|
50
50
|
IPython/core/tbtools.py,sha256=X4iB5zKAT2y4TK1R9l3d3kiW5htrzKn3qxalFFe2xzI,16880
|
|
@@ -96,7 +96,7 @@ IPython/sphinxext/ipython_directive.py,sha256=hOQCdWx2N7WzBJVHMw7qVvAwLJxBZJxFCE
|
|
|
96
96
|
IPython/terminal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
97
|
IPython/terminal/debugger.py,sha256=0LdBmCKVHKNGpmBKdb4bBgKlyuTVyfz2Dg2Y8wE4FTM,6937
|
|
98
98
|
IPython/terminal/embed.py,sha256=uR1Z7wp5z5SpYto7sa9A63sPDtX5h0XD048Y3gDE_V0,16164
|
|
99
|
-
IPython/terminal/interactiveshell.py,sha256=
|
|
99
|
+
IPython/terminal/interactiveshell.py,sha256=PLdnb2qWyIuEh2lY1ROBVOOxHKk1lS2z-zjljUwgMgE,39879
|
|
100
100
|
IPython/terminal/ipapp.py,sha256=d2Rog4DRkVv0_fReqZOuorKMXAtEqsCskwPejtjj0Lg,12512
|
|
101
101
|
IPython/terminal/magics.py,sha256=49ZVJzbAUkG_EFpebxIBEqm3tEClvqefoeM6QnxGrrk,7705
|
|
102
102
|
IPython/terminal/prompts.py,sha256=5IoXb-pXA4MWu3gAfEuyIwZUbDg6mxxJuMkOqRBmYa0,4555
|
|
@@ -114,7 +114,7 @@ IPython/terminal/pt_inputhooks/tk.py,sha256=FjejvtwbvpeBZLoBCci1RDo_jWD5qElMy7PP
|
|
|
114
114
|
IPython/terminal/pt_inputhooks/wx.py,sha256=9yI52lDSZ3O_5Gww_3IeenEk_3PepLIME3Onh4X3kW0,7126
|
|
115
115
|
IPython/terminal/shortcuts/__init__.py,sha256=irSX9mwHzeLDQ95fXRGdZxduRknwATtESvm2NIov7KU,18563
|
|
116
116
|
IPython/terminal/shortcuts/auto_match.py,sha256=9uT1fDb-c4Ew7TSIs_zET1jSxDlbfWGluxfW_pj39tk,3066
|
|
117
|
-
IPython/terminal/shortcuts/auto_suggest.py,sha256=
|
|
117
|
+
IPython/terminal/shortcuts/auto_suggest.py,sha256=jJm6PVTddzGom8AxVPl3sNIedUg1pU4tvwEwvRqm1cI,23803
|
|
118
118
|
IPython/terminal/shortcuts/filters.py,sha256=MgRTQWq8YfIyWvMASuQ9BGKq5RQwiEY5trSyMnMtJAo,10998
|
|
119
119
|
IPython/testing/__init__.py,sha256=9t97XO03Ez9GdZA5FWZYmfyHZt2c3AqQe2dj_0AiPJY,784
|
|
120
120
|
IPython/testing/decorators.py,sha256=0MmtdZsh0EehAIV73V3hTCM9gr-elFr4QTRP7sJqPc8,4430
|
|
@@ -142,7 +142,7 @@ IPython/utils/_process_emscripten.py,sha256=lGLQb2IgmanNtb502KflfuKIhgOF119Ji3cw
|
|
|
142
142
|
IPython/utils/_process_posix.py,sha256=aOEtguhS3vdWngBpws1XQURO8Ozqd5gRiCk9VLky6tA,7502
|
|
143
143
|
IPython/utils/_process_win32.py,sha256=Pcf6ZiqMbqDT79edzegE_AX3D367UtE8bbhT41no54A,6775
|
|
144
144
|
IPython/utils/_process_win32_controller.py,sha256=hi2eR7mLbl3TTMCVbgps85GppxdtYbhOYK_l13WvYaM,21343
|
|
145
|
-
IPython/utils/_sysinfo.py,sha256=
|
|
145
|
+
IPython/utils/_sysinfo.py,sha256=08M3HsNfrqEo6YkNSl9dN69UHyrECgtABfkCQUrexqk,45
|
|
146
146
|
IPython/utils/capture.py,sha256=h5yL5Lxq8bgO1SFpoNDYjEi6mh1IW_2X9CE7vOsUxE4,5137
|
|
147
147
|
IPython/utils/coloransi.py,sha256=CML-SkzLa7oaIK1qypb3uwcfPXDeKHxZQiMJ0IWvUY0,293
|
|
148
148
|
IPython/utils/contexts.py,sha256=w5_uXc0WTU3KKV1kcCW9A0_Mz5mGRoeGWMq_P_eo-Dg,1610
|
|
@@ -174,11 +174,11 @@ IPython/utils/text.py,sha256=6s-y4KvDmnJxLs0urf5D-1auZGSnj2xmXgQ-9jVu0N8,18788
|
|
|
174
174
|
IPython/utils/timing.py,sha256=nND-ZUBkHWfYevvbRG-YfOSIFczz_epzMqWK5PH6nqA,4275
|
|
175
175
|
IPython/utils/tokenutil.py,sha256=x6KQ6ZCGOY7j5GQcr7byJRZSBFgyBcfkTiLtjxkl9f8,6552
|
|
176
176
|
IPython/utils/wildcard.py,sha256=6EEc3OEYp-IuSoidL6nwpaHg--GxnzbAJTmFiz77CNE,4612
|
|
177
|
-
ipython-9.
|
|
178
|
-
ipython-9.
|
|
179
|
-
ipython-9.
|
|
180
|
-
ipython-9.
|
|
181
|
-
ipython-9.
|
|
182
|
-
ipython-9.
|
|
183
|
-
ipython-9.
|
|
184
|
-
ipython-9.
|
|
177
|
+
ipython-9.3.0.data/data/share/man/man1/ipython.1,sha256=PVdQP2hHmHyUEwzLOPcgavnCe9jTDVrM1jKZt4cnF_Q,2058
|
|
178
|
+
ipython-9.3.0.dist-info/licenses/COPYING.rst,sha256=NBr8vXKYh7cEb-e5j8T07f867Y048G7v2bMGcPBD3xc,1639
|
|
179
|
+
ipython-9.3.0.dist-info/licenses/LICENSE,sha256=4OOQdI7UQKuJPKHxNaiKkgqvVAnbuQpbQnx1xeUSaPs,1720
|
|
180
|
+
ipython-9.3.0.dist-info/METADATA,sha256=PLMXmc_ptvho0DnNgFp4AFEqUxL3ikB9OaYqtJbgfzw,4431
|
|
181
|
+
ipython-9.3.0.dist-info/WHEEL,sha256=aCYgKU6ypALRDRz4OvLmTVj8mlMrXZlQylkgDKtOmfQ,90
|
|
182
|
+
ipython-9.3.0.dist-info/entry_points.txt,sha256=z5BEEohWgg0SHdgdeNABf4T3fu-lr9W6F_bWOQHLdVs,83
|
|
183
|
+
ipython-9.3.0.dist-info/top_level.txt,sha256=PKjvHtNCBZ9EHTmd2mwJ1J_k3j0F6D1lTFzIcJFFPEU,8
|
|
184
|
+
ipython-9.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|