Skip to content

Add os.reload_environ() function #120057

Closed
Closed

Activity

  1. WolfDWyc commented on Jun 11, 2024

    @WolfDWyc
  2. added 4 commits that reference this issue on Jun 14, 2024
  3. added a commit that references this issue on Jun 30, 2024
  4. added a commit that references this issue on Jul 11, 2024
  5. added a commit that references this issue on Jul 17, 2024
  6. picnixz commented on Sep 1, 2024

    @picnixz
    Member

    Since we had a bunch of closed PRs, should this issue be closed for now? or are there other pending discussions?

  7. serhiy-storchaka commented on Sep 2, 2024

    @serhiy-storchaka
    Member

    There was other ongoing discussion: https://discuss.python.org/t/bikeshedding-a-method-to-refresh-os-environ/57628/22

    I think that @ncoghlan's idea about a module level os.reload_environment() function addresses most of concerns about os.environ.refresh(). But the discussion did not stop here, so not all see it so.

    Somebody need to put a period here. Either reimplement this feature as a module level function, or keep all as is, -- these are two most probable options.

  8. vstinner commented on Oct 25, 2024

    @vstinner
    MemberAuthor

    Python 3.14 alpha 1 was released with os.environ.refresh() method. What's the status of this issue?

  9. erlend-aasland commented on Oct 25, 2024

    @erlend-aasland
    Contributor

    Python 3.14 alpha 1 was released with os.environ.refresh() method. What's the status of this issue?

    You tell me; you created the issue :)

  10. vstinner commented on Oct 26, 2024

    @vstinner
    MemberAuthor

    I closed the issue, I'm not the one who reopened it.

  11. vstinner commented on Oct 29, 2024

    @vstinner
    MemberAuthor

    @serhiy-storchaka: What's the status of this issue?

  12. serhiy-storchaka commented on Oct 30, 2024

    @serhiy-storchaka
    Member

    You should ask @zooba, the author of the discussion. According to the results of the poll, the majority prefers a module level function. Voting is not binding, and not only core developers voted, but this should still be taken into account. I do not see a vote of @zooba. Is he satisfied with proposed variants and what does he propose?

  13. vstinner commented on Oct 30, 2024

    @vstinner
    MemberAuthor

    @zooba: What's the status of this issue?

  14. vstinner commented on Oct 30, 2024

    @vstinner
    MemberAuthor

    I would suggest to close the issue and keep the os.environ.refresh() method.

  15. WolfDWyc commented on Oct 30, 2024

    @WolfDWyc

    I think if reload_environment is preferred by more people we should go with that.

  16. zooba commented on Oct 30, 2024

    @zooba
    Member

    I posted on the discussion, but the majority liked the module-level function instead of putting it on the object, and I personally think reload_environ() is slightly more accurate than reload_environment(), since it is environ that is being reloaded. (There was no poll option for other module-level functions, so I'm assuming people liked os.reload... and disliked os.environ.....)

    So as much as anyone wants to keep me happy, os.reload_environ() is probably the best option. Documentation will have to deal with people who read the name and misunderstand what it's for, but that is basically documentation's job.

  17. serhiy-storchaka commented on Oct 31, 2024

    @serhiy-storchaka
    Member

    On other hand, it reloads the process environment to the os.environ and os.environb mappings.

  18. ncoghlan commented on Oct 31, 2024

    @ncoghlan
    Contributor

    I think @zooba's point was that this function doesn't reload the system wide environment variable settings into the running application process, which os.reload_environment() could be taken to mean.

    That misreading doesn't seem particularly likely to me though, and the fact this operation reloads both os.environ and os.environb (not just os.environ) makes me wary of the shorter os.reload_environ() name (it feels misleading to me in the same way that the os.environ.refresh() spelling is misleading).

  19. zooba commented on Oct 31, 2024

    @zooba
    Member

    I can't reasonably see os.reload_environ() implying that os.environb wouldn't also be reloaded. Certainly not as much as I can see someone thinking that os.reload_environment() implies something other than "os.environ will be reloaded".

    Whereas os.environ.refresh() could quite reasonably be assumed to have no impact on os.environb. So I think that's another argument in favour of the module-level function.

    Perhaps os.reload_environs() feels more comfortable for covering both os.environ and os.environb? I don't have a strong preference about the s. My main concern is still the same as at the start - this function doesn't impact the (generic) environment of the process at all, it only affects what is contained in Python's cache of the environment, otherwise known as os.environ.

  20. added a commit that references this issue on Nov 1, 2024
  21. vstinner commented on Nov 1, 2024

    @vstinner
    MemberAuthor

    I created PR gh-126268 to replace the os.environ.refresh() method with a new os.reload_environ() function.

    IMO reload_environ() is a good name since it reminds os.environ. I don't think that we should bother with the fact that os.environb is also reloaded to name the function. And reload_environment() is too long :-)

  22. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 1, 2024
  23. added a commit that references this issue on Nov 5, 2024
  24. changed the title [-]Add os.environ.refresh() method[/-] [+]Add os.reload_environ() function[/+] on Nov 5, 2024
  25. vstinner commented on Nov 5, 2024

    @vstinner
    MemberAuthor

    I created PR #126268 to replace the os.environ.refresh() method with a new os.reload_environ() function.

    Done: I merged the PR. I close the issue.

  26. added a commit that references this issue on Dec 8, 2024
  27. added a commit that references this issue on Jan 12, 2025
  28. added a commit that references this issue on Oct 29, 2025
  29. added a commit that references this issue on Oct 29, 2025
  30. added a commit that references this issue on Oct 29, 2025
  31. added a commit that references this issue on Dec 6, 2025
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

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions