microbootstrap 0.4.2__tar.gz → 0.4.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/PKG-INFO +4 -1
  2. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/README.md +2 -0
  3. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/bootstrappers/fastapi.py +1 -0
  4. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/bootstrappers/litestar.py +13 -14
  5. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/prometheus_instrument.py +1 -0
  6. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/pyproject.toml +1 -1
  7. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/__init__.py +0 -0
  8. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/bootstrappers/__init__.py +0 -0
  9. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/bootstrappers/base.py +0 -0
  10. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/config/__init__.py +0 -0
  11. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/config/fastapi.py +0 -0
  12. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/config/litestar.py +0 -0
  13. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/console_writer.py +0 -0
  14. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/exceptions.py +0 -0
  15. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/granian_server.py +0 -0
  16. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/helpers.py +0 -0
  17. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/__init__.py +0 -0
  18. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/base.py +0 -0
  19. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/cors_instrument.py +0 -0
  20. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/instrument_box.py +0 -0
  21. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/logging_instrument.py +0 -0
  22. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/opentelemetry_instrument.py +0 -0
  23. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/sentry_instrument.py +0 -0
  24. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/instruments/swagger_instrument.py +0 -0
  25. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/middlewares/__init__.py +0 -0
  26. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/middlewares/fastapi.py +0 -0
  27. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/middlewares/litestar.py +0 -0
  28. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/py.typed +0 -0
  29. {microbootstrap-0.4.2 → microbootstrap-0.4.4}/microbootstrap/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microbootstrap
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: Package for bootstrapping new micro-services
5
5
  Keywords: python,microservice,bootstrap,opentelemetry,logging,error-tracing,litestar,fastapi
6
6
  Author: community-of-python
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
18
19
  Classifier: Programming Language :: Python :: 3 :: Only
19
20
  Classifier: Topic :: Software Development :: Build Tools
20
21
  Classifier: Typing :: Typed
@@ -281,6 +282,7 @@ class YourFastApiSettings(FastApiSettings):
281
282
  service_name: str
282
283
 
283
284
  prometheus_metrics_path: str = "/metrics"
285
+ prometheus_metrics_include_in_schema: bool = False
284
286
  prometheus_instrumentator_params: dict[str, typing.Any] = {}
285
287
  prometheus_instrument_params: dict[str, typing.Any] = {}
286
288
  prometheus_expose_params: dict[str, typing.Any] = {}
@@ -292,6 +294,7 @@ Parameters description:
292
294
 
293
295
  - `service_name` - will be attached to metric's names, but has to be named in [snake_case](https://en.wikipedia.org/wiki/Snake_case).
294
296
  - `prometheus_metrics_path` - path to metrics handler.
297
+ - `prometheus_metrics_include_in_schema` - whether to include metrics route in OpenAPI schema.
295
298
  - `prometheus_instrumentator_params` - will be passed to `Instrumentor` during initialization.
296
299
  - `prometheus_instrument_params` - will be passed to `Instrumentor.instrument(...)`.
297
300
  - `prometheus_expose_params` - will be passed to `Instrumentor.expose(...)`.
@@ -233,6 +233,7 @@ class YourFastApiSettings(FastApiSettings):
233
233
  service_name: str
234
234
 
235
235
  prometheus_metrics_path: str = "/metrics"
236
+ prometheus_metrics_include_in_schema: bool = False
236
237
  prometheus_instrumentator_params: dict[str, typing.Any] = {}
237
238
  prometheus_instrument_params: dict[str, typing.Any] = {}
238
239
  prometheus_expose_params: dict[str, typing.Any] = {}
@@ -244,6 +245,7 @@ Parameters description:
244
245
 
245
246
  - `service_name` - will be attached to metric's names, but has to be named in [snake_case](https://en.wikipedia.org/wiki/Snake_case).
246
247
  - `prometheus_metrics_path` - path to metrics handler.
248
+ - `prometheus_metrics_include_in_schema` - whether to include metrics route in OpenAPI schema.
247
249
  - `prometheus_instrumentator_params` - will be passed to `Instrumentor` during initialization.
248
250
  - `prometheus_instrument_params` - will be passed to `Instrumentor.instrument(...)`.
249
251
  - `prometheus_expose_params` - will be passed to `Instrumentor.expose(...)`.
@@ -106,6 +106,7 @@ class FastApiPrometheusInstrument(PrometheusInstrument[FastApiPrometheusConfig])
106
106
  ).expose(
107
107
  application,
108
108
  endpoint=self.instrument_config.prometheus_metrics_path,
109
+ include_in_schema=self.instrument_config.prometheus_metrics_include_in_schema,
109
110
  **self.instrument_config.prometheus_expose_params,
110
111
  )
111
112
  return application
@@ -63,27 +63,25 @@ class LitestarSwaggerInstrument(SwaggerInstrument):
63
63
  ),
64
64
  )
65
65
  if self.instrument_config.swagger_offline_docs
66
- else ()
66
+ else (SwaggerRenderPlugin(),)
67
67
  )
68
68
 
69
- openapi_config: typing.Final = openapi.OpenAPIConfig(
70
- path=self.instrument_config.swagger_path,
71
- title=self.instrument_config.service_name,
72
- version=self.instrument_config.service_version,
73
- description=self.instrument_config.service_description,
74
- render_plugins=render_plugins,
75
- **self.instrument_config.swagger_extra_params,
76
- )
69
+ all_swagger_params: typing.Final = {
70
+ "path": self.instrument_config.swagger_path,
71
+ "title": self.instrument_config.service_name,
72
+ "version": self.instrument_config.service_version,
73
+ "description": self.instrument_config.service_description,
74
+ "render_plugins": render_plugins,
75
+ } | self.instrument_config.swagger_extra_params
77
76
 
78
- bootstrap_result: typing.Final = {}
77
+ bootstrap_result: typing.Final[dict[str, typing.Any]] = {
78
+ "openapi_config": openapi.OpenAPIConfig(**all_swagger_params)
79
+ }
79
80
  if self.instrument_config.swagger_offline_docs:
80
81
  bootstrap_result["static_files_config"] = [
81
82
  generate_static_files_config(static_files_handler_path=self.instrument_config.service_static_path),
82
83
  ]
83
- return {
84
- **bootstrap_result,
85
- "openapi_config": openapi_config,
86
- }
84
+ return bootstrap_result
87
85
 
88
86
 
89
87
  @LitestarBootstrapper.use_instrument()
@@ -126,6 +124,7 @@ class LitestarPrometheusInstrument(PrometheusInstrument[LitestarPrometheusConfig
126
124
  def bootstrap_before(self) -> dict[str, typing.Any]:
127
125
  class LitestarPrometheusController(PrometheusController):
128
126
  path = self.instrument_config.prometheus_metrics_path
127
+ include_in_schema = self.instrument_config.prometheus_metrics_include_in_schema
129
128
  openmetrics_format = True
130
129
 
131
130
  litestar_prometheus_config: typing.Final = PrometheusConfig(
@@ -14,6 +14,7 @@ class BasePrometheusConfig(BaseInstrumentConfig):
14
14
  service_name: str = "micro-service"
15
15
 
16
16
  prometheus_metrics_path: str = "/metrics"
17
+ prometheus_metrics_include_in_schema: bool = False
17
18
 
18
19
 
19
20
  class LitestarPrometheusConfig(BasePrometheusConfig):
@@ -26,7 +26,7 @@ classifiers = [
26
26
  "Programming Language :: Python :: 3.11",
27
27
  "Programming Language :: Python :: 3.12",
28
28
  ]
29
- version = "0.4.2"
29
+ version = "0.4.4"
30
30
  description = "Package for bootstrapping new micro-services"
31
31
  authors = ["community-of-python"]
32
32
  readme = "README.md"