nb-nebi-kernels 0.1__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.
- nb_nebi_kernels-0.1/.gitattributes +2 -0
- nb_nebi_kernels-0.1/.github/workflows/release.yaml +76 -0
- nb_nebi_kernels-0.1/.gitignore +33 -0
- nb_nebi_kernels-0.1/PKG-INFO +97 -0
- nb_nebi_kernels-0.1/README.md +73 -0
- nb_nebi_kernels-0.1/pixi.lock +6045 -0
- nb_nebi_kernels-0.1/pyproject.toml +124 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/__init__.py +4 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/_version.py +34 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/discovery.py +127 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/jupyter-config/jupyter_server_config.d/nb_nebi_kernels.json +5 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/launcher.py +69 -0
- nb_nebi_kernels-0.1/src/nb_nebi_kernels/manager.py +158 -0
- nb_nebi_kernels-0.1/tests/test_discovery.py +121 -0
- nb_nebi_kernels-0.1/tests/test_launcher.py +103 -0
- nb_nebi_kernels-0.1/tests/test_manager.py +145 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Test & Publish PyPI release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test-pypi:
|
|
9
|
+
name: Test PyPI release
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
|
|
19
|
+
- name: Upgrade pip
|
|
20
|
+
run: python -m pip install --upgrade pip build
|
|
21
|
+
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
|
|
27
|
+
- name: Create tag
|
|
28
|
+
# if present, remove leading `v`
|
|
29
|
+
run: |
|
|
30
|
+
echo "RELEASE_TAG=$(git describe --tags | sed 's/^v//')" >> $GITHUB_ENV
|
|
31
|
+
echo ${{ env.RELEASE_TAG }}
|
|
32
|
+
|
|
33
|
+
- name: Build source and binary
|
|
34
|
+
run: python -m build --sdist --wheel .
|
|
35
|
+
|
|
36
|
+
- name: Publish to Test PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
with:
|
|
39
|
+
repository-url: https://test.pypi.org/legacy/
|
|
40
|
+
|
|
41
|
+
- name: Sleep
|
|
42
|
+
run: sleep 120
|
|
43
|
+
|
|
44
|
+
- name: Test install from Test PyPI
|
|
45
|
+
run: |
|
|
46
|
+
pip install \
|
|
47
|
+
--index-url https://test.pypi.org/simple/ \
|
|
48
|
+
--extra-index-url https://pypi.org/simple \
|
|
49
|
+
nb-nebi-kernels==${{ env.RELEASE_TAG }}
|
|
50
|
+
|
|
51
|
+
release-pypi:
|
|
52
|
+
name: Publish to PyPI
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
needs: test-pypi
|
|
55
|
+
permissions:
|
|
56
|
+
id-token: write
|
|
57
|
+
contents: read
|
|
58
|
+
steps:
|
|
59
|
+
- name: Set up Python
|
|
60
|
+
uses: actions/setup-python@v5
|
|
61
|
+
with:
|
|
62
|
+
python-version: "3.12"
|
|
63
|
+
|
|
64
|
+
- name: Upgrade pip
|
|
65
|
+
run: python -m pip install --upgrade pip build
|
|
66
|
+
|
|
67
|
+
- name: Checkout repository
|
|
68
|
+
uses: actions/checkout@v4
|
|
69
|
+
with:
|
|
70
|
+
fetch-depth: 0
|
|
71
|
+
|
|
72
|
+
- name: Build source and binary
|
|
73
|
+
run: python -m build --sdist --wheel .
|
|
74
|
+
|
|
75
|
+
- name: Publish package
|
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Pixi
|
|
11
|
+
.pixi/
|
|
12
|
+
|
|
13
|
+
# IDE
|
|
14
|
+
.vscode/
|
|
15
|
+
.idea/
|
|
16
|
+
|
|
17
|
+
# Testing
|
|
18
|
+
.coverage
|
|
19
|
+
htmlcov/
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
|
|
22
|
+
# Jupyter
|
|
23
|
+
.ipynb_checkpoints/
|
|
24
|
+
*.ipynb
|
|
25
|
+
|
|
26
|
+
# Nested repos
|
|
27
|
+
nebi/
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
# pixi environments
|
|
32
|
+
.pixi/*
|
|
33
|
+
!.pixi/config.toml
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nb-nebi-kernels
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Jupyter KernelSpecManager that discovers kernels from nebi-tracked pixi workspaces
|
|
5
|
+
Project-URL: Homepage, https://github.com/nebari-dev/nb-nebi-kernels
|
|
6
|
+
Project-URL: Repository, https://github.com/nebari-dev/nb-nebi-kernels
|
|
7
|
+
Author: OpenTeams
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Framework :: Jupyter
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: jupyter-client>=8.0.0
|
|
21
|
+
Requires-Dist: jupyter-core>=5.0.0
|
|
22
|
+
Requires-Dist: jupyter-server>=2.0.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# nb-nebi-kernels
|
|
26
|
+
|
|
27
|
+
A custom Jupyter `KernelSpecManager` that automatically discovers [Nebi](https://github.com/nebari-dev/nebi)-tracked [Pixi](https://pixi.sh/) workspaces and exposes each environment as a launchable Jupyter kernel.
|
|
28
|
+
|
|
29
|
+
## How it works
|
|
30
|
+
|
|
31
|
+
1. Discovers locally-tracked workspaces via `nebi workspace list`
|
|
32
|
+
2. Enumerates pixi environments per workspace via `pixi workspace environment list`
|
|
33
|
+
3. Each (workspace, environment) pair appears as a selectable kernel in Jupyter
|
|
34
|
+
4. Kernels launch via `pixi run` in the workspace directory with full environment isolation
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install nb-nebi-kernels
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
That's it — the kernel spec manager is automatically configured when installed into your JupyterLab environment.
|
|
43
|
+
|
|
44
|
+
### Prerequisites
|
|
45
|
+
|
|
46
|
+
- [Nebi CLI](https://github.com/nebari-dev/nebi) on your PATH
|
|
47
|
+
- [Pixi](https://pixi.sh/) on your PATH
|
|
48
|
+
- At least one tracked nebi workspace (`nebi init` in a pixi project)
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Once installed, any nebi-tracked pixi workspace appears as a kernel in JupyterLab or Notebook:
|
|
53
|
+
|
|
54
|
+
- A workspace `data-science` with environments `default` and `gpu` shows as two kernels: **data-science (default)** and **data-science (gpu)**
|
|
55
|
+
- A workspace `web-app` with only the default environment shows as just **web-app**
|
|
56
|
+
|
|
57
|
+
If nebi or pixi are not installed, or no workspaces are tracked, Jupyter falls back to its default kernels — it never crashes.
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Install dev dependencies
|
|
63
|
+
pixi install -e dev
|
|
64
|
+
|
|
65
|
+
# Run tests
|
|
66
|
+
pixi run test
|
|
67
|
+
|
|
68
|
+
# Run tests with coverage
|
|
69
|
+
pixi run test-cov
|
|
70
|
+
|
|
71
|
+
# Run linting
|
|
72
|
+
pixi run lint
|
|
73
|
+
|
|
74
|
+
# Format code
|
|
75
|
+
pixi run format
|
|
76
|
+
|
|
77
|
+
# Run type checking
|
|
78
|
+
pixi run typecheck
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Architecture
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
src/nb_nebi_kernels/
|
|
85
|
+
├── __init__.py # Exports NebiKernelSpecManager
|
|
86
|
+
├── discovery.py # Subprocess calls to nebi + pixi CLIs
|
|
87
|
+
├── launcher.py # Kernel launcher with pixi environment isolation
|
|
88
|
+
└── manager.py # KernelSpecManager subclass (core logic)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- **discovery.py** — Parses `nebi workspace list` output, calls `pixi workspace environment list` per workspace. Filters out missing workspaces. Returns structured data.
|
|
92
|
+
- **launcher.py** — Clears PIXI_* environment variables to prevent inheriting parent context, then exec's `pixi run` in the workspace directory.
|
|
93
|
+
- **manager.py** — Subclasses `KernelSpecManager`, implements `find_kernel_specs()` and `get_kernel_spec()`. Merges parent kernels with nebi-discovered ones.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# nb-nebi-kernels
|
|
2
|
+
|
|
3
|
+
A custom Jupyter `KernelSpecManager` that automatically discovers [Nebi](https://github.com/nebari-dev/nebi)-tracked [Pixi](https://pixi.sh/) workspaces and exposes each environment as a launchable Jupyter kernel.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
1. Discovers locally-tracked workspaces via `nebi workspace list`
|
|
8
|
+
2. Enumerates pixi environments per workspace via `pixi workspace environment list`
|
|
9
|
+
3. Each (workspace, environment) pair appears as a selectable kernel in Jupyter
|
|
10
|
+
4. Kernels launch via `pixi run` in the workspace directory with full environment isolation
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install nb-nebi-kernels
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
That's it — the kernel spec manager is automatically configured when installed into your JupyterLab environment.
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
- [Nebi CLI](https://github.com/nebari-dev/nebi) on your PATH
|
|
23
|
+
- [Pixi](https://pixi.sh/) on your PATH
|
|
24
|
+
- At least one tracked nebi workspace (`nebi init` in a pixi project)
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Once installed, any nebi-tracked pixi workspace appears as a kernel in JupyterLab or Notebook:
|
|
29
|
+
|
|
30
|
+
- A workspace `data-science` with environments `default` and `gpu` shows as two kernels: **data-science (default)** and **data-science (gpu)**
|
|
31
|
+
- A workspace `web-app` with only the default environment shows as just **web-app**
|
|
32
|
+
|
|
33
|
+
If nebi or pixi are not installed, or no workspaces are tracked, Jupyter falls back to its default kernels — it never crashes.
|
|
34
|
+
|
|
35
|
+
## Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install dev dependencies
|
|
39
|
+
pixi install -e dev
|
|
40
|
+
|
|
41
|
+
# Run tests
|
|
42
|
+
pixi run test
|
|
43
|
+
|
|
44
|
+
# Run tests with coverage
|
|
45
|
+
pixi run test-cov
|
|
46
|
+
|
|
47
|
+
# Run linting
|
|
48
|
+
pixi run lint
|
|
49
|
+
|
|
50
|
+
# Format code
|
|
51
|
+
pixi run format
|
|
52
|
+
|
|
53
|
+
# Run type checking
|
|
54
|
+
pixi run typecheck
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
src/nb_nebi_kernels/
|
|
61
|
+
├── __init__.py # Exports NebiKernelSpecManager
|
|
62
|
+
├── discovery.py # Subprocess calls to nebi + pixi CLIs
|
|
63
|
+
├── launcher.py # Kernel launcher with pixi environment isolation
|
|
64
|
+
└── manager.py # KernelSpecManager subclass (core logic)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- **discovery.py** — Parses `nebi workspace list` output, calls `pixi workspace environment list` per workspace. Filters out missing workspaces. Returns structured data.
|
|
68
|
+
- **launcher.py** — Clears PIXI_* environment variables to prevent inheriting parent context, then exec's `pixi run` in the workspace directory.
|
|
69
|
+
- **manager.py** — Subclasses `KernelSpecManager`, implements `find_kernel_specs()` and `get_kernel_spec()`. Merges parent kernels with nebi-discovered ones.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|