- Release with httpx frozen to <0.28 due to Proxy update.
- Authorize older prometheus client library.
- Add :meth:`blacksmith.ResponseBox.inspect` method.
- Add :meth:`blacksmith.ResponseBox.inspect_err` method.
- Drop python 3.8 compatibility.
- Update the packaging (use uv and pdm instead of poetry).
- Update the CI.
- Change the licence to MIT License.
- Update the nomad service discovery for versionned service. Now the version is added in the environment variable by default. All the service and url are configurable.
- Add support of nomad for service discovery. See :class:`blacksmith.AsyncNomadDiscovery` - contrib from @gdchamal
- Drop support of python 3.7, add support of python 3.12
- Remove the deprecated result.response property replaced by result.unwrap()
- Drop support of pydantic 1
- Fix small typing issue
- Small fix for type Url with pydantic 2
- Add a way to support multiple serialization format, more than json.
In this release, support of
application/x-www-form-urlencoded
is natively support. A new abstract class :class:`blacksmith.AbstractHttpBodySerializer` is available to handle new kind of serialization format. The function :func:`blacksmith.register_http_body_serializer` has been added to register new format.
- Add missing method :meth:`blacksmith.ResponseBox.unwrap_or_raise`
- Add support of Union types for request parameters
- Update httpx dependency for python > 3.7
- Add SecretStr support for parameters
- Update dependencies
- Update dependencies
- Add pydantic 2 support
note that pydantic 1 is still supported until blacksmith 3.0
- Update dependencies
- Remove aioredis, use redis.asyncio since it is deprecated
- Make it compat with python 3.11
- Do not override the content-type if it has already been set.
- Change behavior for explicit
None
in request parameters. Before this, it was not possible to properly choose attributes to patch to null. :ref:`See documentation<dealing_with_none>`
- Update dependencies (prometheus ^0.15)
- New method :meth:`blacksmith.ResponseBox.as_result` this method is usefull to cast an http response, to cast thes response box to a Result<ResponseSchema, ErrorFormat>
- Update dependency to at least pydantic 1.9
- Update dependency result to 0.9
- Fix consul service discovery support when ServiceAddress is empty.
- New method :meth:`blacksmith.ResponseBox.as_optional` This method is usefull for response that has no return schema and the response needs to be map to return something else without raising a :class:`blacksmith.domain.exceptions.NoResponseSchemaException`
- Fix concistency for :meth:`blacksmith.AsyncRouteProxy.collection_get` with other HTTP Response Object as using a result type from the :term:`result library`.
- Improve error handling. See :ref:`HTTP Errors`
The
collection_get
method in :class:`blacksmith.AsyncRouteProxy` and :class:`blacksmith.SyncRouteProxy` return a Result type instead of an iterator.api = await cli("api") # In blacksmith 1.0 items: CollectionIterator[PartialItem] = await api.item.collection_get() # In blacksmith >=2.0 items: Result[ CollectionIterator[PartialItem], HTTPError ] = await api.item.collection_get()
Note that the :class:`blacksmith.HTTPError` can be replaced by your own format, using the new parameter error_parser of the :class:`blacksmith.AsyncClientFactory` and :class:`blacksmith.SyncClientFactory`.
The type of :class:`blacksmith.AsyncClientFactory`, :class:`blacksmith.AsyncClient`, :class:`blacksmith.SyncClientFactory` and :class:`blacksmith.SyncClient` cannot be used to specify collection and item types.
The :attr:`blacksmith.ResponseBox.response` is deprecated in favor of the :meth:`blacksmith.ResponseBox.unwrap` method.
api = await cli("api") # In blacksmith 1.0 item: Item = await api.item.get(Get(id=id)).response # In blacksmith >=2.0 item: Item = await api.item.get(Get(id=id)).unwrap() # Or better result_item: ResponseBox[Item] = await api.item.get(Get(id=id)) if result_item.is_ok(): item = result_item.unwrap() # unwrap will raise if the result is an error. else: error = result_item.unwrap_err()
Important
The :class:`blacksmith.ResponseBox` as plenty of new method to have the same mimic of the result type from the :term:`result library`.
- Update dependencies
- Update dependencies
- Add new page in the doc for the web framework integration
- Update dependencies
- Update dependencies
- Add type support for prometheus
- Remove extra dependency caching, add http_cache_async and http_cache_sync.
- Rename internal attribute request to read on :class:`blacksmith.HTTPTimeout`
- Declare missing type on :class:`blacksmith.AsyncAbstractTransport`
Important
Breaking change
- Exposing more classes in the main module:
- CollectionParser
- AsyncAbstractServiceDiscovery
- SyncAbstractServiceDiscovery
- AsyncAbstractTransport
- SyncAbstractTransport
- HTTPRequest
- HTTPResponse
- Add an example on how to unit test.
- Fix typo, rename AbtractTraceContext to :class:`blacksmith.AbstractTraceContext`
Important
Breaking change
Important
This is the release candidate. Last releases where a lot about refactoring and fixing naming concistency.
- No new feature will be added.
- No major breaking change are going to be introduced.
New feature
- HTTP Cache Middleware now expose metrics using the its metrics argument.
Breaking Changes
- The :meth:`blacksmith.AsyncClientFactory.initialize` must be called to initialize
middleware that requires it. (e.g. the ones that use a
aioredis
connections). See the documentation of :ref:`HTTP Cache Middleware` and :ref:`Circuit Breaker Middleware` for the detail. - All middleware classes ends with a
Middleware
suffix. AsyncHTTPAuthorization
=> :class:`blacksmith.AsyncHTTPAuthorizationMiddleware`AsyncHTTPBearerAuthorization
=> :class:`blacksmith.AsyncHTTPBearerMiddleware`AsyncCircuitBreaker
=> :class:`blacksmith.AsyncCircuitBreakerMiddleware`AsyncPrometheusMetrics
=> :class:`blacksmith.AsyncPrometheusMiddleware`AsyncHTTPCachingMiddleware
=> :class:`blacksmith.AsyncHTTPCacheMiddleware`SyncHTTPAuthorization
=> :class:`blacksmith.SyncHTTPAuthorizationMiddleware`SyncHTTPBearerAuthorization
=> :class:`blacksmith.SyncHTTPBearerMiddleware`SyncCircuitBreaker
=> :class:`blacksmith.SyncCircuitBreakerMiddleware`SyncPrometheusMetrics
=> :class:`blacksmith.SyncPrometheusMiddleware`SyncHTTPCachingMiddleware
=> :class:`blacksmith.SyncHTTPCacheMiddleware`
- All middleware classes ends with a
- :class:`blacksmith.AsyncCircuitBreakerMiddleware` and :class:`blacksmith.SyncCircuitBreakerMiddleware` now have a :class:`blacksmith.PrometheusMetrics` instead of the prometheus middleware :class:`blacksmith.AsyncPrometheusMiddleware` or :class:`blacksmith.SyncPrometheusMiddleware`.
- The :meth:`blacksmith.AsyncClientFactory.initialize` must be called to initialize
middleware that requires it. (e.g. the ones that use a
- Expose AsyncClient and SyncClient for typing purpose.
- Refactor transport to have the same signature as middleware.
- Breaking Change:
- The http middleware does not have an http method
- The type HttpMethod is not HTTPMethod
- The HTTPRequest type now have a method attribute.
- Add typing support. see PEP 561
- Update the CI.
- Create a wrapper around json for the AbstractSerializer in the circuit breaker.
- Add an AbstractCollectionParser to improve API signatures.
- Cleanup code, fix few typing issue and unmanage error on collection_get if the contract is not registered.
- Add a method to have middleware per client.
- Fix typo in internals.
- Fix typo in documentations and internals.
- Add parameter proxies parameter in AsyncClientFactory and SyncClientFactory
- It allow to configure http proxies for http and https
- Add parameter verify_certificate parameter in AsyncClientFactory and SyncClientFactory
- It allow to disable the TLS Certificate check. By default, in case of invalid certificate, all request are rejected.
- Add support of the Sync version
..important:
Breaking changes:
- Rename all classes that do async with an
Async
prefix. * Services * Middlewares * Service Discovery
- Replace circuit breaker implementation.
..important:
Breaking change in the middleware.
Parameter fail_max is now named threshold Parameter timeout_duration is now named ttl and is a float (number of second).
- Expose the HTTPCachingMiddleware in blacksmith namespace
- Fix case sensitivity in cache header
- make http caching serializer in middleware configurable
- Add a http caching middleware based on redis
- Update zipkin integration for starlette-zipkin 0.2
- Reverse order of middleware to be natural and intuitive on insert
- Update httpx version ^0.21.1
- Collect circuit breaker metrics in prometheus
Rename project to blacksmith (prometheus metrics name updated too)
Implement middleware as a pattern to inject data in http request and response
- Breaking changes: auth keyword is replace by middleware. (Documentation updated)
- Breaking changes: auth keyword is replace by middleware. (Documentation updated)
- Replace aioli_http_requests Gauge by aioli_request_latency_seconds Histogram. (prometheus)
- Add metadata in pyproject.toml for pypi
- Implement consul discovery (see consul example)
- Implement router discovery (see consul template example)
- Add prometheus metrics support
- Add zipkin tracing support
- Initial release