Skip to content

Commit 33f840e

Browse files
authored
Merge pull request #133 from at-gmbh/feature/add-uv
Add uv as package manager to master
2 parents e08a59e + 00c187b commit 33f840e

File tree

10 files changed

+571
-171
lines changed

10 files changed

+571
-171
lines changed

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Placeholder for future updates and new features.
1212

1313

14-
## [1.1.2] - 2025-03-14
14+
## [1.2.0] - 2025-04-09
15+
16+
### Added
17+
- Introduced support for a new package manager `uv` in `cookiecutter.json`, `hooks/post_gen_project.py`, and `README.md`.
18+
- Added `Dockerfile__uv` for `uv` package manager support.
1519

1620
### Changed
17-
- Updated project version from `1.1.1` to `1.1.2` in `pyproject.toml`.
21+
- Updated project version from `1.1.1` to `1.2.0` in `pyproject.toml`.
1822
- Updated `ruff` pre-commit hook from `v0.9.10` to `v0.11.0` in `.pre-commit-config.yaml`.
1923
- Updated `ruff` dependency in `environment-dev.yml` from `>=0.9.7` to `>=0.11.0`.
2024
- Updated `pytest` from `^8.3.4` to `^8.3.5` in `pyproject.toml`.
@@ -23,6 +27,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2327
- Updated `pytest` from `~8.3` to `~8.3.5` in `requirements-dev.txt`.
2428
- Updated `wheel` from `~0.37` to `~0.45.1` in `requirements-dev.txt`.
2529

30+
### Documentation
31+
- Added detailed instructions for using `uv` package manager in `README.md`, including installation, dependency management, running scripts, and testing.
32+
- Updated the README with new commands for `uv`, `poetry`, and `pip` package managers for running tests, building distribution packages, and setting up pre-commit hooks.
33+
34+
### Fixed
35+
- Corrected minor formatting issues in the `pyproject.toml` and `README.md`.
36+
37+
### Other
38+
- Updated `.dockerignore` to include additional directories and files.
39+
- Updated `docker-compose.yml` to support `uv` package manager.
40+
- Updated `requirements-dev.txt` for `black`, `pytest`, and `wheel` versions.
41+
2642
## [1.1.1] - 2025-03-13
2743

2844
### Changed

cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"project_slug": "{{ cookiecutter.project_name | slugify }}",
77
"module_name": "{{ cookiecutter.project_slug | slugify | replace('-', '_') }}",
88
"project_short_description": "A short summary of the project",
9-
"package_manager": ["conda", "pip", "poetry"],
9+
"package_manager": ["conda", "pip", "poetry","uv"],
1010
"use_notebooks": ["no", "yes"],
1111
"use_docker": ["no", "yes"],
1212
"ci_pipeline": ["none", "gitlab"],

hooks/post_gen_project.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
module_dir = 'src/{{ cookiecutter.module_name }}'
1515

16-
16+
files_uv = {
17+
'pyproject.toml',
18+
}
1719
files_pip = {
1820
'requirements.txt',
1921
'requirements-dev.txt',
@@ -33,7 +35,7 @@
3335
'poetry.toml',
3436
}
3537

36-
files_package_manager_all = files_pip | files_conda | files_poetry
38+
files_package_manager_all = files_pip | files_conda | files_poetry | files_uv
3739

3840
files_docker_aux = {
3941
'docker-compose.yml',
@@ -51,8 +53,11 @@
5153
files_dockerfile_poetry = {
5254
'Dockerfile__poetry',
5355
}
56+
files_dockerfile_uv = {
57+
'Dockerfile__uv',
58+
}
5459

55-
files_dockerfile_all = files_dockerfile_pip | files_dockerfile_conda | files_dockerfile_poetry
60+
files_dockerfile_all = files_dockerfile_pip | files_dockerfile_conda | files_dockerfile_poetry | files_dockerfile_uv
5661

5762
files_cli = [
5863
f'{module_dir}/__main__.py',
@@ -91,6 +96,8 @@ def handle_package_manager():
9196
_delete_files(files_package_manager_all - files_pip)
9297
elif package_manager == 'poetry':
9398
_delete_files(files_package_manager_all - files_poetry)
99+
elif package_manager == 'uv':
100+
_delete_files(files_package_manager_all - files_uv)
94101
else:
95102
print(f"Error: unsupported package manager {package_manager}")
96103
sys.exit(1)
@@ -117,6 +124,9 @@ def handle_docker():
117124
elif package_manager == "poetry":
118125
_delete_files(files_dockerfile_all - files_dockerfile_poetry)
119126
_rename_files("Dockerfile__poetry", "__poetry", "")
127+
elif package_manager == "uv":
128+
_delete_files(files_dockerfile_all - files_dockerfile_uv)
129+
_rename_files("Dockerfile__uv", "__uv", "")
120130

121131

122132
def handle_cli():

poetry.lock

Lines changed: 159 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "at-python-template"
3-
version = "1.1.2"
3+
version = "1.2.0"
44
description = "This is the official Python Project Template of Alexander Thamm GmbH (AT)"
55
authors = [
66
"Christian Baur <[email protected]>",
Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
1+
# IDE / Editor config
12
.git
2-
.idea
3-
.vscode
4-
build
5-
dist
6-
*.egg-info
7-
venv*
8-
.venv
9-
.cache
3+
.idea/
4+
.vscode/
5+
6+
# Python build artifacts
7+
build/
8+
dist/
9+
*.egg-info/
10+
.eggs/
11+
pip-wheel-metadata/
12+
13+
# Virtual environments
14+
.venv/
15+
venv*/
16+
env*/
17+
18+
# Python cache
19+
__pycache__/
20+
*.py[cod]
21+
*.so
1022
.pytest_cache/
11-
**/__pycache__
23+
.cache/
24+
htmlcov/
25+
26+
# Docker-specific
1227
Dockerfile
13-
htmlcov
28+
docker-compose.yml
29+
30+
# Jupyter
31+
.ipynb_checkpoints/
32+
33+
# Logs and misc
34+
*.log
35+
*.tmp
36+
*.bak
37+
*.swp
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ghcr.io/astral-sh/uv:python3.11-bookworm AS builder
2+
3+
LABEL maintainer="{{ cookiecutter.company_name if cookiecutter.company_name else cookiecutter.full_name }}"
4+
5+
WORKDIR /app
6+
7+
COPY pyproject.toml uv.lock* ./
8+
9+
RUN uv sync --frozen --no-install-project && uv cache clean
10+
11+
COPY ./src /app/src
12+
13+
RUN uv sync --frozen && uv cache clean
14+
15+
FROM python:3.11-slim-bookworm
16+
17+
WORKDIR /app
18+
19+
COPY --from=builder /app/.venv /app/.venv
20+
COPY --from=builder /app/src /app/src
21+
22+
COPY ./config /app/config
23+
24+
# Environment variables
25+
ENV PATH="/app/.venv/bin:$PATH" \
26+
PYTHONUNBUFFERED=1 \
27+
PYTHONDONTWRITEBYTECODE=1
28+
29+
# Run the application
30+
ENTRYPOINT ["python", "-OO", "-m", "{{ cookiecutter.module_name }}"]

0 commit comments

Comments
 (0)