Last active
March 4, 2025 04:23
-
-
Save symball/c3d6486979c499dda795faa2a9355a56 to your computer and use it in GitHub Desktop.
Python hello world with Notebook and SQL
This file contains hidden or 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
--- | |
name: Python Hello World Test | |
ref: python_notebook_test | |
icon: "/demo/img/hello_world_cover.png" | |
description: Deploys SQL and Jupyter setup for interaction | |
version: 0.0.1 | |
tools: | |
- ref: python | |
- ref: uv | |
vars: | |
".mysql.address": localhost | |
".mysql.external_port": 3306 | |
".mysql.schema": development | |
".mysql.user_name": development | |
".mysql.user_pass": development | |
containers: | |
db: | |
image: mysql:latest | |
ports: | |
- "{{ .SVar `.mysql.external_port` }}:3306" | |
environment: | |
- "MYSQL_DATABASE={{ .SVar `.mysql.schema` }}" | |
- "MYSQL_ROOT_PASSWORD={{ .SVar `.mysql.user_pass` }}" | |
- "MYSQL_USER={{ .SVar `.mysql.user_name` }}" | |
- "MYSQL_PASSWORD={{ .SVar `.mysql.user_pass` }}" | |
apps: | |
- name: Hello World (Python) | |
ref: hello_world_python | |
description: Simple starter demonstrating use of Python to launch notebooks connecting with a DB | |
home_page: https://github.com/symball/hello_world_python | |
repository_url: https://github.com/symball/hello_world_python | |
config: | |
source: | |
- name: Clone repository | |
action_ref: vcs.get_remote | |
description: Pull the code from remote VCS host | |
configuration: | |
repository_url: https://github.com/symball/hello_world_python | |
destination: "{{ .SVar `.apps.hello_world_python.root` }}" | |
build: | |
- name: Placeholder Task | |
action_ref: core.log | |
description: This is a placeholder task | |
configuration: | |
data: "No need for build" | |
dev: | |
- name: Run Notebook using uv | |
action_ref: core.os_exec | |
description: Run the python notebook | |
configuration: | |
background: true | |
command: | |
- "{{ .SVar `.env.bin` }}/uv" | |
- run | |
- "--with" | |
- jupyter | |
- jupyter | |
- lab | |
environment: | |
- "MYSQL_USER={{ .SVar `.mysql.user_name` }}" | |
- "MYSQL_PASS={{ .SVar `.mysql.user_pass` }}" | |
- "MYSQL_SCHEMA={{ .SVar `.mysql.schema` }}" | |
- "MYSQL_HOST={{ .SVar `.mysql.address` }}" | |
show_output: true | |
working_dir: "{{ .SVar `.apps.hello_world_python.root` }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment