classification
Title: Use platform defined data directories instead of ~/.python_history
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: oxalica, python-dev
Priority: normal Keywords: patch

Created on 2021-05-26 10:58 by oxalica, last changed 2021-05-26 11:39 by python-dev.

Pull Requests
URL Status Linked Edit
PR 26377 open python-dev, 2021-05-26 11:39
Messages (1)
msg394429 - (view) Author: oxalica (oxalica) * Date: 2021-05-26 10:58
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.
History
Date User Action Args
2021-05-26 11:39:53python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request24969
stage: patch review
2021-05-26 10:58:43oxalicacreate