Skip to content

support expanduser() for dotenv_path #525

Closed

Description

@wgong

It would be great if one can place API_KEYs in one .env file outside github repositories,
currently dotenv_path argument does not support "~" as home_path.

Please consider improving this line at https://github.com/theskumar/python-dotenv/blob/main/src/dotenv/main.py#L45
as

self.dotenv_path: Optional[StrPath] = Path(dotenv_path).expanduser()

Thanks

Activity

  1. stuaxo commented on Jan 6, 2025

    @stuaxo

    @wgong this would have a better chance of being merged as a PR

  2. wgong commented on Jan 7, 2025

    @wgong
    Author

    thanks for considering this enhancement

  3. theskumar commented on Jan 7, 2025

    @theskumar
    Owner

    @wgong I believe this is a safe change, can be supported. cc: @bbc2

  4. added a commit that references this issue on Oct 1, 2026
    7914148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions