-
Test against PostGRES 16 (instead of 14).
-
Test against Python 3.13 (bumped asyncpg to
0.30.*
and aiohttp to3.10.*
). -
Fixed a bug in (Sync)ApiProvider and Gateway: if a query parameter with value
None
is presented, this now hides the query parameter from the generated url. Before, it resulted inpath?foo=None
.
- Bumped FastAPI to 0.115.* so that pydantic models are directly supported to
declare query parameters. This deprecates the
RequestQuery.depends()
syntax, useAnnotated[RequestQuery, Query()]
instead.
- Fixed context forwarding to celery tasks in case Sentry is used.
- Add filename to generate s3 download url
- Added a
celery.CeleryConfig
with anapply
method that properly sets up celery without making the tasks depending on the config. Also added integration tests that confirm the forwarding of context (tenant and correlation id).
- Reverted urllib3 to 2.0.* because of other constraints.
- Bumped dependencies.
-
Allow to config/set
addressing_style
for S3 object storage. (default='virtual') -
Added
LRUCache
andSyncLRUCache
.
- Removed psycopg2-binary dependency (because psycopg2 compilation is better for production envs).
- Reverted "FastAPI's favicon.ico with
/favicon.ico
" because of login issues in Swagger.
-
Fixed datatype of ctx.path (it was starlette.URL, now it is pydantic_core.Url).
-
Replaced FastAPI's favicon.ico with
/favicon.ico
. -
Deprecate
dramatiq
submodule.
- Use
psycopg2-binary
instead ofpsycopg2
.
- Fixed
ImportError
because of absentasyncpg
when using onlysql-sync
dependency.
-
Added a base class for providers (
Provider
/SyncProvider
) with empty definitions ofconnect
anddisconnect
(co)routines. -
Re-use the
S3Client
inS3Provider
. AwaitingS3Provider.connect()
at startup is now necessary. -
Re-use the
ClientSession
inApiProvider
. AwaitingApiProvider.connect()
at startup is now necessary. -
Added
SyncInternalGateway
. -
Breaking change in
InternalGateway
: it now requires a.mapper
attribute instead of.to_internal
and.to_external
methods. -
Adapted underscore to hyphen in "extra" requirements:
sql_sync -> sql-sync
,api_client -> api-client
. See PEP685.
- Added synchronous S3 interface (installable through optional
s3_sync
dependency).
-
Added YAML version of the openapi spec under my.domain/v1/openapi.yaml.
-
Fixed an issue introduced in 0.12.4 with the securitySchemas in the openapi spec. Now there is always 1 securitySchema named "OAuth2.
-
Replace the
auth
setting in thefastapi.Service
with a different type, which encompasses the (original) token verifier settings, oauth2 settings, and a new scope_verifier callable. -
Scopes supplied per-endpoint are now documented in the OpenAPI schema.
- Allow self-signed certificates in CeleryRmqBroker.
-
Fixed synchronous usage of DomainEvent.
-
Breaking change: the allowed values in
RequestQuery.order_by
should now be specified using a literal type (for exampleLiteral["id", "-id"]
) instead of theenum
keyword argument. When using theenum
keyword argument, an exception will be raised. Upside of this is that the OpenAPI spec now correctly lists the options fororder_by
. -
Exceptions raised in validators of
RequestQuery
subclasses now result in aBadRequest
instead of an internal server error. This requires change: instances ofDepends(SomeQuery)
must be replaced bySomeQuery.depends()
.
- Added nanoid submodule.
- Add synchronous usage of DomainEvent.
- Added ComparisonFilter and corresponding extensions to the sql and fastapi modules. A ComparisonFilter does value comparisons like less than.
-
Added the option of making API routes public in the fastapi Resource. This is done by moving the auth dependencies from app to route level.
-
Fixed SQLAlchemy deprecation warning having to do with
and_
. -
Bumped fastapi to 0.110.*.
-
Bumped pyjwt to 2.8.*.
- Change the type of Tenant.id and User.id to
Id
. This allows more types as id.
- Expanded
Id
to includeUUID
. If a RootEntity's id is annotated withUUID
it will be autogenerated on.create()
.
- Added
SyncManage
as a synchronous alternative toManage
.
-
Fixed starlette deprecation warning about lifespans.
-
Added
on_shutdown
as an optional parameter for the Fastapi Service. -
Moved SQL query building from SQLGateway to a separate SQLBuilder class. Applications that use the SQLGateway should review custom query building functionality.
-
Moved SQL row <-> domain model mapping to SQLGateway.mapper. Applications overriding this mapping (dict_to_row, rows_to_dict) should adapt.
-
Finished SyncSQLGateway. The functionality mirrors that of the SQLGateway, only it doesn't support transactional updates and nested related models.
- Replaced ProfyleMiddleWare by VizTracerMiddleware.
- Added default type casting to string for json fields in AsyncpgSQLDatabase.
-
Replaced SQLProvider with SQLAlchemyAsyncSQLDatabase. SQLProvider still exists, but is the baseclass of several implemenations. Another implementation is AsyncpgSQLDatase; this imlementation removes overhead from SQL query execution and prevents the use of greenlets, but it also adds overhead because query compilation isn't cached.
-
Added a 'has_related' subclass argument to SQLGateway, which should be used whenever a gateway contains nested (related) gateways.
-
Added SyncSQLProvider and a (partial) implementation SQLAlchemySyncSQLDatabase.
-
Don't do any access logging if the access_logger_gateway is not provided to clean_python.fastapi.Service.
-
Pinned dependencies for better guarantees of clean-python tests.
-
Removed Python 3.8 and 3.9 tests, added Python 3.12 tests.
-
Added ProfyleMiddleware.
-
Reverted to the old 'optimistic' concurrency control in Repository.update. This can be switched to 'pessimistic' by using a keyword argument.
- Changed the internals of SQLProvider: asyncpg is now used directly for connection pooling, transaction management, query execution and parameter binding. This removes overhead from SQL query execution and prevents the use of greenlets.
- Fixed celery task_failure_log in case of a crashed worker.
-
SyncApiProvider: also retry when the Retry-After response header is missing.
-
ApiProvider: (sync and async) retry on all methods except POST.
-
ApiProvider: (sync and async) retry on 429, 500, 502, 503, 504.
-
Use a timeout for fetching jwks in TokenVerifier.
-
Changed celery task logger args/kwargs back to argsrepr/kwargsrepr.
-
Sanitize error responses.
-
Remove 501 error response on NotImplementedError.
-
Solved aiohttp 'Unclosed client session' warning.
-
Revert changes done in 0.9.1 in CCTokenGateway.
-
Added CCTokenGateway.fetch_headers()
-
Added optional 'headers' parameter to ApiProvider.
-
Renamed 'fetch_token' parameter in api client to 'headers_factory' and made it optional.
-
Added 'headers_factory' to upload/download functions.
-
Allow 201 "CREATED" status code in upload_file.
-
Manage.update now automatically retries if a Conflict is raised.
-
AlreadyExists is not a subclass of Conflict anymore.
- Fixed verification of client credentials tokens.
- Adapted RequestQuery.filters() to deal with list query parameters.
-
Skip health check access logs.
-
Fix access logging of correlation id.
-
Workaround celery issues with message headers: use the body (kwargs) instead.
- Fixed celery BaseTask for retried tasks.
- Renamed clean_python.celery to clean_python.amqp; clean_python.celery now contains actual Celery abstractions.
-
Automatically dump and restore correlation_id in dramatiq actors.
-
Fixed logging of correlation_id in fastapi access logger.
-
Add correlation_id to logging and accept X-Correlation-Id header in fastapi service.
-
Add
SyncFluentbitGateway
. -
Log the nanosecond-precision "time" instead of the second-precision logtime in
[Sync]FluentbitGateway
.
-
Disable the default multipart encoding in
SyncApiProvider
. -
Added
file
parameter toApiProvider
to upload files (async is a TODO).
- Add
trailing_slash
option toApiProvider
.
-
Adapt call signature of the
fetch_token
callable inApiProvider
. -
Add
clean_python.oauth.client_credentials
.
-
Fix blocking behaviour of
fetch_token
inApiProvider
. -
Fix missing
api_client.Response
.
-
Added async
ApiProvider
andApiGateway
. -
Added
request_raw
toApiProvider
for handling arbitrary responses.
- Allow value objects for
Repository
subclasses.
- Add
Mapper
type use it inSyncApiGateway.mapper
.
- Encode url paths in
SyncApiProvider
.
- Added tests for
SyncApiGateway
and made it compatible withurllib==1.*
.
-
Added
SyncGateway
,SyncRepository
, andInMemorySyncGateway
. -
Added optional
api_client
subpackage (based onurllib3
). -
Added
fastapi_profiler
and renamed existingprofiler
todramatiq_profiler
.
-
Added
S3Gateway.remove_filtered
. -
Added
clean_python.s3.KeyMapper
.
-
Adapt
InternalGateway
so that it derives fromGateway
. -
Renamed the old
InternalGateway
toTypedInternalGateway
. -
Added
SQLDatabase.truncate_tables()
.
- Added
InternalGateway.update
.
- Support adding/changing
responses
via route_options.
- Added optional bind parameters for
execute
inSQLProvider
,SQLDatabase
andSQLTransaction
.
-
Don't use environment variables in setup_debugger.
-
Add Id type (replaces int), it can also be a string.
-
Added S3Gateway.
-
Reinstate static type linter (mypy).
- Fixed linting errors.
- fixed typo in SQL query for creating extensions.
- Added
SQLDatabase.create_extension()
.
- Added
TokenVerifier.force()
for testing purposes.
-
Add
scope
kwarg to http_method decorators (get, post, etc.) -
Moved the
Context
(ctx
) toclean_python.base
and changed its attributes topath
,user
andtenant
. -
The
SQLGateway
can now be constructed withmultitenant=True
which makes it automatically filter thetenant
column with the currentctx.tenant
.
- Expand ctx.claims with user details.
-
Add HTTP Bearer to OpenAPI security schema.
-
Import debugpy at module level on setup_debugger import. Don't check for DEBUG environment variable when setting up.
-
Pydantic 2.x support. Drops Pydantic 1.x support, use 0.1.x for Pydantic 1.x. See https://docs.pydantic.dev/latest/migration/
-
BadRequest
is a subclass ofException
instead ofValidationError
/ValueError
. -
oauth2.OAuth2Settings
is split into two new objects:TokenVerifierSettings
andOAuth2SPAClientSettings
. The associated call signature ofService
was changed.
- Added py.typed marker.
-
Various import fixes.
-
Avoid inject==5.* because of its incompatibility with VS Code (pylance / pyright).
-
Initial project structure created with cookiecutter and cookiecutter-python-template.
-
Ported base functions from internal raster-service project.