Skip to content

Commit 73f3a2d

Browse files
committed
chore(common): add support for standard uv template
1 parent a56d9f9 commit 73f3a2d

7 files changed

Lines changed: 450 additions & 2 deletions

File tree

bin/release

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212
# If the app provides its own Procfile, let Cloud Foundry use that.
1313
if [ -f "Procfile" ]; then
1414
exit 0
15-
# Otherwise, prefer a `start` entry under `[project.scripts]` in pyproject.toml.
15+
# Otherwise, prefer a script named after `project.name`, then fall back to `start`.
1616
elif [ -n "$PYTHON_BIN" ] && [ -f "pyproject.toml" ]; then
1717
START_TARGET=$("$PYTHON_BIN" -c '
1818
import sys
@@ -24,7 +24,11 @@ except ModuleNotFoundError:
2424
with open("pyproject.toml", "rb") as f:
2525
data = tomllib.load(f)
2626
27-
print(data.get("project", {}).get("scripts", {}).get("start", ""))
27+
project = data.get("project", {})
28+
project_name = project.get("name", "")
29+
scripts = project.get("scripts", {})
30+
31+
print(scripts.get(project_name) or scripts.get("start", ""))
2832
')
2933

3034
if [ -n "$START_TARGET" ]; then

test/my-app-3/.python-version

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

test/my-app-3/README.md

Whitespace-only changes.

test/my-app-3/pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[project]
2+
name = "my-app-3"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"fastapi>=0.135.3",
9+
"uvicorn[standard]>=0.44.0",
10+
]
11+
12+
[project.scripts]
13+
my-app-3 = "my_app_3:main"
14+
15+
[build-system]
16+
requires = ["uv_build>=0.11.5,<0.12.0"]
17+
build-backend = "uv_build"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import uvicorn
2+
3+
def main() -> None:
4+
uvicorn.run("my_app_3.main:app", host="0.0.0.0", port=8000, reload=True)

test/my-app-3/src/my_app_3/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from fastapi import FastAPI
2+
3+
app = FastAPI()
4+
5+
6+
@app.get("/")
7+
def hello_world():
8+
return {"message": "Hello, World!"}

test/my-app-3/uv.lock

Lines changed: 414 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)