Skip to content

Commit f16d240

Browse files
authored
Release/v3.0.0 (#31)
1 parent 6baa645 commit f16d240

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+8287
-8109
lines changed

.github/actions/setup/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ description: Setup for project workflows
33
runs:
44
using: composite
55
steps:
6-
- run: pipx install invoke poetry
7-
shell: bash
8-
- uses: actions/setup-python@v5
6+
- name: Install uv
7+
uses: astral-sh/setup-uv@v4
98
with:
10-
python-version: 3.12
11-
cache: poetry
9+
enable-cache: true
10+
- name: Setup Python
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version-file: .python-version

.github/workflows/check.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check
22
on:
33
pull_request:
44
branches:
5-
- main
5+
- '*'
66
concurrency:
77
cancel-in-progress: true
88
group: ${{ github.workflow }}-${{ github.ref }}
@@ -12,5 +12,9 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: ./.github/actions/setup
15-
- run: poetry install --with checks
16-
- run: poetry run invoke checks
15+
- run: uv sync --group=checks
16+
- run: uv run invoke checks.format
17+
- run: uv run invoke checks.type
18+
- run: uv run invoke checks.code
19+
- run: uv run invoke checks.security
20+
- run: uv run invoke checks.coverage

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: ./.github/actions/setup
18-
- run: poetry install --with docs
19-
- run: poetry run invoke docs
18+
- run: uv sync --group=docs
19+
- run: uv run invoke docs
2020
- uses: JamesIves/github-pages-deploy-action@v4
2121
with:
2222
folder: docs/
@@ -28,8 +28,8 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v4
3030
- uses: ./.github/actions/setup
31-
- run: poetry install --with dev
32-
- run: poetry run invoke packages
31+
- run: uv sync --only-dev
32+
- run: uv run invoke packages
3333
- uses: docker/login-action@v3
3434
with:
3535
registry: ghcr.io

.pre-commit-config.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default_language_version:
55
python: python3.12
66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.6.0
8+
rev: v5.0.0
99
hooks:
1010
- id: check-added-large-files
1111
- id: check-case-conflict
@@ -16,18 +16,14 @@ repos:
1616
- id: end-of-file-fixer
1717
- id: mixed-line-ending
1818
- id: trailing-whitespace
19-
- repo: https://github.com/python-poetry/poetry
20-
rev: 1.8.3
21-
hooks:
22-
- id: poetry-check
2319
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.5.0
20+
rev: v0.8.1
2521
hooks:
2622
- id: ruff
2723
- id: ruff-format
2824
- repo: https://github.com/commitizen-tools/commitizen
29-
rev: v3.27.0
25+
rev: v4.0.0
3026
hooks:
3127
- id: commitizen
3228
- id: commitizen-branch
33-
stages: [push]
29+
stages: [pre-push]

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## v3.0.0 (2024-12-14)
2+
3+
### Feat
4+
5+
- **mlflow**: bump to 2.19.0
6+
- **manager**: switch from poetry to uv (#22)
7+
- **manager**: switch from poetry to uv
8+
9+
### Fix
10+
11+
- **tasks**: merge conflict
12+
- **tasks**: fix mlflow.serve task attribute
13+
- **github-actions**: run check on all PR
14+
15+
### Refactor
16+
17+
- **release**: prepare before release
18+
- **actions**: split check tasks into subtask for easier debugging (#29)
19+
- **code**: improve abstractions (#28)
20+
121
## v2.0.0 (2024-07-28)
222

323
### Feat

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://docs.docker.com/engine/reference/builder/
22

3-
FROM python:3.12
3+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
44
COPY dist/*.whl .
5-
RUN pip install *.whl
5+
RUN uv pip install --system *.whl
66
CMD ["bikes", "--help"]

LICENCE.txt renamed to LICENSE.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Copyright 2024 Médéric HURIER (Fmind)
2-
31
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
42

53
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The package leverages several [tools](#tools) and [tips](#tips) to make your MLO
1313
You can use this package as part of your MLOps toolkit or platform (e.g., Model Registry, Experiment Tracking, Realtime Inference, ...).
1414

1515
**Related Resources**:
16+
- **[LLMOps Coding Package (Example)](https://github.com/callmesora/llmops-python-package/)**: Example with best practices and tools to support your LLMOps projects.
1617
- **[MLOps Coding Course (Learning)](https://github.com/MLOps-Courses/mlops-coding-course)**: Learn how to create, develop, and maintain a state-of-the-art MLOps code base.
1718
- **[Cookiecutter MLOps Package (Template)](https://github.com/fmind/cookiecutter-mlops-package)**: Start building and deploying Python packages and Docker images for MLOps tasks.
1819

@@ -69,7 +70,7 @@ You can use this package as part of your MLOps toolkit or platform (e.g., Model
6970
- [Package](#package)
7071
- [Evolution: Changelog](#evolution-changelog)
7172
- [Format: Wheel](#format-wheel)
72-
- [Manager: Poetry](#manager-poetry)
73+
- [Manager: uv](#manager-uv)
7374
- [Runtime: Docker](#runtime-docker)
7475
- [Programming](#programming)
7576
- [Language: Python](#language-python)
@@ -119,7 +120,7 @@ This section details the requirements, actions, and next steps to kickstart your
119120
## Prerequisites
120121

121122
- [Python>=3.12](https://www.python.org/downloads/): to benefit from [the latest features and performance improvements](https://docs.python.org/3/whatsnew/3.12.html)
122-
- [Poetry>=1.8.2](https://python-poetry.org/): to initialize the project [virtual environment](https://docs.python.org/3/library/venv.html) and its dependencies
123+
- [uv>=0.5.5](https://docs.astral.sh/uv/): to initialize the project [virtual environment](https://docs.python.org/3/library/venv.html) and its dependencies
123124

124125
## Installation
125126

@@ -130,10 +131,10 @@ $ git clone [email protected]:fmind/mlops-python-package
130131
# with https
131132
$ git clone https://github.com/fmind/mlops-python-package
132133
```
133-
2. [Run the project installation with poetry](https://python-poetry.org/docs/)
134+
2. [Run the project installation with uv](https://docs.astral.sh/uv/)
134135
```bash
135136
$ cd mlops-python-package/
136-
$ poetry install
137+
$ uv sync
137138
```
138139
3. Adapt the code base to your desire
139140

@@ -171,26 +172,26 @@ This config file instructs the program to start a `TrainingJob` with 2 parameter
171172

172173
You can find all the parameters of your program in the `src/[package]/jobs/*.py` files.
173174

174-
You can also print the full schema supported by this package using `poetry run bikes --schema`.
175+
You can also print the full schema supported by this package using `uv run bikes --schema`.
175176

176177
## Execution
177178

178-
The project code can be executed with poetry during your development:
179+
The project code can be executed with uv during your development:
179180

180181
```bash
181-
$ poetry run [package] confs/tuning.yaml
182-
$ poetry run [package] confs/training.yaml
183-
$ poetry run [package] confs/promotion.yaml
184-
$ poetry run [package] confs/inference.yaml
185-
$ poetry run [package] confs/evaluations.yaml
186-
$ poetry run [package] confs/explanations.yaml
182+
$ uv run [package] confs/tuning.yaml
183+
$ uv run [package] confs/training.yaml
184+
$ uv run [package] confs/promotion.yaml
185+
$ uv run [package] confs/inference.yaml
186+
$ uv run [package] confs/evaluations.yaml
187+
$ uv run [package] confs/explanations.yaml
187188
```
188189

189190
In production, you can build, ship, and run the project as a Python package:
190191

191192
```bash
192-
poetry build
193-
poetry publish # optional
193+
uv build
194+
uv publish # optional
194195
python -m pip install [package]
195196
[package] confs/inference.yaml
196197
```
@@ -211,7 +212,7 @@ with job as runner:
211212
- You can pass several config files in the command-line to merge them from left to right
212213
- You can define common configurations shared between jobs (e.g., model params)
213214
- The right job task will be selected automatically thanks to [Pydantic Discriminated Unions](https://docs.pydantic.dev/latest/concepts/unions/#discriminated-unions)
214-
- This is a great way to run any job supported by the application (training, tuning, ....
215+
- This is a great way to run any job supported by the application (training, tuning, ...)
215216

216217
## Automation
217218

@@ -233,7 +234,6 @@ $ inv --list
233234
- **checks.code** - Check the codes with ruff.
234235
- **checks.coverage** - Check the coverage with coverage.
235236
- **checks.format** - Check the formats with ruff.
236-
- **checks.poetry** - Check poetry config files.
237237
- **checks.security** - Check the security with bandit.
238238
- **checks.test** - Check the tests with pytest.
239239
- **checks.type** - Check the types with mypy.
@@ -247,15 +247,15 @@ $ inv --list
247247
- **cleans.mlruns** - Clean the mlruns folder.
248248
- **cleans.mypy** - Clean the mypy tool.
249249
- **cleans.outputs** - Clean the outputs folder.
250-
- **cleans.poetry** - Clean poetry lock file.
251-
- **cleans.pytest** - Clean the pytest tool.
252250
- **cleans.projects** - Run all projects tasks.
251+
- **cleans.pytest** - Clean the pytest tool.
253252
- **cleans.python** - Clean python caches and bytecodes.
254253
- **cleans.requirements** - Clean the project requirements file.
255254
- **cleans.reset** - Run all tools, folders, and sources tasks.
256255
- **cleans.ruff** - Clean the ruff tool.
257256
- **cleans.sources** - Run all sources tasks.
258257
- **cleans.tools** - Run all tools tasks.
258+
- **cleans.uv** - Clean uv lock file.
259259
- **cleans.venv** - Clean the venv folder.
260260
- **commits.all (commits)** - Run all commit tasks.
261261
- **commits.bump** - Bump the version of the package.
@@ -272,8 +272,8 @@ $ inv --list
272272
- **formats.imports** - Format python imports with ruff.
273273
- **formats.sources** - Format python sources with ruff.
274274
- **installs.all (installs)** - Run all install tasks.
275-
- **installs.poetry** - Install poetry packages.
276275
- **installs.pre-commit** - Install pre-commit hooks on git.
276+
- **installs.uv** - Install uv packages.
277277
- **mlflow.all (mlflow)** - Run all mlflow tasks.
278278
- **mlflow.doctor** - Run mlflow doctor to diagnose issues.
279279
- **mlflow.serve** - Start mlflow server with the given host, port, and backend uri.
@@ -684,17 +684,18 @@ Define and build modern Python package.
684684
- [Source](https://docs.python.org/3/distutils/sourcedist.html): older format, less powerful
685685
- [Conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html): slow and hard to manage
686686

687-
### Manager: [Poetry](https://python-poetry.org/)
687+
### Manager: [uv](https://docs.astral.sh/uv/)
688688

689689
- **Motivations**:
690690
- Define and build Python package
691-
- Most popular solution by GitHub stars
691+
- Fast and compliant package manager
692692
- Pack every metadata in a single static file
693693
- **Limitations**:
694694
- Cannot add dependencies beyond Python (e.g., CUDA)
695695
- i.e., use Docker container for this use case
696696
- **Alternatives**:
697697
- [Setuptools](https://docs.python.org/3/distutils/setupscript.html): dynamic file is slower and more risky
698+
- [Poetry](https://python-poetry.org/): previous solution of this package
698699
- Pdm, Hatch, PipEnv: https://xkcd.com/1987/
699700

700701
### Runtime: [Docker](https://www.docker.com/resources/what-container/)
@@ -937,10 +938,10 @@ Using Python package for your AI/ML project has the following benefits:
937938
- Install Python package as a library (e.g., like pandas)
938939
- Expose script entry points to run a CLI or a GUI
939940

940-
To build a Python package with Poetry, you simply have to type in a terminal:
941+
To build a Python package with uv, you simply have to type in a terminal:
941942
```bash
942-
# for all poetry project
943-
poetry build
943+
# for all uv project
944+
uv build
944945
# for this project only
945946
inv packages
946947
```
@@ -1044,7 +1045,7 @@ Semantic Versioning (SemVer) provides a simple schema to communicate code change
10441045
- *Minor* (Y): minor release with new features (i.e., provide new capabilities)
10451046
- *Patch* (Z): patch release to fix bugs (i.e., correct wrong behavior)
10461047

1047-
Poetry and this package leverage Semantic Versioning to let developers control the speed of adoption for new releases.
1048+
Uv and this package leverage Semantic Versioning to let developers control the speed of adoption for new releases.
10481049

10491050
## [Testing Tricks](https://en.wikipedia.org/wiki/Software_testing)
10501051

data/inputs_test.parquet

-1.57 KB
Binary file not shown.

data/inputs_train.parquet

-1.61 KB
Binary file not shown.

data/targets_test.parquet

-203 Bytes
Binary file not shown.

data/targets_train.parquet

-209 Bytes
Binary file not shown.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
services:
44
mlflow:
5-
image: ghcr.io/mlflow/mlflow:v2.14.3
5+
image: ghcr.io/mlflow/mlflow:v2.19.0
66
ports:
77
- 5000:5000
88
environment:

0 commit comments

Comments
 (0)