Skip to content

Commit

Permalink
feat: make pixi-kernel work independently of kernel provisioner (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-r-santos authored Apr 17, 2024
1 parent b0e7972 commit 8d98fc8
Show file tree
Hide file tree
Showing 25 changed files with 3,086 additions and 1,118 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ jobs:
run-install: false
- name: Run code quality checks
run: pixi run --locked --environment ruff lint
type-check:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Pixi ${{ env.pixi-version }}
uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: v${{ env.pixi-version }}
run-install: false
- name: Run type checks
run: pixi run --locked --environment mypy type-check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ dist
# ruff
/.ruff_cache

# MyPy
.mypy_cache

# IDEs
/.vscode

Expand Down
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ pixi run -e py38 test-py38

## Code quality

Pixi Kernel uses Ruff to ensure a minimum standard of code quality. The code quality commands are
encapsulated with Pixi:
Pixi Kernel uses Ruff and MyPy to ensure a minimum standard of code quality. The code quality
commands are encapsulated with Pixi:

```
pixi run format
pixi run lint
pixi run type-check
```

## Making a release
Expand Down Expand Up @@ -76,7 +77,9 @@ Follow the steps below to add support for a new kernel:
1. In a fresh Pixi environment install your kernel with `pixi install <kernel>`.
2. Copy the new folders created at `.pixi/envs/default/share/jupyter/kernels/` to the `kernels`
folder and commit the changes.
3. Update the display name, metadata and command arguments in the kernel spec file `kernel.json`.
3. Update the display name and command arguments in the kernel spec file `kernel.json`. The command
arguments should start with `["python", "-m", "pixi_kernel", <package_name>,
<kernel_display_name>]` and all absolute paths should be removed.
4. Update the Kernel Support table in the README.
5. Add integration tests for the new kernel in the `tests/integration` folder and commit the
changes.
Expand Down
19 changes: 6 additions & 13 deletions kernels/pixi-kernel-bash/kernel.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"bash_kernel",
"Pixi - Bash",
"python",
"-m",
"bash_kernel",
Expand All @@ -11,14 +13,5 @@
],
"display_name": "Pixi - Bash",
"env": { "PS1": "$" },
"language": "bash",
"metadata": {
"pixi-kernel": {
"package-name": "bash_kernel"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
}
"language": "bash"
}
24 changes: 6 additions & 18 deletions kernels/pixi-kernel-ir/kernel.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"r-irkernel",
"Pixi - R",
"R",
"--slave",
"-e",
Expand All @@ -11,19 +13,5 @@
"{connection_file}"
],
"display_name": "Pixi - R",
"language": "R",
"env": {
"R_LIBS": "{manifest-path-parent}/.pixi/envs/default/lib/R/library",
"R_LIBS_SITE": "{manifest-path-parent}/.pixi/envs/default/lib/R/library",
"R_LIBS_USER": "{manifest-path-parent}/.pixi/envs/default/lib/R/library"
},
"metadata": {
"pixi-kernel": {
"package-name": "r-irkernel"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
}
"language": "R"
}
17 changes: 6 additions & 11 deletions kernels/pixi-kernel-python3/kernel.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"ipykernel",
"Pixi - Python 3 (ipykernel)",
"python",
"-m",
"ipykernel_launcher",
Expand All @@ -12,13 +14,6 @@
"display_name": "Pixi - Python 3 (ipykernel)",
"language": "python",
"metadata": {
"debugger": true,
"pixi-kernel": {
"package-name": "ipykernel"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
"debugger": true
}
}
21 changes: 7 additions & 14 deletions kernels/pixi-kernel-xcpp11/kernel.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"display_name": "Pixi - C++11",
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"xeus-cling",
"Pixi - C++11",
"xcpp",
"-f",
"{connection_file}",
"-std=c++11"
],
"language": "C++11",
"metadata": {
"pixi-kernel": {
"package-name": "xeus-cling"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
}
"display_name": "Pixi - C++11",
"language": "C++11"
}
21 changes: 7 additions & 14 deletions kernels/pixi-kernel-xcpp14/kernel.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"display_name": "Pixi - C++14",
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"xeus-cling",
"Pixi - C++14",
"xcpp",
"-f",
"{connection_file}",
"-std=c++14"
],
"language": "C++14",
"metadata": {
"pixi-kernel": {
"package-name": "xeus-cling"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
}
"display_name": "Pixi - C++14",
"language": "C++14"
}
21 changes: 7 additions & 14 deletions kernels/pixi-kernel-xcpp17/kernel.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"display_name": "Pixi - C++17",
"argv": [
"pixi",
"run",
"--manifest-path={manifest-path}",
"python",
"-m",
"pixi_kernel",
"xeus-cling",
"Pixi - C++17",
"xcpp",
"-f",
"{connection_file}",
"-std=c++17"
],
"language": "C++17",
"metadata": {
"pixi-kernel": {
"package-name": "xeus-cling"
},
"kernel_provisioner": {
"provisioner_name": "pixi-provisioner",
"config": {}
}
}
"display_name": "Pixi - C++17",
"language": "C++17"
}
Loading

0 comments on commit 8d98fc8

Please sign in to comment.