Skip to content

Commit 10ae36a

Browse files
committed
Replace poetry by uv
1 parent f785745 commit 10ae36a

30 files changed

+248
-197
lines changed

docs/0. Overview/0.6. Resources.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ To propose a new project resource, please forward your suggestions to the course
2121
## Additional vendor resources
2222

2323
- **[MLOps Python Package](https://github.com/fmind/mlops-python-package)**
24+
- **[LLMOps Python Package](https://github.com/callmesora/llmops-python-package/)**
2425
- **[Cookiecutter MLOps Package](https://github.com/fmind/cookiecutter-mlops-package)**
2526
- [MLOps: Continuous delivery and automation pipelines in machine learning](https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning)
2627
- [The Big Book of MLOps](https://www.databricks.com/sites/default/files/2023-10/2023-10-eb-big-book-of-mlops-2nd-edition-v2-102723-final.pdf)

docs/1. Initializing/1.0. System.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ While [JupyterLab](https://jupyterlab.readthedocs.io/en/latest/) is an acceptabl
1414

1515
## Are additional software installations required?
1616

17-
Engaging with this course material necessitates installing several key software packages, including Python, Poetry, git, and VS Code. These tools form the backbone of your development workflow:
17+
Engaging with this course material necessitates installing several key software packages, including Python, uv, git, and VS Code. These tools form the backbone of your development workflow:
1818

1919
- **Python** is indispensable for all course-related coding activities.
20-
- **Poetry** offers an efficient way to manage Python package dependencies.
20+
- **uv** offers an efficient way to manage Python package dependencies.
2121
- **Git** is crucial for version control and collaboration.
2222
- **VS Code** is recommended for its integrated development environment (IDE) capabilities, although alternatives may be used based on personal preference or specific needs.
2323

docs/1. Initializing/1.3. Poetry.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ These configurations ensure that Poetry creates virtual environments directly wi
126126

127127
## How can you install dependencies for your project with Poetry?
128128

129-
Poetry differentiates between main (production) and development dependencies, offering an organized approach to dependency management. To add dependencies, use the following commands:
129+
Uv differentiates between main (production) and development dependencies, offering an organized approach to dependency management. To add dependencies, use the following commands:
130130

131131
```bash
132132
# For main dependencies
133-
$ poetry add pandas scikit-learn
133+
$ uv add pandas scikit-learn
134134

135135
# For development dependencies
136-
$ poetry add -G dev ipykernel
136+
$ uv add --group dev ipykernel
137137
```
138138

139139
Executing these commands updates the `pyproject.toml` file, accurately managing and versioning your project's dependencies.
@@ -144,9 +144,9 @@ In production, you can decide to install only the main dependencies using [this
144144
poetry install --only main
145145
```
146146

147-
## What is the difference between main and dev dependencies in Poetry?
147+
## What is the difference between main and dev dependencies in uv?
148148

149-
In Poetry, dependencies are divided into two types: main dependencies and development (dev) dependencies.
149+
In uv, dependencies are divided into two types: main dependencies and development (dev) dependencies.
150150

151151
**Main Dependencies**: These are essential for your project's production environment—your application can't run without them. For example, libraries like Pandas or XGBoost would be main dependencies for an MLOps project.
152152

docs/1. Initializing/1.4. git.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ When using Git, it's important to selectively track files. Consider the followin
4949

5050
- **Exclude Secrets**: Sensitive data, such as API keys and passwords, should never be committed to your repository.
5151
- **Manage Large Files**: For files exceeding 100MB (e.g., dataset files), use Git Large File Storage ([git-lfs](https://git-lfs.github.com/)) instead of directly committing them to your Git repository.
52-
- **Omit Cache Files**: Do not track temporary or environment-specific files (e.g., `.venv`, `poetry.lock`, log files) that don't contribute to the project's primary function.
52+
- **Omit Cache Files**: Do not track temporary or environment-specific files (e.g., `.venv`, `mlruns`, log files) that don't contribute to the project's primary function.
5353

5454
To exclude certain files and directories from being tracked, create a `.gitignore` file in your project's root directory. This file should list patterns to match filenames you wish to exclude, for example:
5555

docs/1. Initializing/1.6. VS Code.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,19 +238,19 @@ You can find below some settings for configuring VS Code. Each setting is annota
238238
}
239239
```
240240

241-
## How to configure VS Code for using the [Jupyter Extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) with [Poetry](https://python-poetry.org/)?
241+
## How to configure VS Code for using the [Jupyter Extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) with [uv](https://docs.astral.sh/uv/)?
242242

243-
To configure VS Code for using the [Jupyter Extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) with [Poetry](https://python-poetry.org/), follow these steps to ensure that your Poetry-managed virtual environment is recognized within VS Code. This allows you to use the Jupyter Extension seamlessly with the Python interpreter provided by Poetry.
243+
To configure VS Code for using the [Jupyter Extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) with [uv](https://docs.astral.sh/uv/), follow these steps to ensure that your uv-managed virtual environment is recognized within VS Code. This allows you to use the Jupyter Extension seamlessly with the Python interpreter provided by uv.
244244

245245
1. **Install the Jupyter Extension**: First, ensure that the [Jupyter Extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) is installed in VS Code. You can find and install this extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/VSCode).
246-
2. **Open Your Project in VS Code**: Open your project folder in VS Code. If you've just created a new Poetry project, this will be the directory containing your `pyproject.toml` file.
247-
3. **Select Python Interpreter**: To make VS Code use the Python interpreter from your Poetry environment:
246+
2. **Open Your Project in VS Code**: Open your project folder in VS Code. If you've just created a new uv project, this will be the directory containing your `pyproject.toml` file.
247+
3. **Select Python Interpreter**: To make VS Code use the Python interpreter from your uv environment:
248248
- Open the Command Palette (`Ctrl+Shift+P` on Windows/Linux, `Cmd+Shift+P` on macOS).
249249
- Type `Python: Select Interpreter` and select it.
250-
- Look for the interpreter that corresponds to your Poetry environment. It will typically be located under the `.venv` path within your project directory or listed as a virtual environment with your project's name.
250+
- Look for the interpreter that corresponds to your uv environment. It will typically be located under the `.venv` path within your project directory or listed as a virtual environment with your project's name.
251251
- Select the appropriate interpreter.
252-
4. **Verify Jupyter Notebook Configuration**: Create a new Jupyter notebook in VS Code (`*.ipynb` file) and verify that the cells execute using the Python interpreter from your Poetry environment. You can check the upper-right corner of the notebook interface to see which interpreter is currently active.
253-
5. **Install Necessary Libraries**: If you need additional Python libraries that are not yet part of your Poetry project, you can add them by running `poetry add <library-name>` in your terminal or command prompt. This ensures that all dependencies are managed by Poetry and available in the notebook.
252+
4. **Verify Jupyter Notebook Configuration**: Create a new Jupyter notebook in VS Code (`*.ipynb` file) and verify that the cells execute using the Python interpreter from your uv environment. You can check the upper-right corner of the notebook interface to see which interpreter is currently active.
253+
5. **Install Necessary Libraries**: If you need additional Python libraries that are not yet part of your uv project, you can add them by running `uv add <library-name>` in your terminal or command prompt. This ensures that all dependencies are managed by uv and available in the notebook.
254254

255255
## VS Code additional resources
256256

docs/2. Prototyping/2.0. Notebooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ As an alternative to notebooks, consider using the [Python Interactive Window](h
2828

2929
Using notebooks in the early stages of development offers many advantages; however, they are not well-suited for production environments due to several limitations:
3030

31-
- **Lack of Integration**: Notebooks often do not integrate seamlessly with tools commonly used in the Python software development ecosystem, such as testing frameworks (pytest), linting tools (ruff), and package managers (poetry).
31+
- **Lack of Integration**: Notebooks often do not integrate seamlessly with tools commonly used in the Python software development ecosystem, such as testing frameworks (pytest), linting tools (ruff), and package managers (uv).
3232
- **Mixed Content**: The intermingling of code, output, and narrative in a single document can complicate version control and maintenance, especially with complex projects.
3333
- **Non-Sequential Flow**: Notebooks do not enforce a linear execution order, which can lead to confusion and errors if cells are run out of sequence.
3434
- **Lack of Reusability**: The format of notebooks does not naturally encourage the development of reusable and modular code, such as functions, classes, or packages.

docs/2. Prototyping/2.1. Imports.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ In the realm of data science, a few key Python packages form the backbone of mos
3333
- **[Matplotlib](https://matplotlib.org/) or [Plotly](https://plotly.com/)**: For creating static, interactive, and animated visualizations.
3434
- **[Scikit-learn](https://scikit-learn.org/stable/)**: For machine learning, providing simple and efficient tools for data analysis and modeling.
3535

36-
To integrate these packages into your project using poetry, you can execute the following command in your terminal:
36+
To integrate these packages into your project using uv, you can execute the following command in your terminal:
3737

3838
```bash
39-
poetry add pandas numpy matplotlib scikit-learn plotly
39+
uv add pandas numpy matplotlib scikit-learn plotly
4040
```
4141

42-
This command tells poetry to download and install these packages, along with their dependencies, into your project environment, ensuring version compatibility and easy package management.
42+
This command tells uv to download and install these packages, along with their dependencies, into your project environment, ensuring version compatibility and easy package management.
4343

4444
## How should you organize your imports to facilitate your work?
4545

docs/2. Prototyping/2.2. Configs.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ Here's a practical illustration of configs within a notebook context:
1212

1313
```python
1414
# Define paths for caching and training data
15-
CACHE_PATH = '../.cache/'
16-
TRAIN_DATA_PATH = '../data/train.csv'
15+
ROOT = Path("../")
16+
DATA = str(ROOT / "data")
17+
CACHE = str(ROOT / ".cache")
18+
HOUR = str(DATA / "hour.csv")
1719
# Configure random state for reproducibility
18-
RANDOM_STATE = 0
20+
RANDOM = 42
21+
# Define dataset columns for feature engineering
22+
INDEX = "instant"
23+
TARGET = "cnt"
1924
# Setup dataset parameters for testing and shuffling
20-
SHUFFLE = True
21-
TEST_SIZE = 0.2
22-
TARGET = "SalePrice"
25+
SPLITS = 4
26+
SHUFFLE = False # required (time sensitive)
27+
TEST_SIZE = 24 * 30 * 2 # use 2 months for backtesting
2328
# Parameters for pipeline configurations
24-
CV = 5
2529
SCORING = "neg_mean_squared_error"
2630
PARAM_GRID = {
2731
"regressor__max_depth": [12, 15, 18, 21],

docs/2. Prototyping/2.4. Analysis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ For instance, [Plotly Express's `scatter_matrix`](https://plotly.com/python/splo
4646
import plotly.express as px
4747
df = pd.read_csv('your_dataset.csv')
4848
px.scatter_matrix(
49-
df, dimensions=["feature1", "feature2", "feature3"], color="target_variable",
50-
height=800, title="Scatter Matrix of Features"
49+
df, dimensions=["feature1", "feature2", "feature3"], color="target_variable",
50+
height=800, title="Scatter Matrix of Features"
5151
)
5252
```
5353

docs/2. Prototyping/2.5. Modeling.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ PARAM_GRID = {
135135
"regressor__max_depth": [15, 20, 25],
136136
"regressor__n_estimators": [150, 200, 250],
137137
}
138-
RANDOM_STATE = 0
139138

140139
splitter = model_selection.TimeSeriesSplit(n_splits=CV)
141140

0 commit comments

Comments
 (0)