Skip to content

Commit 8f8d26c

Browse files
Improve section 1.2 of the course (#19)
* 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]>
1 parent f27ef3f commit 8f8d26c

File tree

2 files changed

+149
-87
lines changed

2 files changed

+149
-87
lines changed

GEMINI.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Python Version
2+
3+
This projects uses Python 3.11
4+
5+
# Style Guide
6+
7+
Respect the following markdownlint rules:
8+
9+
- **[MD001](https://github.com/DavidAnson/markdownlint/blob/main/doc/md001.md)** _heading-increment_ - Heading levels should only increment by one level at a time
10+
- **[MD003](https://github.com/DavidAnson/markdownlint/blob/main/doc/md003.md)** _heading-style_ - Heading style
11+
- **[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
14+
- **[MD009](https://github.com/DavidAnson/markdownlint/blob/main/doc/md009.md)** _no-trailing-spaces_ - Trailing spaces
15+
- **[MD010](https://github.com/DavidAnson/markdownlint/blob/main/doc/md010.md)** _no-hard-tabs_ - Hard tabs
16+
- **[MD011](https://github.com/DavidAnson/markdownlint/blob/main/doc/md011.md)** _no-reversed-links_ - Reversed link syntax
17+
- **[MD012](https://github.com/DavidAnson/markdownlint/blob/main/doc/md012.md)** _no-multiple-blanks_ - Multiple consecutive blank lines
18+
- **[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
23+
- **[MD021](https://github.com/DavidAnson/markdownlint/blob/main/doc/md021.md)** _no-multiple-space-closed-atx_ - Multiple spaces inside hashes on closed atx style heading
24+
- **[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
37+
- **[MD035](https://github.com/DavidAnson/markdownlint/blob/main/doc/md035.md)** _hr-style_ - Horizontal rule style
38+
- **[MD036](https://github.com/DavidAnson/markdownlint/blob/main/doc/md036.md)** _no-emphasis-as-heading_ - Emphasis used instead of a heading
39+
- **[MD037](https://github.com/DavidAnson/markdownlint/blob/main/doc/md037.md)** _no-space-in-emphasis_ - Spaces inside emphasis markers
40+
- **[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
45+
- **[MD043](https://github.com/DavidAnson/markdownlint/blob/main/doc/md043.md)** _required-headings_ - Required heading structure
46+
- **[MD044](https://github.com/DavidAnson/markdownlint/blob/main/doc/md044.md)** _proper-names_ - Proper names should have the correct capitalization
47+
- **[MD045](https://github.com/DavidAnson/markdownlint/blob/main/doc/md045.md)** _no-alt-text_ - Images should have alternate text (alt text)
48+
- **[MD046](https://github.com/DavidAnson/markdownlint/blob/main/doc/md046.md)** _code-block-style_ - Code block style
49+
- **[MD047](https://github.com/DavidAnson/markdownlint/blob/main/doc/md047.md)** _single-trailing-newline_ - Files should end with a single newline character
50+
- **[MD048](https://github.com/DavidAnson/markdownlint/blob/main/doc/md048.md)** _code-fence-style_ - Code fence style
51+
- **[MD049](https://github.com/DavidAnson/markdownlint/blob/main/doc/md049.md)** _emphasis-style_ - Emphasis style
52+
- **[MD050](https://github.com/DavidAnson/markdownlint/blob/main/doc/md050.md)** _strong-style_ - Strong style
53+
- **[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
57+
- **[MD055](https://github.com/DavidAnson/markdownlint/blob/main/doc/md055.md)** _table-pipe-style_ - Table pipe style
58+
- **[MD056](https://github.com/DavidAnson/markdownlint/blob/main/doc/md056.md)** _table-column-count_ - Table column count
59+
- **[MD058](https://github.com/DavidAnson/markdownlint/blob/main/doc/md058.md)** _blanks-around-tables_ - Tables should be surrounded by blank lines
60+
- **[MD059](https://github.com/DavidAnson/markdownlint/blob/main/doc/md059.md)** _descriptive-link-text_ - Link text should be descriptive

docs/1. Initializing/1.2. uv.md

Lines changed: 89 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
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.
33
---
44

5-
# 1.2. uv
5+
# 1.2. uv ⚡️
66

7-
## What is uv?
7+
## 🤔 What is uv?
88

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.
1010

11-
## Why should you use uv?
11+
## 🚀 Why should you use uv?
1212

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.
14+
15+
| Feature | `uv` | `pip`, `venv`, `pipx`, etc. |
16+
| ----------------------- | ---------------------------------- | --------------------------------------- |
17+
| **Speed** | Blazing fast (written in Rust) | Slower (written in Python) |
18+
| **Tooling** | Unified (all-in-one tool) | Fragmented (multiple tools) |
19+
| **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 |
1422

1523
- **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.
1624
- **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
1927
- **Cross-Platform Compatibility**: `uv` works seamlessly across Linux, macOS, and Windows, ensuring a consistent experience regardless of your operating system.
2028
- **Caching**: `uv` implements aggressive caching mechanisms to avoid redundant work, further speeding up operations like package installation and environment setup.
2129

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?
2339

2440
[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:
2541

@@ -41,119 +57,105 @@ Once installed, verify the installation by checking the version:
4157
uv --version
4258
```
4359

44-
## How to use uv as a drop-in replacement for pip?
60+
## 🥧 How to use uv as a drop-in replacement for pip?
4561

4662
`uv` can be used as a direct replacement for many common `pip` commands. Here's how:
4763

4864
- **Installing packages**:
49-
50-
```bash
51-
uv pip install requests numpy pandas
52-
```
53-
65+
```bash
66+
uv pip install requests numpy pandas
67+
```
5468
- **Uninstalling packages**:
55-
56-
```bash
57-
uv pip uninstall requests
58-
```
59-
69+
```bash
70+
uv pip uninstall requests
71+
```
6072
- **Listing installed packages**:
61-
62-
```bash
63-
uv pip freeze
64-
```
65-
73+
```bash
74+
uv pip freeze
75+
```
6676
- **Updating packages**:
67-
68-
```bash
69-
uv pip install --upgrade requests
70-
```
71-
77+
```bash
78+
uv pip install --upgrade requests
79+
```
7280
- **Installing packages from a `requirements.txt` file**:
81+
```bash
82+
uv pip install -r requirements.txt
83+
```
7384

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?
7986

8087
`uv` can also replace `venv` for creating and managing virtual environments:
8188

8289
- **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+
```
9097
- **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+
```
98106
- **Listing available Python interpreters**:
107+
```bash
108+
uv python list
109+
```
99110

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?
105112

106113
`uv` can also replace `pipx` for installing and managing globally available Python tools:
107114

108115
- **Installing a tool globally**:
109-
110-
```bash
111-
uv tool install ruff
112-
```
113-
116+
```bash
117+
uv tool install ruff
118+
```
114119
- **Listing globally installed tools**:
115-
116-
```bash
117-
uv tool list
118-
```
119-
120+
```bash
121+
uv tool list
122+
```
120123
- **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+
```
121128

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?
127130

128131
`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.
129132

130133
- **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.
138138
- **Listing available Python versions**:
139-
140-
```bash
141-
uv python list
142-
```
143-
139+
```bash
140+
uv python list
141+
```
144142
- **Listing installed Python versions**:
145-
146-
```bash
147-
uv python list --only-installed
148-
```
149-
143+
```bash
144+
uv python list --only-installed
145+
```
150146
- **Removing a specific Python version**:
147+
```bash
148+
uv python remove 3.13
149+
```
151150

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.
155157

156-
## uv additional resources
158+
## 📚 uv additional resources
157159

158160
- **[uv Documentation](https://docs.astral.sh/uv/)**: The official documentation provides comprehensive information on all `uv` features and commands.
159161
- **[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

Comments
 (0)