This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
db: | |
volumes: | |
- app-db-data:/var/lib/postgresql/data/pgdata | |
deploy: | |
placement: | |
constraints: | |
- node.labels.${STACK_NAME}.app-db-data == true | |
es01: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Full output on cython branch: | |
----------------------------- | |
pydantic time=6.347s, success=50.60% | |
pydantic time=7.167s, success=50.60% | |
pydantic time=8.733s, success=50.60% | |
pydantic time=6.832s, success=50.60% | |
pydantic time=7.747s, success=50.60% | |
pydantic best=6.347s, avg=7.365s, stdev=0.919s | |
pydantic best=211.579μs/iter avg=245.504μs/iter stdev=30.618μs/iter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pydantic time=1.073s, success=50.60% | |
pydantic time=1.078s, success=50.60% | |
pydantic time=1.071s, success=50.60% | |
pydantic time=1.071s, success=50.60% | |
pydantic time=1.092s, success=50.60% | |
pydantic best=1.071s, avg=1.077s, stdev=0.009s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, Union | |
from pydantic import BaseModel, create_model | |
from starlette.requests import Request | |
from starlette.responses import JSONResponse | |
from fastapi import FastAPI | |
from fastapi.encoders import jsonable_encoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Dict, Generic, Optional, Tuple, Type, TypeVar, Union, get_type_hints, no_type_check | |
from pydantic import BaseModel, create_model, validator | |
from pydantic.class_validators import gather_validators | |
class BaseGenericModel: | |
def __init__(self, *args: Any, **kwargs: Any) -> None: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Dict, Set, Type, TypeVar | |
from pydantic import BaseConfig, BaseModel, ConfigError, DictError, validate_model | |
from pydantic.utils import change_exception | |
Model = TypeVar("Model", bound=BaseModel) | |
class APIModel(BaseModel): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mypy] | |
plugins = pydanticmypy.py | |
follow_imports = silent | |
strict_optional = True | |
warn_redundant_casts = True | |
warn_unused_ignores = True | |
disallow_any_generics = True | |
check_untyped_defs = True | |
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Adapted from https://github.com/pybind/cmake_example | |
""" | |
import os | |
import platform | |
import re | |
import subprocess | |
import sys | |
import sysconfig | |
from distutils.version import LooseVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DEFAULT_GOAL := default | |
app_root = backend/app | |
pkg_src = $(app_root)/app | |
tests_src = $(app_root)/tests | |
local_tests_src = $(app_root)/tests/local | |
isort = isort -rc $(pkg_src) $(tests_src) | |
black = black $(pkg_src) $(tests_src) | |
flake8 = flake8 $(pkg_src) $(tests_src) | |
mypy = mypy $(pkg_src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UserCreateT = TypeVar("UserCreateT", bound=UserCreate) | |
UserCreateRequestT = TypeVar("UserCreateRequestT", bound=UserCreateRequest) | |
UserInDBT = TypeVar("UserInDBT", bound=UserInDB) | |
UserUpdateT = TypeVar("UserUpdateT", bound=UserUpdate) | |
UserApiT = TypeVar("UserApiT", bound=UserBaseInDB) | |
UserOrmT = TypeVar("UserOrmT", bound=BaseUser) | |
logger = logging.getLogger(__name__) |
OlderNewer