Skip to content
Snippets Groups Projects
Commit ab4df25a authored by Neda Moeini's avatar Neda Moeini
Browse files

Refactor code structure and add tox configuration for linting and type checking

parent 3a1e0c7f
No related branches found
No related tags found
No related merge requests found
"""Initializes the FastAPI application."""
from xml.sax.handler import version
from fastapi import FastAPI
from mapping_provider.api.common import router as version_router
def create_app():
def create_app() -> FastAPI:
"""Create a FastAPI application."""
app = FastAPI(
title="Mapping provider",
......
from importlib.metadata import version, PackageNotFoundError
from importlib.metadata import PackageNotFoundError, version
from fastapi import APIRouter
......@@ -6,7 +6,7 @@ router = APIRouter()
@router.get("/version")
def get_version():
def get_version() -> dict[str, str]:
"""Get the version of the package."""
try:
return {"version": version("mapping_provider")}
......
[tool.ruff]
line-length = 120
target-version = "py313"
select = ["E", "F", "I", "B", "UP", "N"]
fixable = ["ALL"]
exclude = ["tests", "docs", "build"]
[tool.mypy]
python_version = "3.13"
strict = true
warn_unused_ignores = true
warn_return_any = true
\ No newline at end of file
fastapi
uvicorn[standard]
sphinx
\ No newline at end of file
sphinx
ruff
mypy
tox
\ No newline at end of file
from setuptools import setup, find_packages
from setuptools import find_packages, setup
setup(
name="mapping-provider",
......
tox.ini 0 → 100644
[tox]
envlist = lint, typecheck
[testenv:lint]
description = Lint code with Ruff
deps = ruff
commands = ruff check mapping_provider
[testenv:typecheck]
description = Type-check code with mypy
deps = mypy
commands = mypy mapping_provider
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment