generated from owl-corp/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de3448a
commit 525887d
Showing
14 changed files
with
1,575 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
** | ||
|
||
# Except what we need | ||
!app | ||
!thallium | ||
!requirements.txt | ||
!LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
.PHONEY: setup sync lock lint precommit | ||
.PHONY: all install relock lock lockci lint lintdeps precommit test retest | ||
|
||
setup: sync precommit lint | ||
all: install precommit lint | ||
|
||
sync: | ||
install: | ||
poetry install --sync | ||
|
||
lock: | ||
relock: | ||
poetry lock | ||
@poetry export --only main --output requirements.txt | ||
poetry install --sync --no-root | ||
pre-commit run --files pyproject.toml poetry.lock requirements.txt | ||
|
||
lintdeps: | ||
@pre-commit run --files pyproject.toml poetry.lock requirements.txt | ||
|
||
lockci: relock lintdeps | ||
|
||
lock: relock install lintdeps | ||
|
||
lint: | ||
poetry run pre-commit run --all-files | ||
|
||
precommit: | ||
poetry run pre-commit install | ||
|
||
test: | ||
pytest -n 4 --ff | ||
|
||
retest: | ||
pytest -n 4 --lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
services: | ||
app: | ||
thallium: | ||
build: . | ||
restart: unless-stopped | ||
command: ["thallium.app:app", "--host", "0.0.0.0", "--port", "80", "--reload"] | ||
volumes: | ||
- ./app:/app/app:ro | ||
- ./thallium:/thallium/thallium:ro | ||
env_file: | ||
- .env | ||
ports: | ||
- "127.0.0.1:8000:80" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,12 @@ version = "1.2.0" | |
description = "Distribute printful prizes to winners." | ||
authors = ["Chris Lovering <[email protected]>"] | ||
license = "MIT" | ||
package-mode = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "3.12.*" | ||
|
||
litestar = { version = "^2.10.0", extras = ["standard"] } | ||
pydantic = "^2.8.2" | ||
pydantic-settings = "^2.4.0" | ||
|
||
|
@@ -18,6 +20,11 @@ ruff = "^0.5.5" | |
[tool.poetry.group.dev.dependencies] | ||
poetry-plugin-export = "*" | ||
|
||
[tool.poetry.group.test.dependencies] | ||
pytest ="^8.3.2" | ||
pytest-asyncio = "^0.23.8" | ||
pytest-xdist = "^3.6.1" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.5.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
@@ -43,7 +50,14 @@ ignore = [ | |
] | ||
|
||
[tool.ruff.lint.isort] | ||
known-first-party = ["app"] | ||
known-first-party = ["tests", "thallium"] | ||
order-by-type = false | ||
case-sensitive = true | ||
combine-as-imports = true | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"tests/**" = ["D103", "S101"] | ||
|
||
[tool.pytest.ini_options] | ||
# addopts = "--ignore=examples" | ||
asyncio_mode = "auto" |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from litestar.testing import TestClient | ||
|
||
from thallium.app import app | ||
|
||
|
||
def test_heartbeat() -> None: | ||
with TestClient(app=app) as client: | ||
assert client.get("/heartbeat").json() == {"detail": "I am alive!"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from litestar import Litestar, get | ||
|
||
|
||
@get("/heartbeat", sync_to_thread=False) | ||
def heartbeat() -> dict: | ||
"""Return a simple heartbeat.""" | ||
return {"detail": "I am alive!"} | ||
|
||
|
||
app = Litestar([heartbeat]) |
File renamed without changes.