feat: add Jupyter Lab support with installation and execution commands
This commit is contained in:
16 files changed
+276
-32
No files matched your search
@@ -1,23 +1,23 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy to Kubernetes
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
- name: Create Kubeconfig for Deployment
|
||||
run: |
|
||||
mkdir -p $HOME/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DEPLOY }}" > $HOME/.kube/config
|
||||
- name: Verify kubectl version
|
||||
run: ./kubectl version --client
|
||||
- name: Deploy to Kubernetes
|
||||
run: kubectl delete pods -l app=taskfile-build -n taskfile-build
|
||||
deploy:
|
||||
name: Deploy to Kubernetes
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
- name: Create Kubeconfig for Deployment
|
||||
run: |
|
||||
mkdir -p $HOME/.kube
|
||||
echo "${{ secrets.KUBECONFIG_DEPLOY }}" > $HOME/.kube/config
|
||||
- name: Verify kubectl version
|
||||
run: ./kubectl version --client
|
||||
- name: Deploy to Kubernetes
|
||||
run: kubectl delete pods -l app=taskfile-build -n taskfile-build
|
||||
@@ -49,6 +49,12 @@ The `./task` file is a bash script that provides all functions necessary to work
|
||||
|
||||
Always try to run a command with the `./task` file script.
|
||||
|
||||
### Jupyter Notebooks
|
||||
|
||||
**Run with timeout**: Run the notebook with `timeout 10 task run-jupyter-notebook <path> [env]`.
|
||||
|
||||
**Edit with MCP**: Launch Jupyter Lab and use the builtin MCP server to edit the notebooks.
|
||||
|
||||
## Coding conventions
|
||||
|
||||
### Bash
|
||||
@@ -104,4 +110,4 @@ The following guideline is heavily based on the [Bash Style Guide | ysap.sh](htt
|
||||
- Use single quotes for outputs without variables.
|
||||
- Use double quotes for outputs with variables.
|
||||
- Do not finish sentence with a dot if action is following (e.g. `"Backup file"`).
|
||||
- Finish sentence with a dot if echo is after action (e.g. `"Backup finished."`).
|
||||
- Finish sentence with a dot if echo is after action (e.g. `"Backup finished."`).
|
||||
@@ -34,6 +34,12 @@ Do not automatically install new software packages. Always ask for permission.
|
||||
|
||||
When creating temporary fiels and scripts, use the `./tmp` directory.
|
||||
|
||||
### Jupyter Notebooks
|
||||
|
||||
**Run with timeout**: Run the notebook with `timeout 10 task run-jupyter-notebook <path> [env]`.
|
||||
|
||||
**Edit with MCP**: Launch Jupyter Lab and use the builtin MCP server to edit the notebooks.
|
||||
|
||||
### Jupyter Notebook and Regex
|
||||
|
||||
Using regex patterns in Jupyter notebook cells is hard to edit for @Clanker tools. Create a Python file in a `./lib` folder that imports the necessary function to perform regex searches and replacements.
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
install-jupyter-lab() {
|
||||
activate-venv
|
||||
|
||||
echo "Install project dependencies"
|
||||
uv pip install jupyterlab papermill pandas openpyxl jupyter-ai
|
||||
}
|
||||
|
||||
ijl() {
|
||||
install-jupyter-lab "$@"
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
run-jupyter-notebook() {
|
||||
local uv_venv="${VENV_PATH:-.venv}"
|
||||
source "$uv_venv/bin/activate"
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo '$1/path is empty'
|
||||
exit
|
||||
fi
|
||||
if [[ -n "$2" ]]; then
|
||||
echo "Load env file $2"
|
||||
load-dotenv "$2"
|
||||
export ODOO_URL
|
||||
export ODOO_DATABASE
|
||||
export ODOO_USERNAME
|
||||
export ODOO_PASSWORD
|
||||
fi
|
||||
|
||||
papermill --log-output "$1" "$1"
|
||||
}
|
||||
|
||||
rjn() {
|
||||
run-jupyter-notebook "$@"
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
start-jupyter-lab() {
|
||||
local uv_venv="${VENV_PATH:-.venv}"
|
||||
source "$uv_venv/bin/activate"
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
echo "Load env file $1"
|
||||
load-dotenv "$1"
|
||||
export ODOO_URL
|
||||
export ODOO_DATABASE
|
||||
export ODOO_USERNAME
|
||||
export ODOO_PASSWORD
|
||||
fi
|
||||
|
||||
jupyter lab
|
||||
}
|
||||
|
||||
sjl() {
|
||||
start-jupyter-lab "$@"
|
||||
}
|
||||
@@ -34,6 +34,7 @@ scripts=(
|
||||
list-dotenv
|
||||
list-git-folder
|
||||
list-prompts
|
||||
list-taskfile-aliases
|
||||
load-dotenv
|
||||
load-dotenv-from-keepass
|
||||
load-dotenv-from-pass
|
||||
@@ -56,6 +57,7 @@ scripts=(
|
||||
rename-dotenv
|
||||
reset-git-folder
|
||||
restore-dotenv-files
|
||||
run-jupyter-notebook
|
||||
run-pre-commit
|
||||
save-dotenv-to-keepass
|
||||
save-dotenv-to-pass
|
||||
@@ -63,9 +65,11 @@ scripts=(
|
||||
save-kubeconfig-to-keepass
|
||||
save-kubeconfig-to-pass
|
||||
save-pass-to-keepass
|
||||
setup-completion
|
||||
show-dotenv
|
||||
show-dotenv-setup
|
||||
stage-git-folder
|
||||
start-jupyter-lab
|
||||
status-all-repos
|
||||
status-git-folder
|
||||
switch-git-folder
|
||||
|
||||
+59
@@ -63,6 +63,7 @@ TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.bui
|
||||
```
|
||||
|
||||
<!-- ===Task=== -->
|
||||
|
||||
### clone-taskfile
|
||||
|
||||
```bash
|
||||
@@ -116,6 +117,7 @@ rows+=("setup-completion|[shell]|Show shell completion instructions.")
|
||||
```bash
|
||||
rows+=("list-taskfile-aliases||List all library command aliases.")
|
||||
```
|
||||
|
||||
<!-- ===Task=== -->
|
||||
|
||||
## Files
|
||||
@@ -123,6 +125,7 @@ rows+=("list-taskfile-aliases||List all library command aliases.")
|
||||
Managing files and directories.
|
||||
|
||||
<!-- ===Files=== -->
|
||||
|
||||
### ensure-directory
|
||||
|
||||
```bash
|
||||
@@ -140,12 +143,15 @@ rows+=("create-symlink|[target][source]|Remove existing file/directory and creat
|
||||
```bash
|
||||
rows+=("create-symlink-files|[target][source]|Create symlink for files in source pattern.")
|
||||
```
|
||||
|
||||
<!-- ===Files=== -->
|
||||
|
||||
## Python
|
||||
|
||||
Setup Python virtual enviroment.
|
||||
|
||||
<!-- ===Python=== -->
|
||||
|
||||
### activate-venv
|
||||
|
||||
```bash
|
||||
@@ -157,8 +163,35 @@ rows+=("activate-venv||Activate or initialize Python virtual env.")
|
||||
```bash
|
||||
rows+=("remove-venv||Remove the Python virtual env.")
|
||||
```
|
||||
|
||||
<!-- ===Python=== -->
|
||||
|
||||
## Jupyter
|
||||
|
||||
Setup and run Jupyter notebooks.
|
||||
|
||||
<!-- ===Jupyter=== -->
|
||||
|
||||
### start-jupyter-lab
|
||||
|
||||
```bash
|
||||
rows+=("start-jupyter-lab|[env]|Start Jupyter Lab server.")
|
||||
```
|
||||
|
||||
### install-jupyter-lab
|
||||
|
||||
```bash
|
||||
rows+=("install-jupyter-lab||Install Jupyter Lab and dependencies.")
|
||||
```
|
||||
|
||||
### run-jupyter-notebook
|
||||
|
||||
```bash
|
||||
rows+=("run-jupyter-notebook|[path][env]|Execute notebook with papermill.")
|
||||
```
|
||||
|
||||
<!-- ===Jupyter=== -->
|
||||
|
||||
## Environment
|
||||
|
||||
Manage `.env` files in the task config folder.
|
||||
@@ -168,6 +201,7 @@ TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.bui
|
||||
```
|
||||
|
||||
<!-- ===Enviroment=== -->
|
||||
|
||||
### create-dotenv
|
||||
|
||||
```bash
|
||||
@@ -227,12 +261,15 @@ rows+=("backup-dotenv-files|[path]|Archive and copy .env files to target locatio
|
||||
```bash
|
||||
rows+=("restore-dotenv-files|[path]|Extract and copy .env files from backup file.")
|
||||
```
|
||||
|
||||
<!-- ===Enviroment=== -->
|
||||
|
||||
## LLM
|
||||
|
||||
Commands that integrate the `llm` cli.
|
||||
|
||||
<!-- ===LLM=== -->
|
||||
|
||||
### commit-with-llm
|
||||
|
||||
```bash
|
||||
@@ -264,12 +301,15 @@ rows+=("create-prompt|[path]|Create a new prompt file from template.")
|
||||
```bash
|
||||
rows+=("list-prompts|[path]|List all prompt files.")
|
||||
```
|
||||
|
||||
<!-- ===LLM=== -->
|
||||
|
||||
## Logging
|
||||
|
||||
Colorful logging in task commands.
|
||||
|
||||
<!-- ===Logging=== -->
|
||||
|
||||
### log-error
|
||||
|
||||
```bash
|
||||
@@ -287,6 +327,7 @@ rows+=("log-success||Colored output for success.")
|
||||
```bash
|
||||
rows+=("log-warning||Colored output for warnings.")
|
||||
```
|
||||
|
||||
<!-- ===Logging=== -->
|
||||
|
||||
## Git
|
||||
@@ -294,6 +335,7 @@ rows+=("log-warning||Colored output for warnings.")
|
||||
These commands replace the `git submodule` command. The commands store and retrieve additional information from the `.gitmodules` file.
|
||||
|
||||
<!-- ===Git=== -->
|
||||
|
||||
### add-git-folder
|
||||
|
||||
```bash
|
||||
@@ -443,18 +485,22 @@ rows+=("status-git-folder|[path]|Show status of git folders from .gitmodules fil
|
||||
```bash
|
||||
rows+=("save-git-folder||Save commit refs to .gitmodules.")
|
||||
```
|
||||
|
||||
### update-submodule
|
||||
|
||||
```bash
|
||||
rows+=("update-submodule||Update git submodules.")
|
||||
```
|
||||
|
||||
<!-- ===Git=== -->
|
||||
|
||||
## Pass
|
||||
|
||||
Load and store secrets from pass.
|
||||
The name of the entry will resolve dynamically depending on the current directory / project. Use `show-dotenv` to show info about the dotenv setup.
|
||||
|
||||
<!-- ===Pass=== -->
|
||||
|
||||
### save-dotenv-to-pass
|
||||
|
||||
```bash
|
||||
@@ -466,7 +512,9 @@ rows+=("save-dotenv-to-pass|[file]|Store content of .env in pass entry.")
|
||||
```bash
|
||||
rows+=("load-dotenv-from-pass|[file]|Restore content to .env from pass entry.")
|
||||
```
|
||||
|
||||
<!-- ===Pass=== -->
|
||||
|
||||
## KeePass
|
||||
|
||||
Load and store secrets from KeePassXC.
|
||||
@@ -478,7 +526,9 @@ KEEPASS_DATABASE_KEY_FILE="/path/to/keepass.key"
|
||||
```
|
||||
|
||||
The name of the entry will resolve dynamically depending on the current directory / project. Use `show-dotenv` to show info about the dotenv setup.
|
||||
|
||||
<!-- ===KeePass=== -->
|
||||
|
||||
### save-pass-to-keepass
|
||||
|
||||
```bash
|
||||
@@ -502,12 +552,15 @@ rows+=("save-dotenv-to-keepass|[file]|Store content of .env in KeePass entry.")
|
||||
```bash
|
||||
rows+=("load-dotenv-from-keepass|[file]|Restore content to .env from KeePass entry.")
|
||||
```
|
||||
|
||||
<!-- ===KeePass=== -->
|
||||
|
||||
## Kubernetes
|
||||
|
||||
Manage kube config files.
|
||||
|
||||
<!-- ===Kubernetes=== -->
|
||||
|
||||
### save-kubeconfig-to-pass
|
||||
|
||||
```bash
|
||||
@@ -531,6 +584,7 @@ rows+=("load-kubeconfig-from-pass|[ctx]|Load kubeconfig file from pass.")
|
||||
```bash
|
||||
rows+=("load-kubeconfig-from-keepass|[ctx]|Load kubeconfig file from KeePass.")
|
||||
```
|
||||
|
||||
<!-- ===Kubernetes=== -->
|
||||
|
||||
## Docker
|
||||
@@ -547,6 +601,7 @@ DOCKER_CONFIG="$HOME/.docker/$CONTAINER_REGISTRY/"
|
||||
```
|
||||
|
||||
<!-- ===Docker=== -->
|
||||
|
||||
### login-docker
|
||||
|
||||
```bash
|
||||
@@ -558,7 +613,9 @@ rows+=("login-docker|[user][token]|Run Docker login and create docker config.")
|
||||
```bash
|
||||
rows+=("build-image|[output]|Build Docker image with buildx.")
|
||||
```
|
||||
|
||||
<!-- ===Docker=== -->
|
||||
|
||||
## Ansible
|
||||
|
||||
Install scripts from the Ansible Build project.
|
||||
@@ -566,9 +623,11 @@ Install scripts from the Ansible Build project.
|
||||
The available roles with scripts are listed here: <https://ansible.build/scripts.html>
|
||||
|
||||
<!-- ===Docker=== -->
|
||||
|
||||
### install-ansible-build-scripts
|
||||
|
||||
```bash
|
||||
rows+=("install-ansible-build-scripts|[role]|Install scripts of the specified Ansbile role.")
|
||||
```
|
||||
|
||||
<!-- ===Docker=== -->
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Update library doc"
|
||||
title: 'Update library doc'
|
||||
state: completed
|
||||
---
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Integrate opencode into Docker image"
|
||||
title: 'Integrate opencode into Docker image'
|
||||
state: completed
|
||||
---
|
||||
|
||||
@@ -19,7 +19,7 @@ Read the `AGENTS.md` and `README.md` to get an understanding of the project.
|
||||
|
||||
## Task
|
||||
|
||||
I want to support https://opencode.ai/ in the Docker image. The npm install path is:
|
||||
I want to support https://opencode.ai/ in the Docker image. The npm install path is:
|
||||
|
||||
```js
|
||||
npm i -g opencode-ai
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "prompt list must show state"
|
||||
title: 'prompt list must show state'
|
||||
state: completed
|
||||
---
|
||||
|
||||
@@ -19,7 +19,7 @@ Read the `AGENTS.md` and `README.md` to get an understanding of the project.
|
||||
|
||||
## Task
|
||||
|
||||
Add a row `state` to the `list-prompts` command. For each prompt file read the frontmatter field `state`.
|
||||
Add a row `state` to the `list-prompts` command. For each prompt file read the frontmatter field `state`.
|
||||
|
||||
## Worklog
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Add alias for all commands"
|
||||
title: 'Add alias for all commands'
|
||||
state: completed
|
||||
model: infomaniak/moonshotai/Kimi-K2.6
|
||||
input_tokens:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Add command to list alias map"
|
||||
title: 'Add command to list alias map'
|
||||
state: completed
|
||||
model: moonshotai/Kimi-K2.6
|
||||
input_tokens: 35.6K
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title: 'Support Jupyter lab environments'
|
||||
state: completed
|
||||
model: infomaniak/moonshotai/Kimi-K2.6
|
||||
input_tokens: '31.5K'
|
||||
---
|
||||
|
||||
# Run 20
|
||||
|
||||
Note: @Clanker refers to the "ai agent" (you) who is working on this task.
|
||||
|
||||
@Clanker when working on this task, make sure to:
|
||||
|
||||
- Read context and task section first
|
||||
- Prepare a list of todos
|
||||
- Update the todo list while working on the task
|
||||
|
||||
## Context
|
||||
|
||||
@Clanker Read the `AGENTS.md` and `README.md` to get an understanding of the project.
|
||||
|
||||
## Task
|
||||
|
||||
I want to you to add support to setup and run Jupyter notebooks. Make the following updates:
|
||||
|
||||
- `bin/*`: Add new commands for these bash functions:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
start-jupyer-lab() {
|
||||
uv_venv="${VENV_PATH:-.venv}"
|
||||
source "$uv_venv/bin/activate"
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
echo "Load env file $1."
|
||||
load-dotenv "$1"
|
||||
export ODOO_URL
|
||||
export ODOO_DATABASE
|
||||
export ODOO_USERNAME
|
||||
export ODOO_PASSWORD
|
||||
fi
|
||||
|
||||
jupyter lab
|
||||
}
|
||||
sjl() {
|
||||
start-jupyer-lab "$@"
|
||||
}
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
install-jupyter-lab() {
|
||||
init-venv
|
||||
activate-venv
|
||||
|
||||
echo "Install project dependencies."
|
||||
uv pip install -r jupyterlab papermill pandas openpyxl jupyter-ai
|
||||
}
|
||||
|
||||
ijl() {
|
||||
install-jupyter-lab
|
||||
}
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
run-jupyter-notebook() {
|
||||
uv_venv="${VENV_PATH:-.venv}"
|
||||
source "$uv_venv/bin/activate"
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo '$1/path is empty.'
|
||||
exit
|
||||
fi
|
||||
if [[ -n "$2" ]]; then
|
||||
echo "Load env file $2."
|
||||
load-dotenv "$2"
|
||||
export ODOO_URL
|
||||
export ODOO_DATABASE
|
||||
export ODOO_USERNAME
|
||||
export ODOO_PASSWORD
|
||||
fi
|
||||
|
||||
papermill --log-output "$1" "$1"
|
||||
}
|
||||
|
||||
rjn() {
|
||||
run-jupyter-notebook "$@"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
- `task.template`: Add helper table rows for the new commands
|
||||
- `library.md`: Document the new commands
|
||||
- `AGENTS.md.template`: Create a new section "Jupyer Notebooks" under "Environment & tooling" with these guidelines:
|
||||
|
||||
**Run with timeout**: Run the notebook with `timeout 10 task run-jupyter-notebook <path> [env]`.
|
||||
|
||||
**Edit with MCP**: Launch Jupyter Lab and use the builtin MCP server to edit the noteooks.
|
||||
|
||||
## Worklog
|
||||
|
||||
- Created `bin/start-jupyter-lab` with `start-jupyter-lab` and `sjl` alias.
|
||||
- Created `bin/install-jupyter-lab` with `install-jupyter-lab` and `ijl` alias.
|
||||
- Created `bin/run-jupyter-notebook` with `run-jupyter-notebook` and `rjn` alias.
|
||||
- Updated `task.template` to include Jupyter commands in the help table.
|
||||
- Updated `library.md` to document the new Jupyter commands.
|
||||
- Updated `AGENTS.md.template` and `AGENTS.md` with Jupyter Notebooks guidelines.
|
||||
@@ -55,7 +55,7 @@ help-table() {
|
||||
if [[ "$cmd" =~ ^===.*===$ ]]; then
|
||||
group_name="${cmd/===/}"
|
||||
group_name="${group_name/===/}"
|
||||
|
||||
|
||||
if [ "$first_row" = true ]; then
|
||||
first_row=false
|
||||
else
|
||||
@@ -64,7 +64,7 @@ help-table() {
|
||||
"$max_opt" "$(printf '%*s' "$max_opt" '' | tr ' ' '-')" \
|
||||
"$max_desc" "$(printf '%*s' "$max_desc" '' | tr ' ' '-')"
|
||||
fi
|
||||
|
||||
|
||||
local left_pad=$(( (max_cmd - ${#group_name}) / 2 ))
|
||||
local right_pad=$(( max_cmd - left_pad - ${#group_name} ))
|
||||
printf '| %*s%s%*s | %*s | %*s |\n' \
|
||||
@@ -73,7 +73,7 @@ help-table() {
|
||||
"$right_pad" "" \
|
||||
"$max_opt" "" \
|
||||
"$max_desc" ""
|
||||
|
||||
|
||||
printf '|-%*s-|-%*s-|-%*s-|\n' \
|
||||
"$max_cmd" "$(printf '%*s' "$max_cmd" '' | tr ' ' '-')" \
|
||||
"$max_opt" "$(printf '%*s' "$max_opt" '' | tr ' ' '-')" \
|
||||
@@ -89,4 +89,4 @@ help-table() {
|
||||
}
|
||||
```
|
||||
|
||||
Do not comment the logic of the dynamic table code.
|
||||
Do not comment the logic of the dynamic table code.
|
||||
@@ -23,6 +23,10 @@ help-table() {
|
||||
rows+=("===Python===| | ")
|
||||
rows+=("activate-venv||Activate or initialize Python virtual env.")
|
||||
rows+=("remove-venv||Remove the Python virtual env.")
|
||||
rows+=("===Jupyter===| | ")
|
||||
rows+=("start-jupyter-lab|[env]|Start Jupyter Lab server.")
|
||||
rows+=("install-jupyter-lab||Install Jupyter Lab and dependencies.")
|
||||
rows+=("run-jupyter-notebook|[path][env]|Execute notebook with papermill.")
|
||||
rows+=("===Environment===| | ")
|
||||
rows+=("create-dotenv|[env][type]|Create .env file of type nextcloud, odoo, upgrade.")
|
||||
rows+=("list-dotenv||List dotenv files.")
|
||||
|
||||
Reference in new issue
Block a user