diff --git a/README.rst b/README.rst index 2518ab5..7fbff05 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,10 @@ necessary packages: git clone https://github.com/aquatix/digimarks.git cd digimarks mkvirtualenv digimarks # or whatever project you are working on - pip install -r requirements.txt + # If you just want to run it, no need for development dependencies + uv sync --active --no-dev + # Otherwise, install everything + uv sync --active Migrating from version 1 diff --git a/pyproject.toml b/pyproject.toml index d5e8ffd..800d654 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,20 +6,19 @@ build-backend = "setuptools.build_meta" name = "digimarks" version = "1.1.99" authors = [ - {name = "Michiel Scholten", email = "michiel@diginaut.net"}, + { name = "Michiel Scholten", email = "michiel@diginaut.net" }, ] -description='Simple bookmarking service, using a SQLite database to store bookmarks, supporting tags, automatic title fetching and REST API calls.' +description = 'Simple bookmarking service, using a SQLite database to store bookmarks, supporting tags, automatic title fetching and REST API calls.' readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.10" keywords = ["bookmarks", "api"] -license = {text = "Apache"} +license = { text = "Apache" } classifiers = [ "Framework :: FastAPI", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", ] dependencies = [ - "importlib-metadata; python_version<'3.8'", "fastapi[all]", "sqlmodel", "alembic", @@ -30,6 +29,29 @@ dependencies = [ "extract_favicon", "feedgen", ] + +[dependency-groups] +dev = [ + {include-group = "lint"}, + {include-group = "pub"}, + {include-group = "test"} +] +test = [ + "pytest>=7.0.0", + "pytest-cov>=4.0.0", +] +lint = [ + "ruff>=0.1.0", + "mypy>=1.0.0", +] +# Publishing on PyPI +pub = [ + "build", + "twine" +] +server = [ + "gunicorn>=23.0.0", +] # dynamic = ["version"] [project.scripts] diff --git a/src/digimarks/main.py b/src/digimarks/main.py index 65fb0c9..44df75a 100644 --- a/src/digimarks/main.py +++ b/src/digimarks/main.py @@ -1,9 +1,10 @@ """digimarks main module.""" import logging +from collections.abc import Sequence from contextlib import asynccontextmanager from datetime import UTC, datetime -from typing import Annotated, Sequence, Type +from typing import Annotated import httpx from fastapi import Depends, FastAPI, HTTPException, Query, Request @@ -124,7 +125,7 @@ def index(request: Request): @app.get('/api/v1/admin/{system_key}/users/{user_id}', response_model=User) -async def get_user(session: SessionDep, system_key: str, user_id: int) -> Type[User]: +async def get_user(session: SessionDep, system_key: str, user_id: int) -> type[User]: """Show user information.""" logger.info('User %d requested', user_id) if system_key != settings.system_key: