Skip to content

Support reading .env files from FIFOs (e.g. 1Password Environments)#776

Merged
hramezani merged 1 commit intopydantic:mainfrom
JacobHayes:support-fifo-env-files
Mar 8, 2026
Merged

Support reading .env files from FIFOs (e.g. 1Password Environments)#776
hramezani merged 1 commit intopydantic:mainfrom
JacobHayes:support-fifo-env-files

Conversation

@JacobHayes
Copy link
Copy Markdown
Contributor

@JacobHayes JacobHayes commented Feb 13, 2026

1Password Environments mounts .env files as named pipes (FIFOs). These were previously skipped because the is_file() check returns False for FIFOs. This adds an is_fifo() check so they are read normally.

https://developer.1password.com/docs/environments

Closes #771

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the dotenv settings source to treat named pipes (FIFOs)—such as those used by 1Password Environments—as readable .env inputs, instead of skipping them.

Changes:

  • Allow .env paths that are FIFOs to be read by DotEnvSettingsSource (in addition to regular files).
  • Add a Unix-only test that verifies .env content can be read from a FIFO.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pydantic_settings/sources/providers/dotenv.py Extends env file detection to include FIFO paths so mounted named pipes are read.
tests/test_settings.py Adds a regression test that writes dotenv content through a FIFO and asserts it’s parsed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pydantic pydantic deleted a comment from Copilot AI Feb 15, 2026
@pydantic pydantic deleted a comment from Copilot AI Feb 15, 2026
@hramezani
Copy link
Copy Markdown
Member

Thasnk @JacobHayes for the PR.

Would be great if you can udpate the dotenv source documentation in https://github.com/pydantic/pydantic-settings/blob/main/docs/index.md#dotenv-env-support

1Password Environments mounts .env files as named pipes (FIFOs). These
were previously skipped because the is_file() check returns False for
FIFOs. Add an is_fifo() check so they are read normally.

Signed-off-by: Jacob Hayes <jacob.hayes@datadoghq.com>
@JacobHayes JacobHayes force-pushed the support-fifo-env-files branch from e192686 to 38a7b56 Compare March 7, 2026 17:55
@hramezani
Copy link
Copy Markdown
Member

Thanks @JacobHayes

@hramezani hramezani merged commit 04d2cd6 into pydantic:main Mar 8, 2026
19 checks passed
@hramezani hramezani mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FIFO Support for python-dotenv provider

3 participants