ipymini 0.1.28__tar.gz → 0.1.30__tar.gz

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.
Files changed (29) hide show
  1. {ipymini-0.1.28 → ipymini-0.1.30}/PKG-INFO +2 -2
  2. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/__init__.py +3 -1
  3. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/shell/shell.py +7 -1
  4. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/shell/sighelp.py +8 -6
  5. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/PKG-INFO +2 -2
  6. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/requires.txt +1 -1
  7. {ipymini-0.1.28 → ipymini-0.1.30}/pyproject.toml +1 -1
  8. {ipymini-0.1.28 → ipymini-0.1.30}/LICENSE +0 -0
  9. {ipymini-0.1.28 → ipymini-0.1.30}/README.md +0 -0
  10. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/__main__.py +0 -0
  11. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/debug/__init__.py +0 -0
  12. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/debug/cells.py +0 -0
  13. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/debug/dap.py +0 -0
  14. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/kernel.py +0 -0
  15. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/shell/__init__.py +0 -0
  16. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/shell/comms.py +0 -0
  17. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/shell/ops.py +0 -0
  18. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/term/__init__.py +0 -0
  19. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/term/display.py +0 -0
  20. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/term/io.py +0 -0
  21. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/term/ipython_capture.py +0 -0
  22. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini/term/streams.py +0 -0
  23. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/SOURCES.txt +0 -0
  24. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/dependency_links.txt +0 -0
  25. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/entry_points.txt +0 -0
  26. {ipymini-0.1.28 → ipymini-0.1.30}/ipymini.egg-info/top_level.txt +0 -0
  27. {ipymini-0.1.28 → ipymini-0.1.30}/setup.cfg +0 -0
  28. {ipymini-0.1.28 → ipymini-0.1.30}/setup.py +0 -0
  29. {ipymini-0.1.28 → ipymini-0.1.30}/share/jupyter/kernels/py/kernel.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipymini
3
- Version: 0.1.28
3
+ Version: 0.1.30
4
4
  Summary: A small, readable Jupyter kernel for Python with strong IPython parity.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -8,7 +8,7 @@ License-File: LICENSE
8
8
  Requires-Dist: comm>=0.2.3
9
9
  Requires-Dist: fastcore>=2.2.37
10
10
  Requires-Dist: ipython>=8.18
11
- Requires-Dist: kernmini>=0.1.23
11
+ Requires-Dist: kernmini>=0.1.25
12
12
  Provides-Extra: dev
13
13
  Requires-Dist: jupyter_client>=8.6; extra == "dev"
14
14
  Requires-Dist: pytest>=7.4; extra == "dev"
@@ -1,4 +1,6 @@
1
- __version__ = "0.1.28"
1
+ __version__ = "0.1.30"
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -301,7 +301,7 @@ class MiniShell:
301
301
  if not self.ipy.enable_html_pager: bundle.pop("text/html", None)
302
302
  if sigs := sig_help(self.ipy, code, cursor_pos):
303
303
  bundle["application/json"] = sigs
304
- bundle.setdefault("text/plain", "\n".join(s["label"] for s in sigs))
304
+ bundle.setdefault("text/plain", "\n".join(s["label"] for s in sigs['signatures']))
305
305
  return dict(status="ok", found=bool(bundle), data=bundle, metadata={})
306
306
 
307
307
  def is_complete(self, code: str) -> dict:
@@ -326,3 +326,9 @@ class MiniShell:
326
326
  "Handle a debug_request DAP message."
327
327
  response, events = self.debugger.process_request(request)
328
328
  return {"response": response, "events": events}
329
+
330
+ def set_env(self, env: dict[str, str | None]):
331
+ "Update process environment variables; None values remove the key."
332
+ for k, v in env.items():
333
+ if v is None: os.environ.pop(k, None)
334
+ else: os.environ[k] = v
@@ -28,23 +28,25 @@ def _sig_dyn(ipy, code, cursor_pos):
28
28
  name = token_at_cursor(code, cursor_pos)
29
29
  info = ipy._object_find(name)
30
30
  if not (info.found and callable(info.obj)): return []
31
- try: ps = list(inspect.signature(info.obj).parameters.values())
31
+ try: sig = inspect.signature(info.obj)
32
32
  except (ValueError, TypeError): return []
33
+ ps = list(sig.parameters.values())
33
34
  idx = _param_idx(code, cursor_pos)
34
35
  vp = next((i for i, p in enumerate(ps) if p.kind is p.VAR_POSITIONAL), None)
35
36
  if vp is not None and idx > vp: idx = vp # *args takes every positional argument after it
36
- return [dict(label=name, typ=type(info.obj).__name__, mod=getattr(info.obj, "__module__", ""), idx=idx,
37
- doc=info.obj.__doc__ or "", params=[dict(name=p.name, desc=str(p)) for p in ps])]
37
+ return [dict(label=f'{name}{sig}', documentation=dict(value=inspect.getdoc(info.obj) or ''), activeParameter=idx,
38
+ parameters=[dict(label=str(p)) for p in ps])]
38
39
 
39
40
 
40
41
  def _sig_jedi(ipy, code, cursor_pos):
41
42
  "Signature help from jedi's static analysis, for calls that the namespace can't resolve, such as to a function defined in the same cell"
42
43
  line, col = code.count("\n", 0, cursor_pos) + 1, cursor_pos - code.rfind("\n", 0, cursor_pos) - 1
43
44
  sigs = jedi.Interpreter(code, [ipy.user_ns]).get_signatures(line, col) or jedi.Script(code).get_signatures(line, col)
44
- return [dict(label=s.description, typ=s.type, mod=s.module_name, doc=s.docstring(), idx=s.index,
45
- params=[dict(name=p.name, desc=p.description) for p in s.params]) for s in sigs]
45
+ return [dict(label=s.to_string(), documentation=dict(value=s.docstring()), activeParameter=s.index or 0,
46
+ parameters=[dict(label=p.to_string()) for p in s.params]) for s in sigs]
46
47
 
47
48
 
48
49
  def sig_help(ipy, code, cursor_pos):
49
50
  "Signature help for the call at `cursor_pos` in `code`"
50
- return _sig_dyn(ipy, code, cursor_pos) or _sig_jedi(ipy, code, cursor_pos)
51
+ sigs = _sig_dyn(ipy, code, cursor_pos) or _sig_jedi(ipy, code, cursor_pos)
52
+ return dict(signatures=sigs, activeSignature=0, activeParameter=sigs[0]['activeParameter']) if sigs else {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipymini
3
- Version: 0.1.28
3
+ Version: 0.1.30
4
4
  Summary: A small, readable Jupyter kernel for Python with strong IPython parity.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -8,7 +8,7 @@ License-File: LICENSE
8
8
  Requires-Dist: comm>=0.2.3
9
9
  Requires-Dist: fastcore>=2.2.37
10
10
  Requires-Dist: ipython>=8.18
11
- Requires-Dist: kernmini>=0.1.23
11
+ Requires-Dist: kernmini>=0.1.25
12
12
  Provides-Extra: dev
13
13
  Requires-Dist: jupyter_client>=8.6; extra == "dev"
14
14
  Requires-Dist: pytest>=7.4; extra == "dev"
@@ -1,7 +1,7 @@
1
1
  comm>=0.2.3
2
2
  fastcore>=2.2.37
3
3
  ipython>=8.18
4
- kernmini>=0.1.23
4
+ kernmini>=0.1.25
5
5
 
6
6
  [dev]
7
7
  jupyter_client>=8.6
@@ -12,7 +12,7 @@ dependencies = [
12
12
  "comm>=0.2.3",
13
13
  "fastcore>=2.2.37",
14
14
  "ipython>=8.18",
15
- "kernmini>=0.1.23",
15
+ "kernmini>=0.1.25",
16
16
  ]
17
17
 
18
18
  [project.optional-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes