Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
# πŸ“Œ Summary
# Summary

Provide a brief description of the change and the reasoning behind it.

---

# πŸ‘₯ Reviewers
# Reviewers

## βœ… Required Reviewers
## Required Reviewers
- @username1
- @username2

## 🧩 Optional Reviewers
## Optional Reviewers
- @username3
- @username4

(Feel free to add/remove as needed.)

---

# πŸ” Related Issue(s)

- Closes #
- Related to #

---

# πŸ› οΈ What Changed?
# What Changed?

Describe the main changes in this PR:
-
Expand All @@ -34,7 +27,7 @@ Describe the main changes in this PR:

---

# πŸ§ͺ Testing
# Testing

Describe how you verified functionality:

Expand All @@ -49,13 +42,10 @@ Describe how you verified functionality:

---

# 🐍 Python Code Quality Checklist
# Code Quality Checklist

Before requesting review, ensure:

- [ ] I ran **`make format`**
- [ ] I ran **`make lint`**
- [ ] I ran **`make typecheck`**
- [ ] I ran **`make test`**
- [ ] All CI checks pass
- [ ] Code follows project style & conventions
Expand All @@ -64,20 +54,14 @@ Before requesting review, ensure:

---

# πŸ“š Documentation
# Documentation

- [ ] Code comments updated
- [ ] README updated (if needed)
- [ ] User-facing docs updated (if needed)

---

# πŸ“ˆ Screenshots / Logs (optional)

Attach outputs, plots, logs, or GIFs here.

---

# πŸ™ Additional Notes
# Additional Notes

Anything else reviewers should know?
- Anything else reviewers should know?
- Attach outputs, plots, logs, or GIFs here.
52 changes: 25 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,34 @@ ci:
skip: [pytest]

default_language_version:
python: python3.13
python: python3.12

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/PyCQA/flake8
rev: 7.1.2
hooks:
- id: flake8
args: [--max-line-length=88, --ignore=E203]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: [types-pyyaml]
exclude: ^testing/resources/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: name-tests-test
- id: requirements-txt-fixer

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
args: ["--ignore-missing-imports"]
additional_dependencies: []
exclude: ^testing/resources/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
rev: v0.14.6
hooks:
- id: ruff
types_or: [ python, pyi ]
args: [ --fix]
types_or: [python, pyi]
args: ["--fix"]

- id: ruff-format
types_or: [ python, pyi ]
args: [ --line-length=88]
types_or: [python, pyi]
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Contributing to This Project

First of all, thank you for considering contributing! πŸŽ‰
We welcome issues, bug reports, feature requests, and pull requests.

---
Expand All @@ -13,12 +12,18 @@ We welcome issues, bug reports, feature requests, and pull requests.
* Include steps to reproduce, expected behavior, and screenshots/logs if relevant.

### Making Changes
0. Pull recent changes from main:
```bash
git switch main
git pull
```
1. Create a new branch for your changes:
```bash
git checkout -b my-new-feature
```
2. Make your changes and commit with a clear message:
```bash
git add <files-that-changed>
git commit -m "Add feature: my-new-feature"
```
3. Push to your fork and open a Pull Request (PR).
Expand Down
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# syntax=docker/dockerfile:1.7-labs
FROM python:3.12-slim

# Speed + deterministic behavior
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
# Fast, deterministic behavior
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# Select package + version at build-time
# Select the package and version at build time
ARG PKG=change_me
ARG VER=latest
ENV PKG=${PKG} VER=${VER}

# Install package from PyPI with a cache mount (huge speedup on rebuilds)
# NOTE: --root-user-action needs a value; use =ignore to silence root warnings.
RUN --mount=type=cache,target=/root/.cache/pip \
python -m pip install --upgrade pip && \
# Install UV
RUN --mount=type=cache,target=/root/.cache \
pip install uv

# Install Python dependencies using UV instead of pip
# UV uses its own resolver + is ~10x faster + fully deterministic.
RUN --mount=type=cache,target=/root/.cache/uv \
if [ "$VER" = "latest" ]; then \
pip install --root-user-action=ignore "$PKG"; \
uv pip install --system "$PKG"; \
else \
pip install --root-user-action=ignore "$PKG==$VER"; \
uv pip install --system "$PKG==$VER"; \
fi

# Simple smoke test script
Expand All @@ -30,4 +31,4 @@ RUN printf '%s\n' \
"print('βœ… import ok:', getattr(m, '__version__', 'unknown'), 'on', sys.version)" \
> smoke.py

CMD ["python", "smoke.py"]
CMD ["uv", "run", "python", "smoke.py"]
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ init: # ENV SETUP
@echo "Environment initialized with uv."

test:
uv run pytest --cov=src --cov-report=term-missing --no-cov-on-fail --cov-report=xml --cov-fail-under=10
uv run pytest --cov=src --cov-report=term-missing --no-cov-on-fail --cov-report=xml --cov-fail-under=90
rm .coverage

lint:
Expand All @@ -29,14 +29,16 @@ clean:
rm -rf junit-pytest.xml
rm -rf logs/*
find . -name ".coverage*" -delete
find . -name "coverage.xml" -delete
find . -name "__pycache__" -exec rm -r {} +

update:
uv update --all-groups
uv sync --upgrade --all-groups
uv run pre-commit autoupdate

deep-update:
uv cache clear pypi --all
uv update --all-groups
update-deep:
uv cache clean pypi
make update

docker:
docker build --no-cache -f Dockerfile -t change_me-smoke .
Expand Down
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@ Do ***NOT*** clone this repository. Please use it as a template instead. This re

## Install
To install the library run:

```bash
uv install <your-package-name>
uv pip install change-me==latest
```

OR

```bash
uv install git+https://github.com/TUM-Aries-Lab/<your-package-name>.git@<specific-tag>
uv add git+https://github.com/TUM-Aries-Lab/change-me.git@<specific-tag> # need credentials
```

## Development
0. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
1. Install [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation)
2. ```pyenv install <desired-python-version> # install the required python version```
3. ```pyenv global <desired-python-version> # set the required python version```
4. ```git clone git@github.com:TUM-Aries-Lab/template-python.git```
5. `make init` to create the virtual environment and install dependencies
6. `make format` to format the code and check for errors
7. `make test` to run the test suite
8. `make clean` to delete the temporary files and directories
0. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) from Astral.
1. `git clone git@github.com:TUM-Aries-Lab/change-me.git`
2. `make init` to create the virtual environment and install dependencies
3. `make format` to format the code and check for errors
4. `make test` to run the test suite
5. `make clean` to delete the temporary files and directories


## Publishing
It's super easy to publish your own packages on PyPI. To build and publish this package run:
Expand All @@ -45,7 +40,7 @@ The package can then be found at: https://pypi.org/project/change-me

from loguru import logger

from change_me.config import definitions
from change_me import definitions

def main() -> None:
"""Run a simple demonstration."""
Expand Down
4 changes: 2 additions & 2 deletions src/change_me/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from loguru import logger

from change_me.config.definitions import DEFAULT_LOG_LEVEL, LogLevel
from change_me.definitions import DEFAULT_LOG_LEVEL, LogLevel
from change_me.utils import setup_logger


Expand Down Expand Up @@ -41,4 +41,4 @@ def main(
)
args = parser.parse_args()

main(log_level=args.log_level)
main(log_level=args.log_level, stderr_level=args.stderr_level)
File renamed without changes.
2 changes: 1 addition & 1 deletion src/change_me/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from loguru import logger

from change_me.config.definitions import (
from change_me.definitions import (
DATE_FORMAT,
DEFAULT_LOG_FILENAME,
DEFAULT_LOG_LEVEL,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory

from change_me.config.definitions import LogLevel
from change_me.definitions import LogLevel
from change_me.utils import setup_logger


Expand Down
Loading