Skip to content

Commit ef286fc

Browse files
Merge pull request #1 from lambda-science/master
Initial Commit
2 parents 65066d0 + 7700856 commit ef286fc

File tree

11 files changed

+826
-0
lines changed

11 files changed

+826
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,15 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175+
176+
# Boiletplate
177+
venv/
178+
env/
179+
.env/
180+
.venv/
181+
.ruff_cache/
182+
**/.pytest_cache/
183+
**/__pycache__/
184+
dist/
185+
.coverage
186+

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
- id: check-added-large-files
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.11.10
10+
hooks:
11+
- id: ruff-check
12+
args: [ --fix, --config=pyproject.toml ]
13+
- id: ruff-format
14+
args: [ --config=pyproject.toml ]

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.13-slim-bullseye
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
3+
4+
ENV UV_COMPILE_BYTECODE=1
5+
ENV UV_NO_CACHE=1
6+
7+
RUN apt update && \
8+
apt install -y --no-install-recommends \
9+
build-essential \
10+
cmake \
11+
curl \
12+
gcc \
13+
git \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
WORKDIR /app
17+
COPY README.md /app/
18+
COPY pyproject.toml /app/
19+
RUN uv sync --no-install-project --no-dev
20+
COPY src/modern_python_boilerplate /app/modern_python_boilerplate
21+
22+
EXPOSE 8000
23+
24+
CMD ["uv", "run", "modern_python_boilerplate/main.py"]

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
dev:
2+
modern_python_boilerplate
3+
4+
prod:
5+
modern_python_boilerplate
6+
7+
test:
8+
uv run pytest tests/
9+
10+
cov:
11+
uv run pytest --cov=src/modern_python_boilerplate tests/ --cov-report=term-missing
12+
13+
check:
14+
uv run ruff check $$(git diff --name-only --cached -- '*.py')
15+
16+
format:
17+
uv run ruff format $$(git diff --name-only --cached -- '*.py')
18+
19+
type:
20+
uv run ty check $$(git diff --name-only --cached -- '*.py')
21+
22+
doc:
23+
uvx --with mkdocstrings --with mkdocs-material --with mkdocstrings-python --with mkdocs-include-markdown-plugin mkdocs serve
24+
25+
build:
26+
uv build
27+
28+
publish:
29+
uv publish
30+
31+
commit:
32+
pre-commit
33+
34+
dockerbuild:
35+
docker build -t modern-python-boilerplate:latest .
36+
37+
dockerrun:
38+
docker run --rm modern-python-boilerplate:latest
39+
40+
allci:
41+
$(MAKE) check
42+
$(MAKE) format
43+
$(MAKE) type
44+
$(MAKE) cov

README.md

Whitespace-only changes.

pyproject.toml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[project]
2+
name = "modern-python-boilerplate"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
authors = [
8+
{ name = "Corentin Meyer", email = "[email protected]" },
9+
]
10+
maintainers = [
11+
{ name = "Corentin Meyer", email = "[email protected]" }
12+
]
13+
dependencies = []
14+
15+
[project.urls]
16+
Homepage = ""
17+
Documentation = ""
18+
Repository = ""
19+
Issues = ""
20+
21+
[dependency-groups]
22+
dev = [
23+
"ruff",
24+
"pytest",
25+
"pytest-cov",
26+
"ty",
27+
"twine",
28+
"build",
29+
"pre-commit",
30+
"rich",
31+
]
32+
33+
[tool.hatch.metadata]
34+
allow-direct-references = true
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["src/modern_python_boilerplate"]
38+
39+
[build-system]
40+
requires = ["hatchling"]
41+
build-backend = "hatchling.build"
42+
43+
[project.scripts]
44+
modern_python_boilerplate = "modern_python_boilerplate.main:hello_world"
45+
46+
[tool.ruff]
47+
target-version = "py313"
48+
include = ["src/**/*.py"]
49+
exclude = [
50+
"scripts"
51+
]
52+
53+
[tool.ruff.lint]
54+
select = ["E4", "E7", "E9", "F", "T201"]
55+
56+
[tool.coverage.run]
57+
omit = ["tests/*"]

src/modern_python_boilerplate/__init__.py

Whitespace-only changes.

src/modern_python_boilerplate/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def hello_world():
2+
return "Hello from modern-python-boilerplate!"
3+
4+
5+
if __name__ == "__main__":
6+
hello_world()

tests/test_main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from modern_python_boilerplate.main import hello_world
2+
3+
4+
def test_hello_world():
5+
"""Test that hello_world prints the expected message."""
6+
output = hello_world()
7+
assert output == "Hello from modern-python-boilerplate!"

uv.lock

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

0 commit comments

Comments
 (0)