Skip to content

Commit

Permalink
Update fastapi, fastapimsal, mypy, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain-S committed Apr 25, 2024
1 parent c983ec6 commit b29b517
Show file tree
Hide file tree
Showing 37 changed files with 88 additions and 61 deletions.
1 change: 1 addition & 0 deletions alembic/versions/b65796c99771_squash.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-07-06 22:17:36.160486
"""

import sqlalchemy as sa
from sqlalchemy import text
from sqlalchemy.dialects import postgresql
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration file for the Sphinx documentation builder."""

import os
from importlib import metadata
from unittest.mock import patch
Expand Down
107 changes: 51 additions & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ alembic = "^1.7.1"
asyncpg = "^0.27.0"
azure-identity = "^1.16.0"
databases = { version = "^0.6.2", extras = ["postgresql"] }
#fastapi = "^0.110.1"
fastapi = "^0.95.0"
fastapimsal = { git = "https://github.com/alan-turing-institute/fastapimsal", tag = "0.4.8" }
fastapi = "^0.110.1"
fastapimsal = { git = "https://github.com/alan-turing-institute/fastapimsal", tag = "0.4.9" }
Jinja2 = "^3.1.3"
opencensus-ext-azure = "^1.1.7"
pandas = "^1.1.3"
Expand Down Expand Up @@ -42,7 +41,6 @@ httpie = "3.2.1" # upgrade once the 3.2.2 safety issue is resolved
httpie-jwt-auth = "^0.4.0"
ipykernel = "^6.19.4"
isort = "^5.6.4"
mypy = "^0.991"
pre-commit = "^2.14.1"
pylint = "^2.10.2"
pylint-absolute-imports = "^1.0.1"
Expand All @@ -56,6 +54,7 @@ safety = "^3.1.0"
sqlalchemy-stubs = "^0.3"
pydocstyle = "^6.3.0"
hypothesis = "^6.82.6"
mypy = "^1.9.0"

[tool.poetry.extras]
docs = ["sphinx-rtd-theme", "sphinxcontrib-napoleon", "myst-parser"]
Expand Down
1 change: 1 addition & 0 deletions rctab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The RCTab FastAPI web app."""

from rctab.main import app

__all__ = ["app"]
1 change: 1 addition & 0 deletions rctab/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants that don't change often enough to go in Settings."""

from importlib import metadata

ADMIN_OID = "8b8fb95c-e391-43dd-a6f9-1b03574f7c39"
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The SQLAlchemy models, Pydantic models and database logic."""

from rctab.crud import accounting_models, models, schema

__all__ = [
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/accounting_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SQLAlchemy models for the accounting schema."""

from databases import Database
from sqlalchemy import (
Boolean,
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""User authentication with Active Directory."""

from typing import Dict, Optional

import fastapimsal
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SQLAlchemy models for the default schema."""

from typing import List, Mapping, Sequence, Tuple

import asyncpg
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pydantic models for the RCTab API."""

import datetime
from enum import Enum
from typing import Dict, List, Optional, Tuple
Expand Down
1 change: 1 addition & 0 deletions rctab/crud/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Database utilities and helper functions."""

from typing import List
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions rctab/debug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Used as an entrypoint when debugging from an IDE."""

import uvicorn

from rctab.main import app
Expand Down
1 change: 1 addition & 0 deletions rctab/logutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for logging to a central log workspace."""

import logging
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions rctab/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The entrypoint of the FastAPI application."""

import logging
from pathlib import Path
from typing import Any, Callable, Dict, Final
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The accounting routes."""

from rctab.routers.accounting import (
allocations,
approvals,
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/abolishment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mark subscriptions as "abolished" if they have been inactive for >90 days."""

import logging
from datetime import datetime, timedelta
from typing import List, Optional
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/allocations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Allocate some approved budget to a subscription."""

from typing import Any, List

from fastapi import Depends, HTTPException
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/approvals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Set and fetch approvals for subscriptions."""

import datetime
from datetime import timedelta
from typing import Any, List, Optional
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/cost_recovery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Charge subscriptions' spending to a cost centre."""

from datetime import date, timedelta
from typing import Any, Dict, List, Optional
from uuid import UUID
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/desired_states.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Calculate and disseminate the desired states of subscriptions."""

import datetime
import logging
from typing import Dict, List, Optional
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/finances.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Deciding who to charge for a subscription's spending."""

import calendar
import datetime
from typing import Any, List
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/persistence.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Routes that determine whether a subscription is permanently on."""

from typing import Any
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Miscellaneous queries for the accounting schema."""

import datetime
import uuid
from typing import List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/send_emails.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for sending email notifications to users."""

import logging
from contextlib import AbstractAsyncContextManager
from datetime import date, datetime, timedelta, timezone
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/status.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Receive data from the status function app."""

from typing import Dict
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/subscription.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create and fetch subscriptions."""

from typing import Any, List, Optional
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/summary_emails.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Background tasks that run daily."""

import logging
from datetime import datetime
from typing import List, Optional
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/accounting/usage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Set and get usage data."""

import calendar
import datetime
import logging
Expand Down
1 change: 1 addition & 0 deletions rctab/routers/frontend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The user-facing web pages."""

import datetime
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions rctab/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Global app configuration."""

from functools import lru_cache
from typing import Any, List, Optional
from uuid import UUID
Expand Down
1 change: 1 addition & 0 deletions rctab/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
for the task to run on schedule:
`celery -A rctab.tasks beat --loglevel=info`
"""

import asyncio
import logging
from typing import Any, Final
Expand Down
1 change: 1 addition & 0 deletions rctab/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for the RCTab API."""

import functools
import logging
from contextlib import contextmanager
Expand Down
Loading

0 comments on commit b29b517

Please sign in to comment.