Skip to content

fix: avoid loading dotenv during import - #3778

Open
mikemikimike wants to merge 1 commit into
milvus-io:masterfrom
mikemikimike:codex/issue-3666-no-dotenv-import
Open

fix: avoid loading dotenv during import#3778
mikemikimike wants to merge 1 commit into
milvus-io:masterfrom
mikemikimike:codex/issue-3666-no-dotenv-import

Conversation

@mikemikimike

Copy link
Copy Markdown

Closes #3666

Importing pymilvus currently calls load_dotenv() from settings.py, causing every variable in a caller's working-directory .env file to be injected into the process environment. This is an unexpected library import side effect.

This change removes the import-time dotenv loading while preserving the existing environment-variable configuration reads. A subprocess regression test verifies that a .env value is not injected when pymilvus.settings is imported.

Validation: focused settings and utility tests passed (71); Ruff format/check and git diff --check passed.

This contribution was prepared with assistance from an AI agent.

@sre-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mikemikimike
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot

Copy link
Copy Markdown

Welcome @mikemikimike! It looks like this is your first PR to milvus-io/pymilvus 🎉

Signed-off-by: mikemikimike <13286568797@163.com>
@mikemikimike
mikemikimike force-pushed the codex/issue-3666-no-dotenv-import branch from c16057d to 699974d Compare August 29, 2026 05:33
@mergify

mergify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mikemikimike

Copy link
Copy Markdown
Author

I rechecked this PR for issue #3666. The PR is linked to the issue, and there is no human changes-requested review or failing check reported for the current head. Could a maintainer please review whether the change fully resolves the issue and approve it, or advise on any remaining work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: load_dotenv() in pymilvus/settings.py causes global environment pollution at import time

2 participants