Skip to content

Commit

Permalink
♻️Maintenance: remove unmaintained fastapi-contrib package (#4206)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored May 9, 2023
1 parent 10c4f3f commit 8ebb2e3
Show file tree
Hide file tree
Showing 35 changed files with 35 additions and 242 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
ignore=E501
1 change: 0 additions & 1 deletion packages/service-library/requirements/_fastapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@


fastapi
fastapi_contrib[jaegertracing]
httpx
uvicorn
20 changes: 0 additions & 20 deletions packages/service-library/requirements/_fastapi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ certifi==2022.12.7
click==8.1.3
# via uvicorn
fastapi==0.95.1
# via
# -r requirements/_fastapi.in
# fastapi-contrib
fastapi-contrib==0.2.11
# via -r requirements/_fastapi.in
h11==0.14.0
# via
Expand All @@ -32,33 +28,17 @@ idna==3.4
# via
# anyio
# httpx
jaeger-client==4.8.0
# via fastapi-contrib
opentracing==2.4.0
# via
# fastapi-contrib
# jaeger-client
pydantic==1.10.7
# via
# -c requirements/./_base.in
# fastapi
six==1.16.0
# via thrift
sniffio==1.3.0
# via
# anyio
# httpcore
# httpx
starlette==0.26.1
# via fastapi
threadloop==1.0.2
# via jaeger-client
thrift==0.16.0
# via jaeger-client
tornado==6.2
# via
# jaeger-client
# threadloop
typing-extensions==4.5.0
# via pydantic
uvicorn==0.21.1
Expand Down
2 changes: 1 addition & 1 deletion packages/service-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ requests==2.28.2
# via docker
six==1.16.0
# via
# -c requirements/_fastapi.txt
# -c requirements/_aiohttp.txt
# jsonschema
# python-dateutil
sniffio==1.3.0
Expand Down
16 changes: 0 additions & 16 deletions packages/service-library/src/servicelib/fastapi/tracing.py

This file was deleted.

3 changes: 0 additions & 3 deletions services/api-server/.env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ STORAGE_HOST=storage

# director
DIRECTOR_V2_HOST=director-v2


API_SERVER_TRACING=null
18 changes: 0 additions & 18 deletions services/api-server/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ fastapi==0.85.0
# via
# -r requirements/../../../packages/service-library/requirements/_fastapi.in
# -r requirements/_base.in
# fastapi-contrib
fastapi-contrib==0.2.11
# via -r requirements/../../../packages/service-library/requirements/_fastapi.in
frozenlist==1.3.0
# via
# aiohttp
Expand Down Expand Up @@ -112,8 +109,6 @@ idna==3.3
# yarl
itsdangerous==2.1.2
# via fastapi
jaeger-client==4.8.0
# via fastapi-contrib
jinja2==3.1.2
# via
# -c requirements/../../../packages/service-library/requirements/./../../../requirements/constraints.txt
Expand All @@ -134,10 +129,6 @@ multidict==6.0.2
# via
# aiohttp
# yarl
opentracing==2.4.0
# via
# fastapi-contrib
# jaeger-client
orjson==3.7.2
# via
# -r requirements/_base.in
Expand Down Expand Up @@ -194,7 +185,6 @@ six==1.16.0
# jsonschema
# python-dateutil
# python-multipart
# thrift
sniffio==1.2.0
# via
# anyio
Expand All @@ -212,14 +202,6 @@ tenacity==8.0.1
# via
# -r requirements/../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/_base.in
# -r requirements/_base.in
threadloop==1.0.2
# via jaeger-client
thrift==0.16.0
# via jaeger-client
tornado==6.1
# via
# jaeger-client
# threadloop
tqdm==4.64.0
# via
# -c requirements/../../../packages/service-library/requirements/./_base.in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from fastapi.exceptions import RequestValidationError
from httpx import HTTPStatusError
from models_library.basic_types import BootModeEnum
from servicelib.fastapi.tracing import setup_tracing
from servicelib.logging_utils import config_all_loggers
from starlette import status
from starlette.exceptions import HTTPException
Expand Down Expand Up @@ -67,9 +66,6 @@ def init_app(settings: ApplicationSettings | None = None) -> FastAPI:
if settings.API_SERVER_DIRECTOR_V2:
director_v2.setup(app, settings.API_SERVER_DIRECTOR_V2)

if settings.API_SERVER_TRACING:
setup_tracing(app, settings.API_SERVER_TRACING)

# setup app
app.add_event_handler("startup", create_start_app_handler(app))
app.add_event_handler("shutdown", create_stop_app_handler(app))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from settings_library.catalog import CatalogSettings
from settings_library.postgres import PostgresSettings
from settings_library.storage import StorageSettings
from settings_library.tracing import TracingSettings
from settings_library.utils_logging import MixinLoggingSettings
from settings_library.utils_service import (
DEFAULT_AIOHTTP_PORT,
Expand Down Expand Up @@ -80,7 +79,6 @@ def base_url(self) -> str:


class BasicSettings(BaseCustomSettings, MixinLoggingSettings):

# DEVELOPMENT
API_SERVER_DEV_FEATURES_ENABLED: bool = Field(
False, env=["API_SERVER_DEV_FEATURES_ENABLED", "FAKE_API_SERVER_ENABLED"]
Expand Down Expand Up @@ -108,7 +106,6 @@ def _validate_loglevel(cls, value) -> str:


class ApplicationSettings(BasicSettings):

# DOCKER BOOT
SC_BOOT_MODE: BootModeEnum | None

Expand All @@ -123,9 +120,6 @@ class ApplicationSettings(BasicSettings):
auto_default_from_env=True
)

# DIAGNOSTICS
API_SERVER_TRACING: TracingSettings | None = Field(auto_default_from_env=True)

# DEV-TOOLS
API_SERVER_DEV_HTTP_CALLS_LOGS_PATH: Path | None = Field(
default=None,
Expand Down
3 changes: 0 additions & 3 deletions services/api-server/tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def app_environment(
"WEBSERVER_HOST": "webserver",
"WEBSERVER_SESSION_SECRET_KEY": Fernet.generate_key().decode("utf-8"),
"API_SERVER_POSTGRES": "null",
"API_SERVER_TRACING": "null",
"LOG_LEVEL": "debug",
"SC_BOOT_MODE": "production",
},
Expand Down Expand Up @@ -69,7 +68,6 @@ async def client(app: FastAPI) -> AsyncIterator[httpx.AsyncClient]:
base_url="http://api.testserver.io",
headers={"Content-Type": "application/json"},
) as client:

assert isinstance(client._transport, ASGITransport)
# rewires location test's app to client.app
setattr(client, "app", client._transport.app)
Expand All @@ -88,7 +86,6 @@ def auth(mocker, app: FastAPI, faker: Faker) -> HTTPBasicAuth:
"""
# mock engine if db was not init
if app.state.settings.API_SERVER_POSTGRES is None:

engine = mocker.MagicMock()
engine.minsize = 1
engine.size = 10
Expand Down
18 changes: 0 additions & 18 deletions services/autoscaling/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ fastapi==0.90.1
# via
# -r requirements/../../../packages/service-library/requirements/_fastapi.in
# -r requirements/_base.in
# fastapi-contrib
fastapi-contrib==0.2.11
# via -r requirements/../../../packages/service-library/requirements/_fastapi.in
frozenlist==1.3.3
# via
# aiohttp
Expand All @@ -98,8 +95,6 @@ idna==3.4
# email-validator
# httpx
# yarl
jaeger-client==4.8.0
# via fastapi-contrib
jmespath==1.0.1
# via
# boto3
Expand All @@ -112,10 +107,6 @@ multidict==6.0.4
# via
# aiohttp
# yarl
opentracing==2.4.0
# via
# fastapi-contrib
# jaeger-client
packaging==23.0
# via -r requirements/_base.in
pamqp==3.2.1
Expand Down Expand Up @@ -149,7 +140,6 @@ six==1.16.0
# via
# jsonschema
# python-dateutil
# thrift
sniffio==1.3.0
# via
# anyio
Expand All @@ -161,14 +151,6 @@ tenacity==8.2.1
# via
# -c requirements/../../../packages/service-library/requirements/./_base.in
# -r requirements/../../../packages/service-library/requirements/_base.in
threadloop==1.0.2
# via jaeger-client
thrift==0.16.0
# via jaeger-client
tornado==6.2
# via
# jaeger-client
# threadloop
tqdm==4.64.1
# via
# -c requirements/../../../packages/service-library/requirements/./_base.in
Expand Down
4 changes: 1 addition & 3 deletions services/autoscaling/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
# pip-compile --output-file=requirements/_test.txt --resolver=backtracking --strip-extras requirements/_test.in
#
anyio==3.6.2
# via
# -c requirements/_base.txt
# httpcore
# via httpcore
asgi-lifespan==2.1.0
# via -r requirements/_test.in
async-timeout==4.0.2
Expand Down
18 changes: 0 additions & 18 deletions services/catalog/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ fastapi==0.85.0
# via
# -r requirements/../../../packages/service-library/requirements/_fastapi.in
# -r requirements/_base.in
# fastapi-contrib
fastapi-contrib==0.2.11
# via -r requirements/../../../packages/service-library/requirements/_fastapi.in
greenlet==2.0.2
# via sqlalchemy
h11==0.12.0
Expand All @@ -92,8 +89,6 @@ idna==2.10
# yarl
itsdangerous==1.1.0
# via fastapi
jaeger-client==4.8.0
# via fastapi-contrib
jinja2==3.1.2
# via
# -c requirements/../../../packages/service-library/requirements/./../../../requirements/constraints.txt
Expand All @@ -114,10 +109,6 @@ msgpack==1.0.3
# via aiocache
multidict==6.0.2
# via yarl
opentracing==2.4.0
# via
# fastapi-contrib
# jaeger-client
orjson==3.7.2
# via fastapi
packaging==21.3
Expand Down Expand Up @@ -164,7 +155,6 @@ six==1.15.0
# jsonschema
# python-dateutil
# python-multipart
# thrift
sniffio==1.2.0
# via
# anyio
Expand All @@ -181,14 +171,6 @@ tenacity==8.0.1
# via
# -r requirements/../../../packages/service-library/requirements/_base.in
# -r requirements/_base.in
threadloop==1.0.2
# via jaeger-client
thrift==0.16.0
# via jaeger-client
tornado==6.1
# via
# jaeger-client
# threadloop
tqdm==4.64.0
# via
# -c requirements/../../../packages/service-library/requirements/./_base.in
Expand Down
4 changes: 0 additions & 4 deletions services/catalog/src/simcore_service_catalog/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from fastapi import FastAPI
from models_library.basic_types import BootModeEnum
from servicelib.fastapi.tracing import setup_tracing

from ..db.events import close_db_connection, connect_to_db, setup_default_product
from ..services.director import close_director, setup_director
Expand Down Expand Up @@ -35,9 +34,6 @@ async def start_app() -> None:
# SEE https://github.com/ITISFoundation/osparc-simcore/issues/1728
await start_registry_sync_task(app)

if app.state.settings.CATALOG_TRACING:
setup_tracing(app, app.state.settings.CATALOG_TRACING)

return start_app


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from settings_library.base import BaseCustomSettings
from settings_library.http_client_request import ClientRequestSettings
from settings_library.postgres import PostgresSettings
from settings_library.tracing import TracingSettings
from settings_library.utils_logging import MixinLoggingSettings
from simcore_service_catalog.models.schemas.services_specifications import (
ServiceSpecifications,
Expand All @@ -24,7 +23,7 @@ class DirectorSettings(BaseCustomSettings):

@cached_property
def base_url(self) -> str:
return f"http://{self.DIRECTOR_HOST}:{self.DIRECTOR_PORT}/{self.DIRECTOR_VTAG}" # NOSONAR
return f"http://{self.DIRECTOR_HOST}:{self.DIRECTOR_PORT}/{self.DIRECTOR_VTAG}" # NOSONAR


_DEFAULT_RESOURCES: Final[ResourcesDict] = parse_obj_as(
Expand Down Expand Up @@ -74,8 +73,6 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
CATALOG_BACKGROUND_TASK_REST_TIME: PositiveInt = 60
CATALOG_BACKGROUND_TASK_WAIT_AFTER_FAILURE: PositiveInt = 5 # secs

CATALOG_TRACING: TracingSettings | None = None

CATALOG_SERVICES_DEFAULT_RESOURCES: ResourcesDict = _DEFAULT_RESOURCES
CATALOG_SERVICES_DEFAULT_SPECIFICATIONS: ServiceSpecifications = (
_DEFAULT_SERVICE_SPECIFICATIONS
Expand Down
2 changes: 0 additions & 2 deletions services/catalog/tests/unit/test_services_director.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def minimal_app(
) -> Iterator[FastAPI]:
# disable a couple of subsystems
monkeypatch.setenv("CATALOG_POSTGRES", "null")
monkeypatch.setenv("CATALOG_TRACING", "null")
monkeypatch.setenv("SC_BOOT_MODE", "local-development")

app = init_app()
Expand Down Expand Up @@ -60,7 +59,6 @@ async def test_director_client_setup(
minimal_app: FastAPI,
client: TestClient,
):

# gets director client as used in handlers
director_api = get_director_api(minimal_app)

Expand Down
Loading

0 comments on commit 8ebb2e3

Please sign in to comment.