Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ repos:
hooks:
- id: nbstripout

- repo: https://github.com/rvben/rumdl-pre-commit
rev: "5c0245ee573b1dea03e8cdc5bd41bd449ea8962a" # frozen: v0.2.27
hooks:
- id: rumdl-fmt

- repo: https://github.com/rbubley/mirrors-prettier
rev: "515f543f5718ebfd6ce22e16708bb32c68ff96e1" # frozen: v3.8.3
hooks:
- id: prettier
exclude: '\.md$' # Markdown is handled by rumdl

- repo: https://github.com/codespell-project/codespell
rev: "2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a" # frozen: v2.4.2
Expand Down
12 changes: 12 additions & 0 deletions .rumdl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[global]
# This is prose-heavy content, not source-tree Markdown.
disable = [
"MD013", # Line length β€” prose and code samples are not hard-wrapped
"MD033", # Inline HTML β€” Marp slides use <div class="columns"> etc.
"MD026", # Trailing punctuation in headings β€” slide headings intentionally end in ":"
"MD076", # Blank line between list items β€” false-positives inside mixed-indent MyST :::{card}
]

# content/ is MyST (directives, roles); slides/ are Marp (standard Markdown + HTML).
[per-file-flavor]
"content/**/*.md" = "myst"
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bun run build # build book + slides into _build/html/ (build-book then b
bun run build-book # myst build --html
bun run build-slides # marp slides/ -> _build/html/slides/
bun run clean # rm -rf _build
prek -a --quiet # lint/format everything (ruff-format, blacken-docs, prettier, codespell, etc.)
prek -a --quiet # lint/format everything (ruff-format, blacken-docs, rumdl, prettier, codespell, etc.)
```

## Structure
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This workshop is a work in progress. Check back soon!

See https://scikit-build.org/events/simple-py/ for info on the workshop!
See <https://scikit-build.org/events/simple-py/> for info on the workshop!
19 changes: 19 additions & 0 deletions content/basic-packaging/01_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ When Python runs, it checks to see if there's a `pyvenv.cfg` above it. If there
it is in a virtual environment (venv) and reads site-packages from there. There are two ways to use it:

::::{tab-set}

:::{tab-item} Direct usage

```bash
.venv/bin/python ...
```

:::

:::{tab-item} Activation

```bash
Expand All @@ -81,6 +83,7 @@ deactivate
```

:::

::::

> [!WARNING]
Expand All @@ -95,7 +98,9 @@ The `.` at the start (most shells support `source` as well) allows the activatio
To create one of these, you have several options:

:::::{card} Create a virtual environment

::::{tab-set}

:::{tab-item} venv

```bash
Expand All @@ -105,6 +110,7 @@ python3 -m venv .venv
This is the slowest, but it's built in![^1]

:::

:::{tab-item} virtualenv

```bash
Expand All @@ -114,6 +120,7 @@ virtualenv .venv
This is faster than `venv`, has better default installs inside, but does require installation.

:::

:::{tab-item} uv

```bash
Expand All @@ -123,7 +130,9 @@ uv venv
This is really fast, though it's completely empty (no pip). And it defaults to `.venv`. Also requires installation (a single Rust binary or pip install).

:::

::::

:::::

We will be using `uv`, which can do a lot of this for us.
Expand All @@ -137,7 +146,9 @@ Now that you know how to make virtual environments, how should you install stuff
But a virtual environment is meant to be expendable. You should be able to delete it and recreate it any time. So instead of manually installing, you want to list packages in some format:

:::::{grid} 1 1 2 2

::::{grid-item}

:::{card} Project (app)
These are for making a virtual env. They don't affect libraries.

Expand All @@ -148,8 +159,11 @@ These are for making a virtual env. They don't affect libraries.
- **Lock file**: Versions are pinned exactly
- **dependency-groups**: Multiple collections of packages
:::

::::

::::{grid-item}

:::{card} Package (library)
These are for libraries.

Expand All @@ -164,7 +178,9 @@ Most libraries also have developer environments, which follows the "Project
> for these too; this is due to it pre-dating `dependency-groups`.

:::

::::

:::::

Locked dependencies means that every dependency is fully specified, ideally
Expand Down Expand Up @@ -296,20 +312,23 @@ if __name__ == "__main__":
When you run it:

::::{tab-set}

:::{tab-item} uv

```bash
uv run single.py
```

:::

:::{tab-item} pipx

```bash
pipx run single.py
```

:::

::::

The dependencies will be downloaded into a temporary venv.
Expand Down
2 changes: 1 addition & 1 deletion slides/1_01_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ System or user installs sound nice, but:

## Virtual environment structure

```
```text
.venv
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CACHEDIR.TAG
Expand Down