Skip to content

Commit c54eb03

Browse files
sync: update from python-copier-template
1 parent 5fe4e32 commit c54eb03

10 files changed

Lines changed: 100 additions & 94 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ repos:
5353
hooks:
5454
- id: local-ty
5555
name: ty check
56-
entry: uv run ty check template tests
56+
entry: uv run ty check python_template tests
5757
require_serial: true
5858
language: unsupported
5959
pass_filenames: false

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ ENV PATH="/app/.venv/bin:$PATH"
3636
WORKDIR /app
3737

3838
# Run the FastAPI application by default
39-
CMD ["uvicorn", "template.api:app", "--host", "0.0.0.0", "--port", "80", "--log-config", "log_conf.yaml"]
39+
CMD ["uvicorn", "python_template.api:app", "--host", "0.0.0.0", "--port", "80", "--log-config", "log_conf.yaml"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ruff:
3333
$(RUN) ruff check --fix --show-fixes .
3434

3535
ty:
36-
$(RUN) ty check template tests
36+
$(RUN) ty check python_template tests
3737

3838
test:
3939
$(RUN) pytest

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<!-- markdownlint-disable MD059 -->
22

3-
# Template
3+
# Python template
44

55
![testing workflow](https://github.com/Komorebi-AI/python-template/actions/workflows/pytest.yml/badge.svg)
66
[![prek](https://img.shields.io/badge/prek-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/j178/prek)
77

8-
Librería Python de ejemplo
8+
Aplicación Python de ejemplo
99

1010
## Structure
1111

1212
The repository is structured into the following directories:
1313

14-
- `/template`: Python source code
14+
- `/python_template`: Python source code
1515
- `/tests`: Python code for testing via pytest
1616
- `/data`: data folder
1717

@@ -47,7 +47,7 @@ Install package and pinned dependencies with the [`uv`](https://docs.astral.sh/u
4747
4. Run any command or Python script with `uv run`, for instance:
4848

4949
```bash
50-
uv run template
50+
uv run python_template/main.py
5151
```
5252

5353
Alternatively, you can also activate the virtual env and run the scripts normally:
@@ -120,6 +120,12 @@ make hooks
120120
make ruff
121121
```
122122

123+
#### Run type checker
124+
125+
```bash
126+
make ty
127+
```
128+
123129
#### Run tests
124130

125131
```bash

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
requires-python = ">=3.14,<3.15"
7-
name = "template"
7+
name = "python_template"
88
# La versión se obtiene automáticamente de git con `setuptools_scm`
99
#version = "0.1.0"
10-
description = "Librería Python de ejemplo"
10+
description = "Aplicación Python de ejemplo"
1111
readme = "README.md"
1212
authors = [{ name = "Komorebi AI", email = "info@komorebi.ai" }]
1313
dynamic = ["version"]
@@ -23,11 +23,11 @@ dependencies = [
2323
homepage = "https://github.com/Komorebi-AI/python-template"
2424

2525
[project.scripts]
26-
template = "template.main:main"
26+
python_template = "python_template.main:main"
2727

2828

2929
[tool.setuptools]
30-
packages = ["template"]
30+
packages = ["python_template"]
3131

3232
[tool.setuptools_scm]
3333
# Importante crear esta sección vacia para activar el plugin

template/api.py renamed to python_template/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from fastapi import FastAPI
77
from pydantic import BaseModel
88

9-
from template.main import __version__
9+
from python_template.main import __version__
1010

1111
logger = logging.getLogger(__name__)
1212

@@ -37,7 +37,7 @@ def read_root() -> dict[str, str]:
3737
logger.error("ERROR")
3838
logger.critical("CRITICAL")
3939

40-
return {"template-api": f"version {__version__}"}
40+
return {"python_template-api": f"version {__version__}"}
4141

4242

4343
@app.post("/predict")
@@ -54,7 +54,7 @@ def predict(request: Request) -> Response:
5454
port = 7000 if len(sys.argv) < 2 else int(sys.argv[1])
5555
host = "127.0.0.1" if len(sys.argv) < 3 else sys.argv[2]
5656
uvicorn.run(
57-
"template.api:app",
57+
"python_template.api:app",
5858
host=host,
5959
port=port,
6060
reload=True,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import typer
88

99
try:
10-
__version__: str | None = version("template")
10+
__version__: str | None = version("python_template")
1111
except PackageNotFoundError:
1212
# package is not installed
1313
__version__ = None
@@ -16,7 +16,7 @@
1616

1717
def print_version() -> None:
1818
"""Print package version."""
19-
print(f"Template version {__version__}")
19+
print(f"Python template version {__version__}")
2020

2121

2222
def main() -> None:

tests/test_trivial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from template.main import print_version
3+
from python_template.main import print_version
44

55

66
def test_print_version():

uv.lock

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

0 commit comments

Comments
 (0)