GeezerVison is showing github.com — gh-88405: Use platform defined data directories instead of ~/.python_history by oxalica · Pull Request #26377 · python/cpython
Conversation
oxalica
commented
May 26, 2021
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
This patch use platform defined directories for put the history file.
For Windows, it's %APPDATA%/Python/history;
for Mac OS, it's ~/Library/Application Support/Python/history;
for other POSIX platforms, it's $XDG_STATE_HOME/python/history or ~/.local/state/python/history;
otherwise, fallback to ~/.python_history.
Also if ~/.python_history exists and is readable, it will always be used for compatibility.
https://bugs.python.org/issue44239
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lgarron, louisroyer, amarshall, perigoso, roadkell, arhadthedev, janlarres, vladh, Andriamanitra, serban, and 5 more reacted with thumbs up emoji
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This PR is stale because it has been open for 30 days with no activity.
How can I ask for review? I'm not sure whom to notify.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This PR is stale because it has been open for 30 days with no activity.
How can I ask for review? I'm not sure whom to notify.
Alright
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
.python_history probably belongs under $XDG_STATE_HOME on linux rather than $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, …)
Then again just getting it out of user root would be nice.
|
roadkell reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Changed to $XDG_STATE_HOME/python/history or ~/.local/state/python/history for *nix platform now.
|
SvartaHjarta reacted with heart emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Instead of you hard-coding a commonly used and often changed file-path like this, please consider using an internal built-in variable named something like DEFAULT_HISTORY_FILE. instead.
mentioned #13208
|
sant0s12 reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Any updates on this? Btw, please let MacOS users also set XDG_STATE_HOME. A lot of them use the XDG specification (and if they don't, then it's just the default location you already specified)
|
fionn reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Any chance for this to move forward?
|
arhadthedev and nicolas-graves reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
arhadthedev
changed the title
bpo-44239: Use platform defined data directories instead of ~/.python_history
gh-88405: Use platform defined data directories instead of ~/.python_history
Jun 5, 2023
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|