diff --git a/.flake8 b/.flake8
index d5490be7893..6c0c78fa967 100644
--- a/.flake8
+++ b/.flake8
@@ -1,5 +1,5 @@
[flake8]
-exclude = docs, .eggs, setup.py, example, .aws-sam
+exclude = docs, .eggs, setup.py, example, .aws-sam, .git, dist, *.md, *.yaml, example/samconfig.toml, *.txt, *.ini
ignore = E203, E266, W503, BLK100, W291, I004
max-line-length = 120
max-complexity = 15
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index cb9591af4d4..326c95dadfb 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,4 +35,3 @@ repos:
language: system
types: [python]
exclude: example
-fail_fast: true
diff --git a/Makefile b/Makefile
index c73b33864ad..20da3040bb9 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ format:
poetry run black aws_lambda_powertools tests
lint: format
- poetry run flake8
+ poetry run flake8 aws_lambda_powertools/* tests/* example/*
test:
poetry run pytest -vvv --cov=./ --cov-report=xml
diff --git a/aws_lambda_powertools/__init__.py b/aws_lambda_powertools/__init__.py
index 2be705fb386..65b5eb86730 100644
--- a/aws_lambda_powertools/__init__.py
+++ b/aws_lambda_powertools/__init__.py
@@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
"""Top-level package for Lambda Python Powertools."""
-import logging
+
+
+from .logging import Logger # noqa: F401
+from .metrics import Metrics, single_metric # noqa: F401
+from .package_logger import set_package_logger_handler
+from .tracing import Tracer # noqa: F401
__author__ = """Amazon Web Services"""
-logger = logging.getLogger("aws_lambda_powertools")
-logger.addHandler(logging.NullHandler())
-logger.propagate = False
+set_package_logger_handler()
diff --git a/aws_lambda_powertools/logging/logger.py b/aws_lambda_powertools/logging/logger.py
index ff3d3bb8f88..63fa6ed8b28 100644
--- a/aws_lambda_powertools/logging/logger.py
+++ b/aws_lambda_powertools/logging/logger.py
@@ -125,7 +125,7 @@ def logger_setup(
-------
**Logger class - Same UX**
- from aws_lambda_powertools.logging import Logger
+ from aws_lambda_powertools import Logger
logger = Logger(service="payment") # same env var still applies
"""
@@ -143,7 +143,7 @@ def logger_inject_lambda_context(
-------
**Logger class - Same UX**
- from aws_lambda_powertools.logging import Logger
+ from aws_lambda_powertools import Logger
logger = Logger(service="payment") # same env var still applies
@logger.inject_lambda_context
def handler(evt, ctx):
@@ -307,7 +307,7 @@ class Logger(logging.Logger):
-------
**Setups structured logging in JSON for Lambda functions with explicit service name**
- >>> from aws_lambda_powertools.logging import Logger
+ >>> from aws_lambda_powertools import Logger
>>> logger = Logger(service="payment")
>>>
>>> def handler(event, context):
@@ -317,7 +317,7 @@ class Logger(logging.Logger):
$ export POWERTOOLS_SERVICE_NAME="payment"
$ export POWERTOOLS_LOGGER_SAMPLE_RATE=0.01 # 1% debug sampling
- >>> from aws_lambda_powertools.logging import Logger
+ >>> from aws_lambda_powertools import Logger
>>> logger = Logger()
>>>
>>> def handler(event, context):
@@ -325,7 +325,7 @@ class Logger(logging.Logger):
**Append payment_id to previously setup structured log logger**
- >>> from aws_lambda_powertools.logging import Logger
+ >>> from aws_lambda_powertools import Logger
>>> logger = Logger(service="payment")
>>>
>>> def handler(event, context):
@@ -398,7 +398,7 @@ def inject_lambda_context(self, lambda_handler: Callable[[Dict, Any], Any] = Non
-------
**Captures Lambda contextual runtime info (e.g memory, arn, req_id)**
- from aws_lambda_powertools.logging import Logger
+ from aws_lambda_powertools import Logger
logger = Logger(service="payment")
@@ -408,7 +408,7 @@ def handler(event, context):
**Captures Lambda contextual runtime info and logs incoming request**
- from aws_lambda_powertools.logging import Logger
+ from aws_lambda_powertools import Logger
logger = Logger(service="payment")
diff --git a/aws_lambda_powertools/metrics/__init__.py b/aws_lambda_powertools/metrics/__init__.py
index d3ef0bb9817..2f71957437d 100644
--- a/aws_lambda_powertools/metrics/__init__.py
+++ b/aws_lambda_powertools/metrics/__init__.py
@@ -1,7 +1,6 @@
"""CloudWatch Embedded Metric Format utility
"""
-from aws_lambda_powertools.helper.models import MetricUnit
-
+from ..helper.models import MetricUnit
from .exceptions import MetricUnitError, MetricValueError, SchemaValidationError, UniqueNamespaceError
from .metric import single_metric
from .metrics import Metrics
diff --git a/aws_lambda_powertools/metrics/base.py b/aws_lambda_powertools/metrics/base.py
index 5dc24b22a0e..a53f2ec2f63 100644
--- a/aws_lambda_powertools/metrics/base.py
+++ b/aws_lambda_powertools/metrics/base.py
@@ -9,8 +9,7 @@
import fastjsonschema
-from aws_lambda_powertools.helper.models import MetricUnit
-
+from ..helper.models import MetricUnit
from .exceptions import MetricUnitError, MetricValueError, SchemaValidationError, UniqueNamespaceError
logger = logging.getLogger(__name__)
diff --git a/aws_lambda_powertools/metrics/metric.py b/aws_lambda_powertools/metrics/metric.py
index 6f57bb680df..53434b4a9d4 100644
--- a/aws_lambda_powertools/metrics/metric.py
+++ b/aws_lambda_powertools/metrics/metric.py
@@ -3,8 +3,8 @@
from contextlib import contextmanager
from typing import Dict
-from aws_lambda_powertools.helper.models import MetricUnit
-from aws_lambda_powertools.metrics.base import MetricManager
+from ..helper.models import MetricUnit
+from .base import MetricManager
logger = logging.getLogger(__name__)
@@ -69,7 +69,8 @@ def single_metric(name: str, unit: MetricUnit, value: float, namespace: str = No
-------
**Creates cold start metric with function_version as dimension**
- from aws_lambda_powertools.metrics import single_metric, MetricUnit
+ from aws_lambda_powertools import single_metric
+ from aws_lambda_powertools.metrics import MetricUnit
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, namespace="ServerlessAirline") as metric:
metric.add_dimension(name="function_version", value=47)
@@ -78,7 +79,8 @@ def single_metric(name: str, unit: MetricUnit, value: float, namespace: str = No
$ export POWERTOOLS_METRICS_NAMESPACE="ServerlessAirline"
- from aws_lambda_powertools.metrics import single_metric, MetricUnit
+ from aws_lambda_powertools import single_metric
+ from aws_lambda_powertools.metrics import MetricUnit
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1) as metric:
metric.add_dimension(name="function_version", value=47)
diff --git a/aws_lambda_powertools/metrics/metrics.py b/aws_lambda_powertools/metrics/metrics.py
index 2c095782e73..5b0c9a523d9 100644
--- a/aws_lambda_powertools/metrics/metrics.py
+++ b/aws_lambda_powertools/metrics/metrics.py
@@ -4,7 +4,7 @@
import os
from typing import Any, Callable
-from aws_lambda_powertools.metrics.base import MetricManager
+from .base import MetricManager
logger = logging.getLogger(__name__)
@@ -30,7 +30,7 @@ class Metrics(MetricManager):
-------
**Creates a few metrics and publish at the end of a function execution**
- from aws_lambda_powertools.metrics import Metrics
+ from aws_lambda_powertools import Metrics
metrics = Metrics(namespace="ServerlessAirline", service="payment")
metrics.add_metric(name="ColdStart", unit=MetricUnit.Count, value=1)
diff --git a/aws_lambda_powertools/middleware_factory/factory.py b/aws_lambda_powertools/middleware_factory/factory.py
index e0108def088..d71c2e19d67 100644
--- a/aws_lambda_powertools/middleware_factory/factory.py
+++ b/aws_lambda_powertools/middleware_factory/factory.py
@@ -76,7 +76,7 @@ def lambda_handler(event, context):
**Trace execution of custom middleware**
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
tracer = Tracer(service="payment") # or via env var
diff --git a/aws_lambda_powertools/package_logger.py b/aws_lambda_powertools/package_logger.py
new file mode 100644
index 00000000000..c1adb67ade8
--- /dev/null
+++ b/aws_lambda_powertools/package_logger.py
@@ -0,0 +1,7 @@
+import logging
+
+
+def set_package_logger_handler():
+ logger = logging.getLogger("aws_lambda_powertools")
+ logger.addHandler(logging.NullHandler())
+ logger.propagate = False
diff --git a/aws_lambda_powertools/tracing/tracer.py b/aws_lambda_powertools/tracing/tracer.py
index d3f5269ae78..d31cbd61ebd 100644
--- a/aws_lambda_powertools/tracing/tracer.py
+++ b/aws_lambda_powertools/tracing/tracer.py
@@ -50,7 +50,7 @@ class Tracer:
-------
**A Lambda function using Tracer**
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="greeting")
@tracer.capture_method
@@ -67,7 +67,7 @@ def handler(event: dict, context: Any) -> Dict:
**Booking Lambda function using Tracer that adds additional annotation/metadata**
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="booking")
@tracer.capture_method
@@ -89,7 +89,7 @@ def handler(event: dict, context: Any) -> Dict:
**A Lambda function using service name via POWERTOOLS_SERVICE_NAME**
export POWERTOOLS_SERVICE_NAME="booking"
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler
@@ -101,7 +101,7 @@ def handler(event: dict, context: Any) -> Dict:
**Reuse an existing instance of Tracer anywhere in the code**
# lambda_handler.py
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler
@@ -109,7 +109,7 @@ def handler(event: dict, context: Any) -> Dict:
...
# utils.py
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer()
...
@@ -301,7 +301,7 @@ def some_function()
**Custom async method using capture_method decorator**
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="booking")
@tracer.capture_method
@@ -319,7 +319,7 @@ def lambda_handler(event: dict, context: Any) -> Dict:
**Tracing nested async calls**
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="booking")
@tracer.capture_method
@@ -341,7 +341,7 @@ async def async_tasks():
This may not needed once [this bug is closed](https://github.com/aws/aws-xray-sdk-python/issues/164)
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="booking")
async def get_identity():
@@ -362,7 +362,7 @@ async def async_tasks():
This may not needed once [this bug is closed](https://github.com/aws/aws-xray-sdk-python/issues/164)
- from aws_lambda_powertools.tracing import Tracer
+ from aws_lambda_powertools import Tracer
tracer = Tracer(service="booking")
async def get_identity():
diff --git a/docs/content/core/logger.mdx b/docs/content/core/logger.mdx
index af611d771ec..0fa519420f3 100644
--- a/docs/content/core/logger.mdx
+++ b/docs/content/core/logger.mdx
@@ -37,7 +37,7 @@ By default, Logger uses **INFO** log level. You can either change log level via
You can also explicitly set a service name via `service` param or via `POWERTOOLS_SERVICE_NAME` env var. This sets **service** key that will be present across all log statements.
```python:title=app.py
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger
# POWERTOOLS_SERVICE_NAME defined
logger = Logger() # highlight-line
@@ -63,7 +63,7 @@ Key | Type | Example | Description
You can enrich your structured logs with key Lambda context information via `inject_lambda_context`.
```python:title=collect.py
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger
logger = Logger()
@@ -86,7 +86,7 @@ You can also explicitly log any incoming event using `log_event` param or via `P
```python:title=log_handler_event.py
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger
logger = Logger()
@@ -151,7 +151,7 @@ Key | Type | Example
You can append your own keys to your existing Logger via `structure_logs` with **append** param.
```python:title=collect.py
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger
logger = Logger()
@@ -194,7 +194,7 @@ This happens on an entire request basis, and DEBUG level is set
```python:title=collect.py
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger
# Sample 1% of debug logs e.g. 0.1
logger = Logger(sample_rate=0.1) # highlight-line
diff --git a/docs/content/core/metrics.mdx b/docs/content/core/metrics.mdx
index bd1de65f88c..ad0f36927b4 100644
--- a/docs/content/core/metrics.mdx
+++ b/docs/content/core/metrics.mdx
@@ -36,7 +36,8 @@ You can explicitly set a namespace name via `namespace` param or via `POWERTOOLS
You can also pass a service name via `service` param or `POWERTOOLS_SERVICE_NAME` env var. This will create a dimension with the service name.
```python:title=app.py
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
# POWERTOOLS_METRICS_NAMESPACE and POWERTOOLS_SERVICE_NAME defined
metrics = Metrics() # highlight-line
@@ -54,7 +55,8 @@ You can initialize Metrics anywhere in your code as many times as you need - It'
You can create metrics using `add_metric`, and manually create dimensions for all your aggregate metrics using `add_dimension`.
```python:title=app.py
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
metrics = Metrics(namespace="ExampleApplication", service="booking")
# highlight-start
@@ -79,7 +81,8 @@ CloudWatch EMF uses the same dimensions across all your metrics. Use `single_met
```python:title=single_metric.py
-from aws_lambda_powertools.metrics import MetricUnit, single_metric
+from aws_lambda_powertools import single_metric
+from aws_lambda_powertools.metrics import MetricUnit
with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, namespace="ExampleApplication") as metric: # highlight-line
metric.add_dimension(name="function_context", value="$LATEST")
@@ -91,7 +94,8 @@ with single_metric(name="ColdStart", unit=MetricUnit.Count, value=1, namespace="
As you finish adding all your metrics, you need to serialize and flush them to standard output. You can do that right before you return your response to the caller via `log_metrics`.
```python:title=lambda_handler.py
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
metrics = Metrics(service="ExampleService")
metrics.add_metric(name="ColdStart", unit="Count", value=1)
@@ -115,7 +119,8 @@ def lambda_handler(evt, ctx):
```python:title=lambda_handler_nested_middlewares.py
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
metrics = Metrics(namespace="ExampleApplication", service="booking")
metrics.add_metric(name="ColdStart", unit="Count", value=1)
@@ -135,7 +140,8 @@ If you prefer not to use `log_metrics` because you might want to encapsulate add
```python:title=manual_metric_serialization.py
import json
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
metrics = Metrics(namespace="ExampleApplication", service="booking")
metrics.add_metric(name="ColdStart", unit="Count", value=1)
@@ -152,7 +158,8 @@ print(json.dumps(your_metrics_object))
You can capture cold start metrics automatically with `log_metrics` via `capture_cold_start_metric` param.
```python:title=lambda_handler.py
-from aws_lambda_powertools.metrics import Metrics, MetricUnit
+from aws_lambda_powertools import Metrics
+from aws_lambda_powertools.metrics import MetricUnit
metrics = Metrics(service="ExampleService")
diff --git a/docs/content/core/tracer.mdx b/docs/content/core/tracer.mdx
index a03dd272ee0..a4a4fbff658 100644
--- a/docs/content/core/tracer.mdx
+++ b/docs/content/core/tracer.mdx
@@ -37,7 +37,7 @@ Resources:
You can either explicitly pass using `service` param or via `POWERTOOLS_SERVICE_NAME` environment variable. The service name is utilized for exceptions, metadata, and namespace data.
```python:title=app.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
# POWERTOOLS_SERVICE_NAME defined
tracer = Tracer() # highlight-line
@@ -55,7 +55,7 @@ When using this decorator, Tracer performs these additional tasks to ease operat
* Adds any response, or full exceptions generated by the handler as metadata
```python:title=lambda_handler.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler # highlight-line
@@ -72,7 +72,7 @@ Annotations are key-values indexed by AWS X-Ray on a per trace basis. You can us
You can add annotations using `put_annotation` method from Tracer.
```python:title=app.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler
@@ -88,7 +88,7 @@ Metadata are non-indexed values that can add additional context for an operation
You can add metadata using `put_metadata` method from Tracer.
```python:title=app.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler
@@ -121,7 +121,7 @@ You can trace an asynchronous function using the `capture_method`. The decorator
```python:title=lambda_handler_with_async_code.py
import asyncio
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer()
# highlight-start
@@ -147,7 +147,8 @@ You can use `aiohttp_trace_config` function to create a valid [aiohttp trace_con
import asyncio
import aiohttp
-from aws_lambda_powertools.tracing import Tracer, aiohttp_trace_config # highlight-line
+from aws_lambda_powertools import Tracer
+from aws_lambda_powertools.tracing import aiohttp_trace_config # highlight-line
tracer = Tracer()
async def aiohttp_task():
@@ -174,7 +175,7 @@ A safe workaround mechanism is to use `in_subsegment_async` available via Tracer
```python:title=lambda_handler_with_concurret_async_code_workaround.py
import asyncio
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer()
async def another_async_task():
@@ -200,7 +201,7 @@ Tracer keeps a copy of its configuration after the first initialization. This is
```python:title=lambda_handler.py
# handler.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
tracer = Tracer(service="payment")
@tracer.capture_lambda_handler
@@ -211,7 +212,7 @@ def handler(event, context)
```
```python:title=another_file.py
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
# highlight-start
# new instance using existing configuration with auto patching overriden
tracer = Tracer(auto_patch=False)
diff --git a/docs/content/utilities/middleware_factory.mdx b/docs/content/utilities/middleware_factory.mdx
index bb12b9244b9..a5f85128111 100644
--- a/docs/content/utilities/middleware_factory.mdx
+++ b/docs/content/utilities/middleware_factory.mdx
@@ -82,7 +82,7 @@ For advanced use cases, you can instantiate [Tracer](../core/tracer) inside your
```python:title=app.py
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
@lambda_handler_decorator(trace_execution=True)
def middleware_name(handler, event, context):
diff --git a/example/hello_world/app.py b/example/hello_world/app.py
index b7d4948a234..53ce0ace715 100644
--- a/example/hello_world/app.py
+++ b/example/hello_world/app.py
@@ -5,15 +5,15 @@
import aiohttp
import requests
-from aws_lambda_powertools.logging import Logger
+from aws_lambda_powertools import Logger, Metrics, Tracer, single_metric
from aws_lambda_powertools.logging.logger import set_package_logger
-from aws_lambda_powertools.metrics import Metrics, MetricUnit, single_metric
+from aws_lambda_powertools.metrics import MetricUnit
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
-from aws_lambda_powertools.tracing import Tracer, aiohttp_trace_config
+from aws_lambda_powertools.tracing import aiohttp_trace_config
set_package_logger() # Enable package diagnostics (DEBUG log)
-# tracer = Tracer() # patches all available modules
+# tracer = Tracer() # patches all available modules # noqa: E800
tracer = Tracer(patch_modules=("aioboto3", "boto3", "requests")) # ~90-100ms faster in perf depending on set of libs
logger = Logger()
metrics = Metrics()
@@ -86,7 +86,7 @@ def lambda_handler(event, context):
event: dict, required
API Gateway Lambda Proxy Input Format
- Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format
+ Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format # noqa: E501
context: object, required
Lambda Context runtime methods and attributes
diff --git a/example/tests/test_handler.py b/example/tests/test_handler.py
index 62d4133db5e..cbd46ae6f3f 100644
--- a/example/tests/test_handler.py
+++ b/example/tests/test_handler.py
@@ -1,5 +1,4 @@
import json
-import os
import sys
from dataclasses import dataclass
diff --git a/poetry.lock b/poetry.lock
index 345acc2f527..5e3393d85a8 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -947,7 +947,6 @@ multidict = ">=4.0"
[[package]]
category = "main"
description = "Backport of pathlib-compatible object wrapper for zip files"
-marker = "python_version < \"3.8\""
name = "zipp"
optional = false
python-versions = ">=3.6"
diff --git a/pyproject.toml b/pyproject.toml
index 676e1951150..400bb3e37bf 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -44,9 +44,9 @@ aiohttp = "^3.6.2"
bandit = "^1.6.2"
radon = "^4.1.0"
xenon = "^0.7.0"
-flake8-bugbear = "^20.1.4"
flake8-eradicate = "^0.3.0"
dataclasses = {version = "*", python = "~3.6"}
+flake8-bugbear = "^20.1.4"
[tool.coverage.run]
source = ["aws_lambda_powertools"]
diff --git a/tests/functional/test_aws_lambda_logging.py b/tests/functional/test_aws_lambda_logging.py
index 4a4513134dc..9d61c16e2db 100644
--- a/tests/functional/test_aws_lambda_logging.py
+++ b/tests/functional/test_aws_lambda_logging.py
@@ -5,7 +5,7 @@
import pytest
-from aws_lambda_powertools.logging.logger import Logger
+from aws_lambda_powertools import Logger
@pytest.fixture
diff --git a/tests/functional/test_logger.py b/tests/functional/test_logger.py
index 0fce60c5291..19c45a8587e 100644
--- a/tests/functional/test_logger.py
+++ b/tests/functional/test_logger.py
@@ -5,10 +5,10 @@
import pytest
-from aws_lambda_powertools.logging import Logger, MetricUnit, log_metric, logger_inject_lambda_context, logger_setup
+from aws_lambda_powertools import Logger, Tracer
+from aws_lambda_powertools.logging import MetricUnit, log_metric, logger_inject_lambda_context, logger_setup
from aws_lambda_powertools.logging.exceptions import InvalidLoggerSamplingRateError
from aws_lambda_powertools.logging.logger import JsonFormatter, set_package_logger
-from aws_lambda_powertools.tracing import Tracer
@pytest.fixture
diff --git a/tests/functional/test_metrics.py b/tests/functional/test_metrics.py
index 7f3a57c9538..d9ac2e74f33 100644
--- a/tests/functional/test_metrics.py
+++ b/tests/functional/test_metrics.py
@@ -4,14 +4,13 @@
import pytest
+from aws_lambda_powertools import Metrics, single_metric
from aws_lambda_powertools.metrics import (
- Metrics,
MetricUnit,
MetricUnitError,
MetricValueError,
SchemaValidationError,
UniqueNamespaceError,
- single_metric,
)
from aws_lambda_powertools.metrics.base import MetricManager
diff --git a/tests/functional/test_tracing.py b/tests/functional/test_tracing.py
index c74d735ac33..6cff182015e 100644
--- a/tests/functional/test_tracing.py
+++ b/tests/functional/test_tracing.py
@@ -1,6 +1,6 @@
import pytest
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
@pytest.fixture
diff --git a/tests/unit/test_tracing.py b/tests/unit/test_tracing.py
index 72ce983334b..65cb04c997b 100644
--- a/tests/unit/test_tracing.py
+++ b/tests/unit/test_tracing.py
@@ -4,7 +4,7 @@
import pytest
-from aws_lambda_powertools.tracing import Tracer
+from aws_lambda_powertools import Tracer
@pytest.fixture