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
* Improve section 1.2 of the course
This commit improves section 1.2 of the course by:
- Including emojis in the title sections to make them more engaging.
- Enriching the content to be easier for you to follow.
- Adding a comparison table for `uv` against other tools.
- Including a new section on the benefits of `uv` in an MLOps context.
- Adding a "Key Takeaways" section to summarize the content.
* review
* Delete docs/1. Initializing/1.2. uv.md.bak
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Médéric Hurier (Fmind) <[email protected]>
-**[MD001](https://github.com/DavidAnson/markdownlint/blob/main/doc/md001.md)**_heading-increment_ - Heading levels should only increment by one level at a time
-**[MD004](https://github.com/DavidAnson/markdownlint/blob/main/doc/md004.md)**_ul-style_ - Unordered list style
12
+
-**[MD005](https://github.com/DavidAnson/markdownlint/blob/main/doc/md005.md)**_list-indent_ - Inconsistent indentation for list items at the same level
13
+
-**[MD007](https://github.com/DavidAnson/markdownlint/blob/main/doc/md007.md)**_ul-indent_ - Unordered list indentation
-**[MD013](https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md)**_line-length_ - Line length
19
+
-**[MD014](https://github.com/DavidAnson/markdownlint/blob/main/doc/md014.md)**_commands-show-output_ - Dollar signs used before commands without showing output
20
+
-**[MD018](https://github.com/DavidAnson/markdownlint/blob/main/doc/md018.md)**_no-missing-space-atx_ - No space after hash on atx style heading
21
+
-**[MD019](https://github.com/DavidAnson/markdownlint/blob/main/doc/md019.md)**_no-multiple-space-atx_ - Multiple spaces after hash on atx style heading
22
+
-**[MD020](https://github.com/DavidAnson/markdownlint/blob/main/doc/md020.md)**_no-missing-space-closed-atx_ - No space inside hashes on closed atx style heading
-**[MD022](https://github.com/DavidAnson/markdownlint/blob/main/doc/md022.md)**_blanks-around-headings_ - Headings should be surrounded by blank lines
25
+
-**[MD023](https://github.com/DavidAnson/markdownlint/blob/main/doc/md023.md)**_heading-start-left_ - Headings must start at the beginning of the line
26
+
-**[MD024](https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md)**_no-duplicate-heading_ - Multiple headings with the same content
27
+
-**[MD025](https://github.com/DavidAnson/markdownlint/blob/main/doc/md025.md)**_single-title/single-h1_ - Multiple top-level headings in the same document
28
+
-**[MD026](https://github.com/DavidAnson/markdownlint/blob/main/doc/md026.md)**_no-trailing-punctuation_ - Trailing punctuation in heading
29
+
-**[MD027](https://github.com/DavidAnson/markdownlint/blob/main/doc/md027.md)**_no-multiple-space-blockquote_ - Multiple spaces after blockquote symbol
30
+
-**[MD028](https://github.com/DavidAnson/markdownlint/blob/main/doc/md028.md)**_no-blanks-blockquote_ - Blank line inside blockquote
31
+
-**[MD029](https://github.com/DavidAnson/markdownlint/blob/main/doc/md029.md)**_ol-prefix_ - Ordered list item prefix
32
+
-**[MD030](https://github.com/DavidAnson/markdownlint/blob/main/doc/md030.md)**_list-marker-space_ - Spaces after list markers
33
+
-**[MD031](https://github.com/DavidAnson/markdownlint/blob/main/doc/md031.md)**_blanks-around-fences_ - Fenced code blocks should be surrounded by blank lines
34
+
-**[MD032](https://github.com/DavidAnson/markdownlint/blob/main/doc/md032.md)**_blanks-around-lists_ - Lists should be surrounded by blank lines
35
+
-**[MD033](https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md)**_no-inline-html_ - Inline HTML
36
+
-**[MD034](https://github.com/DavidAnson/markdownlint/blob/main/doc/md034.md)**_no-bare-urls_ - Bare URL used
-**[MD038](https://github.com/DavidAnson/markdownlint/blob/main/doc/md038.md)**_no-space-in-code_ - Spaces inside code span elements
41
+
-**[MD039](https://github.com/DavidAnson/markdownlint/blob/main/doc/md039.md)**_no-space-in-links_ - Spaces inside link text
42
+
-**[MD040](https://github.com/DavidAnson/markdownlint/blob/main/doc/md040.md)**_fenced-code-language_ - Fenced code blocks should have a language specified
43
+
-**[MD041](https://github.com/DavidAnson/markdownlint/blob/main/doc/md041.md)**_first-line-heading/first-line-h1_ - First line in a file should be a top-level heading
44
+
-**[MD042](https://github.com/DavidAnson/markdownlint/blob/main/doc/md042.md)**_no-empty-links_ - No empty links
-**[MD047](https://github.com/DavidAnson/markdownlint/blob/main/doc/md047.md)**_single-trailing-newline_ - Files should end with a single newline character
-**[MD051](https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md)**_link-fragments_ - Link fragments should be valid
54
+
-**[MD052](https://github.com/DavidAnson/markdownlint/blob/main/doc/md052.md)**_reference-links-images_ - Reference links and images should use a label that is defined
55
+
-**[MD053](https://github.com/DavidAnson/markdownlint/blob/main/doc/md053.md)**_link-image-reference-definitions_ - Link and image reference definitions should be needed
56
+
-**[MD054](https://github.com/DavidAnson/markdownlint/blob/main/doc/md054.md)**_link-image-style_ - Link and image style
Copy file name to clipboardExpand all lines: docs/1. Initializing/1.2. uv.md
+89-87Lines changed: 89 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,23 @@
2
2
description: Discover uv, a fast and versatile Python package manager and project manager designed to streamline your development workflow. Learn how to install it and use it as a drop-in replacement for pip, venv, pipx, and pyenv.
3
3
---
4
4
5
-
# 1.2. uv
5
+
# 1.2. uv ⚡️
6
6
7
-
## What is uv?
7
+
## 🤔 What is uv?
8
8
9
-
[uv](https://docs.astral.sh/uv/) is an extremely fast Python package installer and resolver, written in Rust, designed to be a drop-in replacement for `pip`, `pipx`, `venv`, and `pyenv`. Created by [Astral](https://astral.sh/), the same team behind the high-performance linter [Ruff](https://docs.astral.sh/ruff/), `uv` aims to significantly speed up and simplify Python project management. It offers a unified toolchain that handles virtual environments, dependency resolution, package installation, and more, all while providing exceptional performance.
9
+
[uv](https://docs.astral.sh/uv/) is an extremely fast Python package installer and resolver, written in Rust. It's designed as a drop-in replacement for `pip`, `pip-tools`, `pipx`, `venv`, and `virtualenv`, with `pyenv` support coming soon. Created by [Astral](https://astral.sh/), the same team behind the high-performance linter [Ruff](https://docs.astral.sh/ruff/), `uv` aims to significantly speed up and simplify Python project management. It offers a unified toolchain that handles virtual environments, dependency resolution, package installation, and more, all while providing exceptional performance.
10
10
11
-
## Why should you use uv?
11
+
## 🚀 Why should you use uv?
12
12
13
-
`uv` offers several compelling advantages for Python developers, especially in the context of MLOps:
13
+
`uv` offers several compelling advantages for Python developers, especially in the context of MLOps.
|**Dependency Resolution**| Advanced, high-performance resolver | Basic, can be slow for complex cases |
20
+
|**Caching**| Aggressive and efficient | Less effective |
21
+
|**Disk Space**| Efficient, uses less space | Can be bloated |
14
22
15
23
-**Performance**: `uv` is incredibly fast, often outperforming `pip`, `venv`, and `pyenv` by a significant margin. This speed translates to faster project setup, quicker dependency resolution, and reduced wait times during development and deployment.
16
24
-**Unified Toolchain**: `uv` replaces multiple tools, simplifying your development workflow. It can manage virtual environments, install packages, and resolve dependencies, all within a single command-line interface.
@@ -19,7 +27,15 @@ description: Discover uv, a fast and versatile Python package manager and projec
19
27
-**Cross-Platform Compatibility**: `uv` works seamlessly across Linux, macOS, and Windows, ensuring a consistent experience regardless of your operating system.
20
28
-**Caching**: `uv` implements aggressive caching mechanisms to avoid redundant work, further speeding up operations like package installation and environment setup.
21
29
22
-
## How to install uv?
30
+
### 💡 MLOps Benefits
31
+
32
+
In MLOps, reproducibility and speed are critical. `uv` helps on both fronts:
33
+
34
+
-**Faster CI/CD Pipelines**: By speeding up dependency installation, `uv` can significantly reduce the time your CI/CD pipelines take to run.
35
+
-**Consistent Environments**: `uv`'s fast and reliable dependency resolution ensures that you can create consistent and reproducible environments for your machine learning models.
36
+
-**Simplified Dependency Management**: No more juggling multiple tools. `uv` simplifies your `pyproject.toml` or `requirements.txt` management.
37
+
38
+
## 📦 How to install uv?
23
39
24
40
[Installing `uv` is straightforward](https://docs.astral.sh/uv/getting-started/installation/). The recommended method is to use the official installation script, which automatically detects your operating system and installs the appropriate version:
25
41
@@ -41,119 +57,105 @@ Once installed, verify the installation by checking the version:
41
57
uv --version
42
58
```
43
59
44
-
## How to use uv as a drop-in replacement for pip?
60
+
## 🥧 How to use uv as a drop-in replacement for pip?
45
61
46
62
`uv` can be used as a direct replacement for many common `pip` commands. Here's how:
47
63
48
64
-**Installing packages**:
49
-
50
-
```bash
51
-
uv pip install requests numpy pandas
52
-
```
53
-
65
+
```bash
66
+
uv pip install requests numpy pandas
67
+
```
54
68
-**Uninstalling packages**:
55
-
56
-
```bash
57
-
uv pip uninstall requests
58
-
```
59
-
69
+
```bash
70
+
uv pip uninstall requests
71
+
```
60
72
-**Listing installed packages**:
61
-
62
-
```bash
63
-
uv pip freeze
64
-
```
65
-
73
+
```bash
74
+
uv pip freeze
75
+
```
66
76
-**Updating packages**:
67
-
68
-
```bash
69
-
uv pip install --upgrade requests
70
-
```
71
-
77
+
```bash
78
+
uv pip install --upgrade requests
79
+
```
72
80
-**Installing packages from a `requirements.txt` file**:
81
+
```bash
82
+
uv pip install -r requirements.txt
83
+
```
73
84
74
-
```bash
75
-
uv pip install -r requirements.txt
76
-
```
77
-
78
-
## How to use uv as a drop-in replacement for venv?
85
+
## 🌳 How to use uv as a drop-in replacement for venv?
79
86
80
87
`uv` can also replace `venv` for creating and managing virtual environments:
81
88
82
89
-**Creating a virtual environment**:
83
-
84
-
```bash
85
-
uv venv
86
-
```
87
-
88
-
This command creates a new virtual environment in the `.venv` directory by default. You can customize the location using the `--python` flag to specify a Python interpreter path.
89
-
90
+
```bash
91
+
uv venv
92
+
```
93
+
This command creates a new virtual environment in the `.venv` directory by default. You can customize the location or specify a Python interpreter:
94
+
```bash
95
+
uv venv--python 3.11
96
+
```
90
97
-**Activating the virtual environment**:
91
-
92
-
The activation process depends on your shell. For example, on bash:
93
-
94
-
```bash
95
-
source .venv/bin/activate
96
-
```
97
-
98
+
The activation process is the same as with `venv`. On macOS and Linux:
99
+
```bash
100
+
source .venv/bin/activate
101
+
```
102
+
On Windows:
103
+
```powershell
104
+
.venv\Scripts\Activate
105
+
```
98
106
-**Listing available Python interpreters**:
107
+
```bash
108
+
uv python list
109
+
```
99
110
100
-
```bash
101
-
uv python list
102
-
```
103
-
104
-
## How to use uv as a drop-in replacement for pipx?
111
+
## 🛠️ How to use uv as a drop-in replacement for pipx?
105
112
106
113
`uv` can also replace `pipx` for installing and managing globally available Python tools:
107
114
108
115
-**Installing a tool globally**:
109
-
110
-
```bash
111
-
uv tool install ruff
112
-
```
113
-
116
+
```bash
117
+
uv tool install ruff
118
+
```
114
119
-**Listing globally installed tools**:
115
-
116
-
```bash
117
-
uv tool list
118
-
```
119
-
120
+
```bash
121
+
uv tool list
122
+
```
120
123
-**Running a tool without installing it**:
124
+
This is useful for one-off commands without cluttering your global environment.
125
+
```bash
126
+
uv tool run ruff --version
127
+
```
121
128
122
-
```bash
123
-
uv tool run ruff --version
124
-
```
125
-
126
-
## How to install a Python version with uv?
129
+
## 🐍 How to install a Python version with uv?
127
130
128
131
`uv` can also be used to install specific Python versions, similar to `pyenv`. This is particularly useful when you need to test your code against different Python environments or when a project requires a specific Python version that is not your system's default.
129
132
130
133
-**Installing a specific Python version**:
131
-
132
-
```bash
133
-
uv python install 3.13
134
-
```
135
-
136
-
This command downloads and installs Python 3.13. You can then use this version to create virtual environments or run scripts.
137
-
134
+
```bash
135
+
uv python install 3.13
136
+
```
137
+
This command downloads and installs Python 3.13. You can then use this version to create virtual environments or run scripts.
138
138
-**Listing available Python versions**:
139
-
140
-
```bash
141
-
uv python list
142
-
```
143
-
139
+
```bash
140
+
uv python list
141
+
```
144
142
-**Listing installed Python versions**:
145
-
146
-
```bash
147
-
uv python list --only-installed
148
-
```
149
-
143
+
```bash
144
+
uv python list --only-installed
145
+
```
150
146
-**Removing a specific Python version**:
147
+
```bash
148
+
uv python remove 3.13
149
+
```
151
150
152
-
```bash
153
-
uv python remove 3.13
154
-
```
151
+
## 🎯 Key Takeaways
152
+
153
+
-**`uv` is a fast, all-in-one tool** for Python package and project management.
154
+
- It can replace `pip`, `venv`, `pipx`, and more, simplifying your workflow.
155
+
- In MLOps, `uv` shines by **speeding up CI/CD pipelines** and ensuring **reproducible environments**.
156
+
- Adopting `uv` can lead to a more efficient and streamlined development process.
155
157
156
-
## uv additional resources
158
+
## 📚 uv additional resources
157
159
158
160
-**[uv Documentation](https://docs.astral.sh/uv/)**: The official documentation provides comprehensive information on all `uv` features and commands.
159
161
-**[Poetry Was Good, Uv Is Better: An MLOps Migration Story](https://medium.com/@fmind/poetry-was-good-uv-is-better-an-mlops-migration-story-f52bf0c6c703)**
0 commit comments