Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reexport explicitly #74

Merged
merged 2 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ lint: black isort flake8 mypy

test:
@python3 -m pytest -vv --rootdir tests .

pyenv:
echo aio-request > .python-version && pyenv install -s 3.9.6 && pyenv virtualenv -f 3.9.6 aio-request
87 changes: 87 additions & 0 deletions aio_request/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import collections
import re
import sys
from typing import Tuple

from .base import ClosableResponse, EmptyResponse, Header, Method, Request, Response
from .circuit_breaker import (
Expand Down Expand Up @@ -49,17 +50,101 @@
from .tracing import NOOP_TRACER, NoopSpan, NoopTracer, Span, Tracer
from .transport import Transport

__all__: Tuple[str, ...] = (
# base.py
Copy link

@ar1k ar1k Sep 8, 2021

Choose a reason for hiding this comment

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

It may be better to export it via base._ _ all _ _ + circuit_breaker._ _ all _ _ + ...

"ClosableResponse",
"EmptyResponse",
"Header",
"Method",
"Request",
"Response",
# circuit_breaker.py
"CircuitBreaker",
"CircuitBreakerMetrics",
"CircuitBreakerMetricsSnapshot",
"CircuitState",
"DefaultCircuitBreaker",
"NoopCircuitBreaker",
"RollingCircuitBreakerMetrics",
# client.py
"Client",
"DefaultClient",
# context.py
"get_context",
"set_context",
# deadline.py
"Deadline",
# delays_provider.py
"constant_delays",
"linear_delays",
# metrics.py
"NOOP_METRICS_PROVIDER",
"MetricsProvider",
"NoopMetricsProvider",
# pipeline.py
"BypassModule",
"LowTimeoutModule",
"MetricsModule",
"NextModuleFunc",
"RequestModule",
"TracingModule",
"TransportModule",
"build_pipeline",
# priority.py
"Priority",
# request.py
"delete",
"get",
"patch",
"patch_json",
"post",
"post_json",
"put",
"put_json",
# request_strategy.py
"MethodBasedStrategy",
"ParallelRequestStrategy",
"RequestStrategy",
"ResponseWithVerdict",
"RetryUntilDeadlineExpiredStrategy",
"SendRequestFunc",
"SequentialRequestStrategy",
"SingleAttemptRequestStrategy",
"parallel_strategy",
"retry_until_deadline_expired",
"sequential_strategy",
"single_attempt_strategy",
# response_classifier.py
"DefaultResponseClassifier",
"ResponseClassifier",
"ResponseVerdict",
# setup.py
"setup",
"setup_v2",
# tracing.py
"NOOP_TRACER",
"NoopSpan",
"NoopTracer",
"Span",
"Tracer",
"Transport",
Copy link

Choose a reason for hiding this comment

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

This is from transport.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

)

try:
import aiohttp

from .aiohttp import AioHttpDnsResolver, AioHttpTransport, aiohttp_middleware_factory, aiohttp_timeout

__all__ += ("AioHttpDnsResolver", "AioHttpTransport", "aiohttp_middleware_factory", "aiohttp_timeout")
except ImportError:
pass

try:
import prometheus_client

from .prometheus import PROMETHEUS_METRICS_PROVIDER, PrometheusMetricsProvider

__all__ += ("PROMETHEUS_METRICS_PROVIDER", "PrometheusMetricsProvider")
except ImportError:
pass

Expand All @@ -69,6 +154,8 @@
import opentelemetry.trace

from .opentelemetry import OpenTelemetryTracer

__all__ += ("OpenTelemetryTracer",)
except ImportError:
pass

Expand Down