Skip to content

Use platform defined data directories instead of ~/.python_history #88405

Open

Description

@oxalica
mannequin
BPO 44239
Nosy @oxalica
PRs
  • gh-88405: Use platform defined data directories instead of ~/.python_history #26377
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-05-26.10:58:43.729>
    labels = ['type-feature', 'library', '3.11']
    title = 'Use platform defined data directories instead of ~/.python_history'
    updated_at = <Date 2021-05-26.11:39:53.868>
    user = 'https://github.com/oxalica'

    bugs.python.org fields:

    activity = <Date 2021-05-26.11:39:53.868>
    actor = 'python-dev'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-05-26.10:58:43.729>
    creator = 'oxalica'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44239
    keywords = ['patch']
    message_count = 1.0
    messages = ['394429']
    nosy_count = 2.0
    nosy_names = ['python-dev', 'oxalica']
    pr_nums = ['26377']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44239'
    versions = ['Python 3.11']

    Activity

    1. oxalica commented on May 26, 2021

      oxalicamannequin
      MannequinAuthor

      Currently we use path ~/.python_history for history file in all platforms.
      It is not a good choice since it spams in user's home directory.

      There are already specifications for where to store program data.
      For Windows, we should use %APPDATA%/Python/history;
      for Mac OS, we should use ~/Library/Application Support/Python/history;
      for other POSIX platforms, we should use $XDG_DATA_HOME/python/history or ~/.local/share/python/history according to XDG Spec.

      These paths should be preferred as default. But we can also check and use ~/.python_history if it exists and readable, for compatibility.

    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on May 26, 2021
    3. transferred this issue fromon Apr 10, 2022
    4. Ige-fi commented on May 27, 2022

      @Ige-fi

      for other POSIX platforms, we should use $XDG_DATA_HOME/python/history or ~/.local/share/python/history according to XDG Spec.

      The specification actually received an amendment on the very month this message was originally posted. It now additionally specifies $XDG_STATE_HOME, which should be the way to go here instead of $XDG_DATA_HOME:

      The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

      • actions history (logs, history, recently used files, …)
      • current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
    5. added
      3.13only security fixes
      and removed
      3.11only security fixes
      on Jun 5, 2023
    6. hauntsaninja commented on Jan 7, 2024

      @hauntsaninja
      Contributor

      Note that we merged #73965 , so the location of this file can now be controlled by PYTHON_HISTORY

    7. deleted a comment from on Jan 7, 2024
    8. locked as spam and limited conversation to collaborators on Jan 7, 2024
    9. deleted a comment from on Jan 7, 2024
    10. deleted a comment from on Jan 7, 2024
    11. deleted a comment from on Jan 7, 2024
    12. unlocked this conversation on Jan 7, 2024
    13. returnDanilo commented on May 14, 2024

      @returnDanilo

      If this is ever to be merged, maybe you could add something about pdb's ~/.pdbrc file? ;)

    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

      3.13only security fixesstdlibStandard 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