Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[mypy]
exclude = prometheus_client/decorator.py|prometheus_client/twisted|tests/test_twisted.py
implicit_reexport = False

[mypy-prometheus_client.decorator]
follow_imports = skip
31 changes: 29 additions & 2 deletions prometheus_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,35 @@
from .process_collector import PROCESS_COLLECTOR, ProcessCollector
from .registry import CollectorRegistry, REGISTRY

__all__ = ['Counter', 'Gauge', 'Summary', 'Histogram', 'Info', 'Enum']

__all__ = (
'CollectorRegistry',
'REGISTRY',
'Metric',
'Counter',
'Gauge',
'Summary',
'Histogram',
'Info',
'Enum',
'CONTENT_TYPE_LATEST',
'generate_latest',
'MetricsHandler',
'make_wsgi_app',
'make_asgi_app',
'start_http_server',
'start_wsgi_server',
'write_to_textfile',
'push_to_gateway',
'pushadd_to_gateway',
'delete_from_gateway',
'instance_ip_grouping_key',
'ProcessCollector',
'PROCESS_COLLECTOR',
'PlatformCollector',
'PLATFORM_COLLECTOR',
'GCCollector',
'GC_COLLECTOR',
)

if __name__ == '__main__':
c = Counter('cc', 'A counter')
Expand Down
15 changes: 15 additions & 0 deletions prometheus_client/exposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
from .registry import REGISTRY
from .utils import floatToGoString

__all__ = (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure about this, but had to explicitly export in this way because of make_asgi_app.

@Pliner Pliner Jan 28, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prometheus_client/__init__.py:7: error:Module "prometheus_client.exposition" does not explicitly export attribute "make_asgi_app"; implicit reexport disabled

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me, it makes it very clear that those are the things we are exporting.

'CONTENT_TYPE_LATEST',
'delete_from_gateway',
'generate_latest',
'instance_ip_grouping_key',
'make_asgi_app',
'make_wsgi_app',
'MetricsHandler',
'push_to_gateway',
'pushadd_to_gateway',
'start_http_server',
'start_wsgi_server',
'write_to_textfile',
)

CONTENT_TYPE_LATEST = 'text/plain; version=0.0.4; charset=utf-8'
"""Content type of the latest text format"""
PYTHON376_OR_NEWER = sys.version_info > (3, 7, 5)
Expand Down