codebind 0.4.2__tar.gz → 0.4.3__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.
- {codebind-0.4.2 → codebind-0.4.3}/PKG-INFO +4 -7
- {codebind-0.4.2 → codebind-0.4.3}/README.md +3 -6
- {codebind-0.4.2 → codebind-0.4.3}/pyproject.toml +1 -1
- {codebind-0.4.2 → codebind-0.4.3}/pyproject.toml.orig +1 -1
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/extension.py +24 -0
- {codebind-0.4.2 → codebind-0.4.3}/LICENSE +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/install.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/package.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/static/590.6544266cd73a003b.js +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/static/remoteEntry.6f017385dfc989f1.js +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/static/style.js +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/static/third-party-licenses.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/.yarnrc.yml +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/install.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/package.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/src/index.ts +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/tsconfig.json +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/jupyterlab/yarn.lock +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/__init__.py +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/cli.py +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/display.py +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/execution.py +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/jupyter.py +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/py.typed +0 -0
- {codebind-0.4.2 → codebind-0.4.3}/src/codebind/session.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebind
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: A frontend-neutral model loop for persistent IPython sessions.
|
|
5
5
|
Keywords: ai,ipython,llm,repl,agents
|
|
6
6
|
Author: Giovanni Gravili
|
|
@@ -47,11 +47,9 @@ After installation, start ordinary IPython with the Codebind extension from any
|
|
|
47
47
|
codebind
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
It opens standard IPython with `chat` and `Models` in the user namespace. All normal IPython command-line options remain available.
|
|
50
|
+
It opens standard IPython with `chat`, `models`, and `Models` in the user namespace. `models` loads provider values from `$XDG_CONFIG_HOME/codebind/models.json`, or `~/.config/codebind/models.json` when `XDG_CONFIG_HOME` is unset. Keep that credential file readable only by its owner. All normal IPython command-line options remain available.
|
|
51
51
|
|
|
52
52
|
```python
|
|
53
|
-
models = Models({"openai": "OPENAI_API_KEY"})
|
|
54
|
-
|
|
55
53
|
chat.send(
|
|
56
54
|
"Inspect this project and tell me what to implement first.",
|
|
57
55
|
models.chat("openai/gpt-5", reasoning_effort="medium"),
|
|
@@ -65,7 +63,7 @@ Codebind does not load files or construct a project prompt automatically. The us
|
|
|
65
63
|
Start JupyterLab with Codebind from any directory without a permanent installation:
|
|
66
64
|
|
|
67
65
|
```console
|
|
68
|
-
uvx --from jupyterlab --with codebind jupyter lab
|
|
66
|
+
uvx --from jupyterlab --with codebind --with 'nbconvert[webpdf]' jupyter lab
|
|
69
67
|
```
|
|
70
68
|
|
|
71
69
|
Or install both packages into the same environment, then start JupyterLab normally:
|
|
@@ -84,7 +82,6 @@ Load Codebind in a notebook:
|
|
|
84
82
|
Run that cell once so JupyterLab can connect to the extension, then use Codebind in later cells:
|
|
85
83
|
|
|
86
84
|
```python
|
|
87
|
-
models = Models({"openai": "OPENAI_API_KEY"})
|
|
88
85
|
model = models.chat("openai/gpt-5")
|
|
89
86
|
await chat.asend("Inspect the current notebook state.", model)
|
|
90
87
|
```
|
|
@@ -111,6 +108,6 @@ chat.send(
|
|
|
111
108
|
)
|
|
112
109
|
```
|
|
113
110
|
|
|
114
|
-
The authorization remains in memory for this session.
|
|
111
|
+
The authorization remains in memory for this session. Save provider values as a JSON object in Codebind's XDG configuration file and reload the extension to expose them through `models`.
|
|
115
112
|
|
|
116
113
|
OpenAI officially supports ChatGPT subscription sign-in for Codex clients. Models Provider reproduces that account-access boundary for this library; it is separate from the public, pay-as-you-go OpenAI API and may require compatibility updates when the Codex account protocol changes.
|
|
@@ -22,11 +22,9 @@ After installation, start ordinary IPython with the Codebind extension from any
|
|
|
22
22
|
codebind
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
It opens standard IPython with `chat` and `Models` in the user namespace. All normal IPython command-line options remain available.
|
|
25
|
+
It opens standard IPython with `chat`, `models`, and `Models` in the user namespace. `models` loads provider values from `$XDG_CONFIG_HOME/codebind/models.json`, or `~/.config/codebind/models.json` when `XDG_CONFIG_HOME` is unset. Keep that credential file readable only by its owner. All normal IPython command-line options remain available.
|
|
26
26
|
|
|
27
27
|
```python
|
|
28
|
-
models = Models({"openai": "OPENAI_API_KEY"})
|
|
29
|
-
|
|
30
28
|
chat.send(
|
|
31
29
|
"Inspect this project and tell me what to implement first.",
|
|
32
30
|
models.chat("openai/gpt-5", reasoning_effort="medium"),
|
|
@@ -40,7 +38,7 @@ Codebind does not load files or construct a project prompt automatically. The us
|
|
|
40
38
|
Start JupyterLab with Codebind from any directory without a permanent installation:
|
|
41
39
|
|
|
42
40
|
```console
|
|
43
|
-
uvx --from jupyterlab --with codebind jupyter lab
|
|
41
|
+
uvx --from jupyterlab --with codebind --with 'nbconvert[webpdf]' jupyter lab
|
|
44
42
|
```
|
|
45
43
|
|
|
46
44
|
Or install both packages into the same environment, then start JupyterLab normally:
|
|
@@ -59,7 +57,6 @@ Load Codebind in a notebook:
|
|
|
59
57
|
Run that cell once so JupyterLab can connect to the extension, then use Codebind in later cells:
|
|
60
58
|
|
|
61
59
|
```python
|
|
62
|
-
models = Models({"openai": "OPENAI_API_KEY"})
|
|
63
60
|
model = models.chat("openai/gpt-5")
|
|
64
61
|
await chat.asend("Inspect the current notebook state.", model)
|
|
65
62
|
```
|
|
@@ -86,6 +83,6 @@ chat.send(
|
|
|
86
83
|
)
|
|
87
84
|
```
|
|
88
85
|
|
|
89
|
-
The authorization remains in memory for this session.
|
|
86
|
+
The authorization remains in memory for this session. Save provider values as a JSON object in Codebind's XDG configuration file and reload the extension to expose them through `models`.
|
|
90
87
|
|
|
91
88
|
OpenAI officially supports ChatGPT subscription sign-in for Codex clients. Models Provider reproduces that account-access boundary for this library; it is separate from the public, pay-as-you-go OpenAI API and may require compatibility updates when the Codex account protocol changes.
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
5
8
|
from typing import Any
|
|
6
9
|
|
|
7
10
|
from IPython.core.interactiveshell import InteractiveShell
|
|
@@ -14,8 +17,28 @@ from .session import Session
|
|
|
14
17
|
_NAMESPACE_ATTRIBUTE = "_codebind_extension_namespace"
|
|
15
18
|
|
|
16
19
|
|
|
20
|
+
def _models_path() -> Path:
|
|
21
|
+
configured = os.environ.get("XDG_CONFIG_HOME")
|
|
22
|
+
if configured:
|
|
23
|
+
config_home = Path(configured).expanduser()
|
|
24
|
+
if config_home.is_absolute():
|
|
25
|
+
return config_home / "codebind" / "models.json"
|
|
26
|
+
return Path.home() / ".config" / "codebind" / "models.json"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _load_models() -> Models:
|
|
30
|
+
path = _models_path()
|
|
31
|
+
if not path.exists():
|
|
32
|
+
return Models()
|
|
33
|
+
values = json.loads(path.read_text())
|
|
34
|
+
if not isinstance(values, dict):
|
|
35
|
+
raise ValueError(f"Codebind model configuration must be a JSON object: {path}")
|
|
36
|
+
return Models(values)
|
|
37
|
+
|
|
38
|
+
|
|
17
39
|
def load_ipython_extension(ipython: InteractiveShell) -> None:
|
|
18
40
|
"""Load Codebind into the active IPython user namespace."""
|
|
41
|
+
models = _load_models()
|
|
19
42
|
previous = getattr(ipython, _NAMESPACE_ATTRIBUTE, None)
|
|
20
43
|
if isinstance(previous, dict):
|
|
21
44
|
previous_chat = previous.get("chat")
|
|
@@ -26,6 +49,7 @@ def load_ipython_extension(ipython: InteractiveShell) -> None:
|
|
|
26
49
|
namespace: dict[str, Any] = {
|
|
27
50
|
"chat": Session(shell=ipython, bridge=bridge),
|
|
28
51
|
"Models": Models,
|
|
52
|
+
"models": models,
|
|
29
53
|
}
|
|
30
54
|
ipython.push(namespace)
|
|
31
55
|
setattr(ipython, _NAMESPACE_ATTRIBUTE, namespace)
|
|
File without changes
|
{codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/install.json
RENAMED
|
File without changes
|
{codebind-0.4.2 → codebind-0.4.3}/data/share/jupyter/labextensions/codebind-jupyterlab/package.json
RENAMED
|
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
|
|
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
|