Skip to content

Commit 11aee10

Browse files
committed
feat: adds jmgilman project
1 parent bd817ff commit 11aee10

File tree

10 files changed

+286
-0
lines changed

10 files changed

+286
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# Rust
22
target/
3+
4+
# Python
5+
dist/
6+
__pycache__/
7+
*.pyc

users/jmgilman/.python-version

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

users/jmgilman/Earthfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
VERSION 0.8
2+
3+
uv:
4+
FROM ghcr.io/astral-sh/uv:0.4.12
5+
6+
SAVE ARTIFACT /uv uv
7+
8+
deps:
9+
FROM python:3.12-slim-bookworm
10+
11+
ENV UV_COMPILE_BYTECODE=0
12+
13+
WORKDIR /work
14+
15+
COPY +uv/uv /usr/local/bin/uv
16+
COPY pyproject.toml uv.lock README.md .
17+
18+
RUN uv sync --frozen --no-install-project
19+
20+
src:
21+
FROM +deps
22+
23+
COPY --dir src README.md .
24+
25+
check:
26+
FROM +src
27+
28+
RUN uv sync --frozen --no-install-project --extra dev
29+
30+
RUN uv run black --check .
31+
RUN uv run ruff check .
32+
33+
build:
34+
FROM +src
35+
36+
RUN uv build --wheel
37+
38+
SAVE ARTIFACT dist dist
39+
40+
test:
41+
FROM +src
42+
43+
COPY --dir tests .
44+
45+
RUN uv sync --frozen --extra dev
46+
RUN uv run pytest .
47+
48+
publish:
49+
FROM python:3.12-slim
50+
51+
ARG container=hello
52+
ARG tag=latest
53+
54+
WORKDIR /app
55+
56+
COPY +build/dist dist
57+
58+
RUN pip install dist/*.whl
59+
60+
ENTRYPOINT ["hello"]
61+
SAVE IMAGE ${container}:${tag}
62+
63+
release:
64+
FROM scratch
65+
66+
COPY +build/dist dist
67+
68+
SAVE ARTIFACT dist/* hello.whl

users/jmgilman/README.md

Whitespace-only changes.

users/jmgilman/blueprint.cue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: "1.0.0"
2+
project: {
3+
name: "hello"
4+
}

users/jmgilman/pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "hello"
3+
version = "0.1.0"
4+
description = "A simple hello world CLI"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"click>=8.1.7",
9+
]
10+
11+
[project.scripts]
12+
hello = "hello.hello:cli"
13+
14+
[build-system]
15+
requires = ["hatchling"]
16+
build-backend = "hatchling.build"
17+
18+
[tool.hatch.build.targets.wheel]
19+
packages = ["src/hello"]
20+
21+
[project.optional-dependencies]
22+
dev = [
23+
"black>=24.8.0",
24+
"pytest>=8.3.3",
25+
"ruff>=0.6.5",
26+
]

users/jmgilman/src/hello/__init__.py

Whitespace-only changes.

users/jmgilman/src/hello/hello.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import click
2+
3+
4+
def hello(name: str = "World") -> str:
5+
return f"Hello, {name}!"
6+
7+
8+
@click.command()
9+
@click.argument("name", required=False, default="World")
10+
def cli(name):
11+
click.echo(hello(name))
12+
13+
14+
if __name__ == "__main__":
15+
cli()

users/jmgilman/tests/hello_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from hello.hello import hello
2+
3+
4+
def test_hello():
5+
assert hello("Alice") == "Hello, Alice!"
6+
assert hello() == "Hello, World!"
7+

users/jmgilman/uv.lock

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