-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from renan-r-santos/mybinder
- Loading branch information
Showing
11 changed files
with
5,869 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# GitHub syntax highlighting | ||
pixi.lock linguist-language=YAML | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# pixi environments | ||
.pixi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# This is an example notebook that demonstrates using the Pixi Kernel\n", | ||
"\n", | ||
"When asked to select a kernel, select \"Pixi Kernel\".\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# This adds the numpy package to your current environment\n", | ||
"# Check your `pixi.toml` file to see the changes\n", | ||
"!pixi add numpy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"\n", | ||
"# You can see that it is using the numpy package from the default Pixi environment\n", | ||
"np.__file__" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[project] | ||
name = "example" | ||
version = "0.1.0" | ||
description = "Example project for pixi-kernel" | ||
channels = ["conda-forge"] | ||
platforms = ["linux-64", "linux-aarch64"] | ||
|
||
[dependencies] | ||
python = "3.12.*" | ||
ipykernel = "6.*" # It is necessary to install the ipykernel to be able to use pixi-kernel |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[project] | ||
name = "binder" | ||
version = "0.1.0" | ||
description = "Binder example" | ||
authors = ["Renan Rodrigues dos Santos <renan.engmec@gmail.com>"] | ||
channels = ["conda-forge"] | ||
platforms = ["linux-64", "linux-aarch64"] | ||
|
||
[dependencies] | ||
python = "3.12.*" | ||
jupyterlab = "4.1.*" | ||
jupyterhub = "4.1.*" | ||
notebook = "7.1.*" | ||
pixi-kernel = "0.1.*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Python | ||
**/__pycache__ | ||
.pytest_cache | ||
|
||
# Pixi and Setuptools | ||
/build | ||
/dist | ||
*.egg-info | ||
**/.pixi | ||
|
||
# ruff | ||
/.ruff_cache | ||
|
||
# IDEs | ||
/.vscode | ||
|
||
# coverage | ||
/.coverage* | ||
/htmlcov | ||
/coverage.xml | ||
|
||
# System | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
################################################################################################### | ||
# Environment builder | ||
################################################################################################### | ||
FROM ghcr.io/prefix-dev/pixi:0.18.0-jammy as pixi-builder | ||
|
||
ENV PIXI_LOCKED=true | ||
|
||
WORKDIR /opt/binder | ||
|
||
# Install environment | ||
COPY .binder/pixi.toml pixi.toml | ||
COPY .binder/pixi.lock pixi.lock | ||
RUN pixi install && \ | ||
pixi shell-hook --shell bash > /pixi-activate.sh && \ | ||
chmod +x /pixi-activate.sh | ||
|
||
# Clean up | ||
RUN find .pixi \( -name '*.a' -o -name '*.pyc' -o -name '*.pyx' -o -name '*.pyo' \) -delete && \ | ||
find .pixi -name '__pycache__' -type d -exec rm -rf '{}' '+' | ||
|
||
|
||
################################################################################################### | ||
# Final image | ||
################################################################################################### | ||
FROM ghcr.io/prefix-dev/pixi:0.18.0-jammy | ||
|
||
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html | ||
ARG NB_USER=jovyan | ||
ARG NB_UID=1000 | ||
ENV USER ${NB_USER} | ||
ENV NB_UID ${NB_UID} | ||
ENV HOME /home/${NB_USER} | ||
ENV SHELL=/bin/bash | ||
|
||
RUN adduser --disabled-password \ | ||
--gecos "Default user" \ | ||
--uid ${NB_UID} \ | ||
${NB_USER} | ||
|
||
RUN echo '#!/bin/bash\n. /usr/local/share/pixi-activate.sh\nexec "$@"' > /usr/local/share/docker-entrypoint.sh && \ | ||
chmod +x /usr/local/share/docker-entrypoint.sh | ||
|
||
# Make sure the contents of this repo are in ${HOME} and owned by ${NB_USER} | ||
COPY . ${HOME} | ||
RUN mv ${HOME}/.binder/example ${HOME}/work && \ | ||
chown -R ${NB_UID} ${HOME} | ||
|
||
USER ${NB_USER} | ||
|
||
# Copy the environment | ||
COPY --from=pixi-builder /opt/binder/.pixi /opt/binder/.pixi | ||
COPY --from=pixi-builder /pixi-activate.sh /usr/local/share/pixi-activate.sh | ||
|
||
WORKDIR ${HOME}/work | ||
|
||
# Install the example | ||
RUN pixi install --manifest-path pixi.toml | ||
|
||
ENTRYPOINT ["/usr/local/share/docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters