You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move Markdown formatting from prettier to rumdl (mystmd flavor for
content/, standard for the Marp slides/). prettier stays for the
non-Markdown files (CSS, JSON, YAML) via an `\.md$` exclude.
rumdl fmt's directive-aware fixes (MD031) add blank lines around MyST
directives; MD013/MD033/MD026/MD076 are disabled as they don't fit
prose/slide content.
Assisted-by: ClaudeCode:claude-opus-4.8
Copy file name to clipboardExpand all lines: content/basic-packaging/01_setup.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,13 +65,15 @@ When Python runs, it checks to see if there's a `pyvenv.cfg` above it. If there
65
65
it is in a virtual environment (venv) and reads site-packages from there. There are two ways to use it:
66
66
67
67
::::{tab-set}
68
+
68
69
:::{tab-item} Direct usage
69
70
70
71
```bash
71
72
.venv/bin/python ...
72
73
```
73
74
74
75
:::
76
+
75
77
:::{tab-item} Activation
76
78
77
79
```bash
@@ -81,6 +83,7 @@ deactivate
81
83
```
82
84
83
85
:::
86
+
84
87
::::
85
88
86
89
> [!WARNING]
@@ -95,7 +98,9 @@ The `.` at the start (most shells support `source` as well) allows the activatio
95
98
To create one of these, you have several options:
96
99
97
100
:::::{card} Create a virtual environment
101
+
98
102
::::{tab-set}
103
+
99
104
:::{tab-item} venv
100
105
101
106
```bash
@@ -105,6 +110,7 @@ python3 -m venv .venv
105
110
This is the slowest, but it's built in![^1]
106
111
107
112
:::
113
+
108
114
:::{tab-item} virtualenv
109
115
110
116
```bash
@@ -114,6 +120,7 @@ virtualenv .venv
114
120
This is faster than `venv`, has better default installs inside, but does require installation.
115
121
116
122
:::
123
+
117
124
:::{tab-item} uv
118
125
119
126
```bash
@@ -123,7 +130,9 @@ uv venv
123
130
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).
124
131
125
132
:::
133
+
126
134
::::
135
+
127
136
:::::
128
137
129
138
We will be using `uv`, which can do a lot of this for us.
@@ -137,7 +146,9 @@ Now that you know how to make virtual environments, how should you install stuff
137
146
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:
138
147
139
148
:::::{grid} 1 1 2 2
149
+
140
150
::::{grid-item}
151
+
141
152
:::{card} Project (app)
142
153
These are for making a virtual env. They don't affect libraries.
143
154
@@ -148,8 +159,11 @@ These are for making a virtual env. They don't affect libraries.
148
159
-**Lock file**: Versions are pinned exactly
149
160
-**dependency-groups**: Multiple collections of packages
150
161
:::
162
+
151
163
::::
164
+
152
165
::::{grid-item}
166
+
153
167
:::{card} Package (library)
154
168
These are for libraries.
155
169
@@ -164,7 +178,9 @@ Most libraries also have developer environments, which follows the "Project
164
178
> for these too; this is due to it pre-dating `dependency-groups`.
165
179
166
180
:::
181
+
167
182
::::
183
+
168
184
:::::
169
185
170
186
Locked dependencies means that every dependency is fully specified, ideally
@@ -296,20 +312,23 @@ if __name__ == "__main__":
296
312
When you run it:
297
313
298
314
::::{tab-set}
315
+
299
316
:::{tab-item} uv
300
317
301
318
```bash
302
319
uv run single.py
303
320
```
304
321
305
322
:::
323
+
306
324
:::{tab-item} pipx
307
325
308
326
```bash
309
327
pipx run single.py
310
328
```
311
329
312
330
:::
331
+
313
332
::::
314
333
315
334
The dependencies will be downloaded into a temporary venv.
0 commit comments