Skip to content

Commit 93264be

Browse files
committed
inital commit
0 parents  commit 93264be

8 files changed

Lines changed: 1083 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Marp Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
# Step 1: Checkout the repository
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
# Step 2: Set up environment variables
22+
- name: Set up environment variables
23+
run: echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
24+
25+
# Step 3: Run the Marp command using Docker
26+
- name: Generate Marp documentation
27+
run: |
28+
docker run --rm \
29+
-v $PWD:/home/marp/app/ \
30+
-e MARP_USER="$(id -u):$(id -g)" \
31+
-e LANG=$LANG \
32+
marpteam/marp-cli:v3.2.0 \
33+
--theme talk/theme.css talk/slides.md --html
34+
35+
# Step 4: Switch to gh-pages branch
36+
- name: Switch to gh-pages branch
37+
run: |
38+
git fetch origin gh-pages
39+
git checkout -B gh-pages origin/gh-pages || git checkout --orphan gh-pages
40+
git reset --hard
41+
42+
# Step 5: Deploy to gh-pages branch
43+
- name: Deploy to gh-pages branch
44+
run: |
45+
mkdir -p .
46+
cp talk/slides.html index.html
47+
cp -r talk/figures figures
48+
git add index.html
49+
git add -f talk/figures
50+
git add talk/slides.html
51+
git add -f figures
52+
git config user.name "github-actions[bot]"
53+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
54+
git commit -m "Deploy Marp slides [skip ci]" || echo "No changes to commit"
55+
git push origin gh-pages --force

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.png
2+
*.jpg
3+
*/__pycache__/*
4+
.mypy_cache
5+
__pycache__
6+
*ipynb_*
7+
.DS_Store*

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# The dependency inferno
2+
3+
This repository contains a [talk](https://sunnivin.github.io/a-new-core/talk/slides.html) about the so called dependency hell in Python and how the package manager [uv](https://docs.astral.sh/uv/) can help us on the way.
4+
5+
6+
7+
# Credit
8+
9+
The material in the slides and demo are based on the content from the following sources:
10+
11+
- [Episode 238: Charlie Marsh: Accelerating Python toolong with Ruff and uv](https://realpython.com/podcasts/rpp/238/)
12+
- [Python Developer Tooling Handbook](https://pydevtools.com/handbook/) (accessed 20.05.25)
13+

talk/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Slides with marp
2+
This repo contains a template for slides written in markdown.
3+
4+
### Convert to html with a template file
5+
Pure markdown files can (currently) not split a slide in column without html.
6+
7+
To convert the slidedeck into a *.html file:
8+
9+
# Server mode (Serve current directory in http://localhost:8080/)
10+
marp --theme-set ngi-theme.css --html -w slides.md
11+
12+
13+
### Local work with docker
14+
Latest tag: 'v4.1.2'
15+
16+
Use the presentation in local mode with the `watch` command
17+
18+
docker run --rm --init -v $PWD:/home/marp/app -e LANG=$LANG -p 8080:8080 -p 37717:37717 marpteam/marp-cli:v3.2.0 --theme ngi-theme.css --watch -s --html .
19+
20+
Then click on the name of the file opening at the local host [http://localhost:8080/](http://localhost:8080/).
21+
22+
Convert slide deck into pdf
23+
docker run --rm -v $PWD:/home/marp/app/ -e MARP_USER="$(id -u):$(id -g)" -e LANG=$LANG marpteam/marp-cli:v3.2.0 --theme ngi-theme.css slides.md --pdf
24+
25+
Convert slide deck into html
26+
27+
docker run --rm -v $PWD:/home/marp/app/ -e MARP_USER="$(id -u):$(id -g)" -e LANG=$LANG marpteam/marp-cli:v3.2.0 --theme ngi-theme.css slides.md --html
28+
29+
30+
31+
### Some nice issues to pay attention to
32+
33+
- [Import document](https://github.com/marp-team/marpit/issues/135) style.
34+
35+
4.38 KB
Loading

talk/slides.html

Lines changed: 399 additions & 0 deletions
Large diffs are not rendered by default.

talk/slides.md

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
---
2+
marp: true
3+
theme: theme.css
4+
paginate: true
5+
6+
---
7+
8+
9+
10+
11+
<!-- _class: title -->
12+
<!-- _header: '_21.05.2025_' -->
13+
<!-- paginate: false -->
14+
# The dependency inferno
15+
## A descent into the Python packaging hell
16+
17+
####
18+
####
19+
####
20+
#### :zap: Lighting talk :zap:
21+
#### Sunniva Indrehus
22+
23+
24+
---
25+
26+
27+
<!-- paginate: true -->
28+
29+
```
30+
autodesk$ echo $(whoami)
31+
```
32+
33+
---
34+
35+
<!-- _footer: 'Figure credit:[xkcd](https://imgs.xkcd.com/comics/python_environment.png)' -->
36+
37+
# The Python dependency hell
38+
39+
![bg right w:500](https://imgs.xkcd.com/comics/python_environment.png)
40+
41+
---
42+
43+
# Short :snake: :package: history
44+
45+
- **1991** Python 1.0 released (Guido van Rossum)
46+
- **2008** Python 3.0 & rise of `setuptools`
47+
- **2009** `conda` released (Anaconda Inc.)
48+
- **2011** `pip` bundled with Python
49+
- **2013** `virtualenv` becomes widely used
50+
- **2017** `pipenv` launched (PyPA-backed)
51+
- **2018** `poetry` (S. Eustace)
52+
- **2019** [`hatch`](https://github.com/pypa/hatch) (Ofek)
53+
- **2020**:
54+
- Widespread `pyproject.toml` adoption ([PEPs 517/518/621](https://peps.python.org/pep-0621/))
55+
- [`PDM`](https://github.com/pdm-project/pdm) (Frost Ming)
56+
- **2024** [`uv`](https://docs.astral.sh/uv/) (Astral)
57+
58+
---
59+
60+
# Short :snake: :package: history
61+
62+
- **1991** Python 1.0 released (Guido van Rossum)
63+
- **2008** Python 3.0 & rise of `setuptools`
64+
- **2009** `conda` released (Anaconda Inc.)
65+
- **2011** `pip` bundled with Python
66+
- **2013** `virtualenv` becomes widely used
67+
- **2017** `pipenv` launched (PyPA-backed)
68+
<div style="border: 2px solid red; padding: 6px; border-radius: 6px; background-color: #fff5f5;">
69+
<strong>2018</strong> <code>poetry</code> (S. Eustace)
70+
</div>
71+
- **2019** [`hatch`](https://github.com/pypa/hatch) (Ofek)
72+
- **2020**:
73+
- Widespread `pyproject.toml` adoption ([PEPs 517/518/621](https://peps.python.org/pep-0621/))
74+
- [`PDM`](https://github.com/pdm-project/pdm) (Frost Ming)
75+
- **2024** [`uv`](https://docs.astral.sh/uv/) (Astral)
76+
77+
78+
---
79+
80+
81+
# Short :snake: :package: history
82+
83+
- **1991** Python 1.0 released (Guido van Rossum)
84+
- **2008** Python 3.0 & rise of `setuptools`
85+
- **2009** `conda` released (Anaconda Inc.)
86+
- **2011** `pip` bundled with Python
87+
- **2013** `virtualenv` becomes widely used
88+
- **2017** `pipenv` launched (PyPA-backed)
89+
- **2018** `poetry` (S. Eustace)
90+
- **2019** [`hatch`](https://github.com/pypa/hatch) (Ofek)
91+
- **2020**:
92+
- Widespread `pyproject.toml` adoption ([PEPs 517/518/621](https://peps.python.org/pep-0621/))
93+
- [`PDM`](https://github.com/pdm-project/pdm) (Frost Ming)
94+
<div style="border: 2px solid red; padding: 6px; border-radius: 6px; background-color: #fff5f5;">
95+
<strong>2024</strong> <code>uv</code> (Astral)
96+
</div>
97+
98+
99+
---
100+
101+
102+
# UV
103+
104+
- Ultra-fast Python package manager and resolver
105+
- Drop-in replacement for `pip`, `pip-tools`, and parts of `Poetry`
106+
- Unified installation of python across OS
107+
- The lock file is cross platform
108+
109+
110+
<div style="display: flex; flex-direction: column; align-items: margin-top: 2em;">
111+
<img src="https://github-production-user-asset-6210df.s3.amazonaws.com/1309177/316150505-629e59c0-9c6e-4013-9ad4-adb2bcf5080d.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20250520%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250520T123025Z&X-Amz-Expires=300&X-Amz-Signature=6f16d4685a6aaca2b0eb123678ffb5870a70f26cf95691da6d75ce50ca366933&X-Amz-SignedHeaders=host#only-light" alt="Cute kitten" style="max-width: 80%; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.15);" />
112+
<figcaption style="margin-top: 0.8em; font-size: 0.9em; color: #555; font-style: italic;">
113+
Time for installing Trio's dependencies with warm cache, Figure credit: <a href="https://github-production-user-asset-6210df.s3.amazonaws.com/1309177/316150505-629e59c0-9c6e-4013-9ad4-adb2bcf5080d.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20250520%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250520T123025Z&X-Amz-Expires=300&X-Amz-Signature=6f16d4685a6aaca2b0eb123678ffb5870a70f26cf95691da6d75ce50ca366933&X-Amz-SignedHeaders=host#only-light" style="color: blue;">Astral's docs</a>
114+
</figcaption>
115+
</div>
116+
117+
---
118+
119+
# Basic API
120+
121+
## Install uv
122+
123+
```
124+
~$ curl -LsSf https://astral.sh/uv/install.sh | sh
125+
~$ uv
126+
An extremely fast Python package manager.
127+
128+
Usage: uv [OPTIONS] <COMMAND>
129+
```
130+
131+
## Install latest python version
132+
133+
```
134+
~$ uv python install
135+
~$ uv python install 3.12
136+
~$ uv python install pypy@3.10
137+
```
138+
139+
---
140+
141+
142+
Start a project
143+
144+
```
145+
~$ uv init test-uv
146+
~test-uv$ ls
147+
├── .git
148+
├── .gitignore
149+
├── .python-version
150+
├── README.md
151+
├── main.py
152+
├── pyproject.toml
153+
```
154+
Run example script
155+
156+
```
157+
~test-uv$ uv run main.py
158+
Using CPython 3.13.3
159+
Creating virtual environment at: .venv
160+
Hello from test-uv!
161+
```
162+
---
163+
164+
## Start a package project
165+
```
166+
~$ uv init --package test-uv-package
167+
~test-uv-package$ ls
168+
├── .git
169+
├── .gitignore
170+
├── .python-version
171+
├── README.md
172+
├── pyproject.toml
173+
├── src
174+
│ ├── test_uv_package
175+
│ └── __init__.py
176+
```
177+
178+
Run example script
179+
180+
```
181+
~test-uv-package$ uv run test-uv-package
182+
Using CPython 3.13.3
183+
Creating virtual environment at: .venv
184+
Hello from test-uv-package!
185+
```
186+
187+
---
188+
189+
# Plain dependency migration
190+
191+
```
192+
~my-project$ uvx migrate-to-uv
193+
Installed 1 package in 16ms
194+
Locking dependencies with "uv lock"...
195+
Using CPython 3.12.4 interpreter at: /Users/sunnivaindrehus/.pyenv/versions/3.12.4/bin/python3.12
196+
Resolved 123 packages in 1.01s
197+
Successfully migrated project from Poetry to uv!
198+
```
199+
---
200+
201+
# Complex dependency migration
202+
203+
1. Make sure to capture all dependendencies (use the right poetry version, and all relevant groups)
204+
205+
```
206+
~/repo$ poetry@1.8 export -f requirements.txt --output requirements.txt --without-hashes --with dev
207+
```
208+
209+
2. Remove `pyproject.toml` and `poetry.lock` files.
210+
211+
```
212+
~/repo$ uv init --bare
213+
```
214+
215+
3. Install locked dependencies from `.txt`file
216+
217+
```
218+
~/repo$ uv add -r requirements.txt
219+
```
220+
221+
---
222+
223+
# Private packages migration
224+
225+
### Poetry (1.8)
226+
```
227+
[tool.poetry.dependencies]
228+
python = ">=3.11,<3.12"
229+
my-private-package = { git = "git@github.com:my-org/my-private-package.git", tag = "1.0.1" }
230+
```
231+
232+
233+
### uv
234+
```
235+
[project]
236+
requires-python = ">=3.11,<3.12"
237+
dependencies = [
238+
"my-private-package;
239+
]
240+
241+
[tool.uv.sources]
242+
"my-private-package" {git= "ssh://git@github.com:my-org/my-private-package.git", rev="34f59994bb920679ba5f0cade8061e0da7ca00b5"}
243+
```
244+
245+
---
246+
247+
# Poetry vs. uv
248+
249+
---
250+
251+
# UV
252+
## - A promising candidate to acend from the Python packaging hell
253+
254+
![bg right w:500 h:700](figures/illustrations/pythons_nine_circles.png)

0 commit comments

Comments
 (0)