Skip to content

boto3.Session() called on import #3169

Closed
@Thijss

Description

@Thijss

Describe the bug

import awswrangler as wr

Also triggers an import of index_json (from awswrangler/opensearch/_write.py)

One of the parameters for index_json initializes a boto3.Session() on import.

@_utils.check_optional_dependency(opensearchpy, "opensearchpy")
def index_json(
    ...
    boto3_session: boto3.Session | None = boto3.Session(),
    ...
    **kwargs: Any,

When running e.g., unit tests, this is quite annoying.

How to Reproduce

import awswrangler as wr

Expected behavior

import awswrangler as wr should not initiate a boto3 session

Your project

No response

Screenshots

No response

OS

MacOS

Python version

3.12.9

AWS SDK for pandas version

3.12.1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions