Compare commits

..

4 commits

Author SHA1 Message Date
bronsen
9260c225e4 codestyle: remove unneeded hint for ty
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
2026-02-16 21:12:15 +01:00
bronsen
63edd11aac codestyle: remove unneeded hints for pyright 2026-02-16 21:11:35 +01:00
bronsen
a5ef6f2017 config: retrieve DATABASE_URL from environment vars 2026-02-16 21:11:08 +01:00
bronsen
60079d64d2 just: explain all recipes 2026-02-15 17:39:44 +01:00
6 changed files with 25 additions and 7 deletions

View file

@ -1,10 +1,17 @@
[private]
default: default:
@just --list @just --list
# create venv, install dependencies
setup: setup:
uv sync uv sync
# install the other tools: prek, mise
# run Textual's console # builds a package (tgz and whl)
build:
uv build
# console to observe log messages
console: console:
uv run textual console uv run textual console
@ -14,42 +21,50 @@ the_app := "teilchensammler_cli.main"
run-dev: run-dev:
uv run textual run --dev {{ the_app }} uv run textual run --dev {{ the_app }}
# run the app
run: run:
uv run python -m {{ the_app }} uv run python -m {{ the_app }}
uv_export_options := "--frozen --format requirements.txt --quiet --no-install-project" uv_export_options := "--frozen --format requirements.txt --quiet --no-install-project"
# export dependencies into requirements files
exports-deps: exports-deps:
uv export {{ uv_export_options }} --output-file requirements.txt uv export {{ uv_export_options }} --output-file requirements.txt
uv export {{ uv_export_options }} --output-file requirements.dev.txt --only-dev uv export {{ uv_export_options }} --output-file requirements.dev.txt --only-dev
install-deps: setup # Update dependencies to new versions
update-deps: update-deps:
uv lock --upgrade uv lock --upgrade
uv sync uv sync
# Run tests, args are passed-through to pytest
test *ARGS: test *ARGS:
uv run pytest tests.py {{ ARGS }} uv run pytest tests.py {{ ARGS }}
# run tests and create coverage reports
coverage: coverage:
uv run pytest tests.py --cov=src/ --cov-report term --cov-report xml --cov-report html --cov-config pyproject.toml uv run pytest tests.py --cov=src/ --cov-report term --cov-report xml --cov-report html --cov-config pyproject.toml
# lint python code
lint-python: lint-python:
uv run ruff check . uv run ruff check .
# lint markdown documents
lint-markdown: lint-markdown:
markdownlint-cli2 . markdownlint-cli2 .
# run python and markdown
lint: lint-python lint-markdown lint: lint-python lint-markdown
# remove artefacts from dist/ # remove artefacts from dist/
clean: clean:
rm dist/*.whl dist/*.tar.gz rm dist/*.whl dist/*.tar.gz
# pretend we are CI
ci: lint ci: lint
prek run --all-files prek run --all-files
# woodpecker-cli exec "whatever" # woodpecker-cli exec "whatever"
# create a new realese [CURRENTLY USELESS]
release: release:
@echo remember to git tag and update pyproject.toml @echo remember to git tag and update pyproject.toml
uv build uv build

View file

@ -1,5 +1,6 @@
[env] [env]
'_'.python.venv = { path = ".venv", create = true } '_'.python.venv = { path = ".venv", create = true }
DATABASE_URL = "sqlite:///database.db"
[tools] [tools]
markdownlint-cli2 = "latest" markdownlint-cli2 = "latest"

View file

@ -1,6 +1,8 @@
import os
from sqlmodel import SQLModel, create_engine from sqlmodel import SQLModel, create_engine
sqlite_url = "sqlite:///database.db" # TODO: get url from environment
sqlite_url = os.environ.get("DATABASE_URL", "sqlite:///database.db")
engine = create_engine(sqlite_url, echo=True) engine = create_engine(sqlite_url, echo=True)

View file

@ -77,6 +77,6 @@ async def load_initial_data() -> Sequence[Teilchen]:
with Session(engine) as session: with Session(engine) as session:
statement = select( statement = select(
Teilchen.id, Teilchen.name, Teilchen.description, Teilchen.number, Teilchen.tags Teilchen.id, Teilchen.name, Teilchen.description, Teilchen.number, Teilchen.tags
) ) # ty:ignore[no-matching-overload]
all_teilchen = session.exec(statement).all() all_teilchen = session.exec(statement).all()
return all_teilchen return all_teilchen

View file

@ -48,7 +48,7 @@ class SearchResults(Widget):
async def on_mount(self) -> None: async def on_mount(self) -> None:
table: DataTable[None] = self.query_one(DataTable[None]) table: DataTable[None] = self.query_one(DataTable[None])
_ = table.add_columns(*FAKE_DATA_HEADER) _ = table.add_columns(*FAKE_DATA_HEADER)
_ = table.add_rows(await load_initial_data()) # ty:ignore[invalid-argument-type] _ = table.add_rows(await load_initial_data())
class AddInventoryScreen(Screen[None]): class AddInventoryScreen(Screen[None]):

View file

@ -1,4 +1,4 @@
def test_initial_layout(snap_compare): # pyright: ignore[reportMissingParameterType, reportUnknownParameterType] def test_initial_layout(snap_compare):
from teilchensammler_cli.main import app from teilchensammler_cli.main import app
assert snap_compare(app, terminal_size=(130, 40)) assert snap_compare(app, terminal_size=(130, 40))