diff --git a/justfile b/justfile index 5e9a45e..c7b587a 100644 --- a/justfile +++ b/justfile @@ -1,17 +1,10 @@ -[private] default: @just --list -# create venv, install dependencies setup: uv sync - # install the other tools: prek, mise -# builds a package (tgz and whl) -build: - uv build - -# console to observe log messages +# run Textual's console console: uv run textual console @@ -21,50 +14,42 @@ the_app := "teilchensammler_cli.main" run-dev: uv run textual run --dev {{ the_app }} -# run the app run: uv run python -m {{ the_app }} uv_export_options := "--frozen --format requirements.txt --quiet --no-install-project" -# export dependencies into requirements files exports-deps: uv export {{ uv_export_options }} --output-file requirements.txt uv export {{ uv_export_options }} --output-file requirements.dev.txt --only-dev -# Update dependencies to new versions +install-deps: setup + update-deps: uv lock --upgrade uv sync -# Run tests, args are passed-through to pytest test *ARGS: uv run pytest tests.py {{ ARGS }} -# run tests and create coverage reports coverage: 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: uv run ruff check . -# lint markdown documents lint-markdown: markdownlint-cli2 . -# run python and markdown lint: lint-python lint-markdown # remove artefacts from dist/ clean: rm dist/*.whl dist/*.tar.gz -# pretend we are CI ci: lint prek run --all-files # woodpecker-cli exec "whatever" -# create a new realese [CURRENTLY USELESS] release: @echo remember to git tag and update pyproject.toml uv build diff --git a/mise.toml b/mise.toml index ffbd3a8..7592ec1 100644 --- a/mise.toml +++ b/mise.toml @@ -1,6 +1,5 @@ [env] '_'.python.venv = { path = ".venv", create = true } -DATABASE_URL = "sqlite:///database.db" [tools] markdownlint-cli2 = "latest" diff --git a/src/teilchensammler_cli/database.py b/src/teilchensammler_cli/database.py index e226215..d919349 100644 --- a/src/teilchensammler_cli/database.py +++ b/src/teilchensammler_cli/database.py @@ -1,8 +1,6 @@ -import os from sqlmodel import SQLModel, create_engine - -sqlite_url = os.environ.get("DATABASE_URL", "sqlite:///database.db") +sqlite_url = "sqlite:///database.db" # TODO: get url from environment engine = create_engine(sqlite_url, echo=True) diff --git a/src/teilchensammler_cli/models.py b/src/teilchensammler_cli/models.py index 86233f4..7a49d5c 100644 --- a/src/teilchensammler_cli/models.py +++ b/src/teilchensammler_cli/models.py @@ -77,6 +77,6 @@ async def load_initial_data() -> Sequence[Teilchen]: with Session(engine) as session: statement = select( Teilchen.id, Teilchen.name, Teilchen.description, Teilchen.number, Teilchen.tags - ) # ty:ignore[no-matching-overload] + ) all_teilchen = session.exec(statement).all() return all_teilchen diff --git a/src/teilchensammler_cli/tui.py b/src/teilchensammler_cli/tui.py index 37c44f9..288bc8a 100644 --- a/src/teilchensammler_cli/tui.py +++ b/src/teilchensammler_cli/tui.py @@ -48,7 +48,7 @@ class SearchResults(Widget): async def on_mount(self) -> None: table: DataTable[None] = self.query_one(DataTable[None]) _ = table.add_columns(*FAKE_DATA_HEADER) - _ = table.add_rows(await load_initial_data()) + _ = table.add_rows(await load_initial_data()) # ty:ignore[invalid-argument-type] class AddInventoryScreen(Screen[None]): diff --git a/tests.py b/tests.py index 521a238..61eaf45 100644 --- a/tests.py +++ b/tests.py @@ -1,4 +1,4 @@ -def test_initial_layout(snap_compare): +def test_initial_layout(snap_compare): # pyright: ignore[reportMissingParameterType, reportUnknownParameterType] from teilchensammler_cli.main import app assert snap_compare(app, terminal_size=(130, 40))