GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@oxalica oxalica commented May 26, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

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

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
All reactions
  • 👍 15 reactions
@the-knights-who-say-ni

This comment was marked as resolved.

Sign in to view
@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label May 26, 2021
@bedevere-bot bedevere-bot added the awaiting review label May 26, 2021
@Ayushparikh-code

This comment was marked as resolved.

Sign in to view
@the-knights-who-say-ni the-knights-who-say-ni added CLA signed and removed CLA not signed labels May 27, 2021
@oxalica

This comment was marked as resolved.

Sign in to view
@Ayushparikh-code

This comment was marked as resolved.

Sign in to view
@github-actions

github-actions Bot commented Jun 28, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 28, 2021
@oxalica

oxalica commented Jun 28, 2021

Copy link
Copy Markdown
Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Ayushparikh-code

Ayushparikh-code commented Jun 28, 2021

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 29, 2021
@SvartaHjarta

SvartaHjarta commented Sep 23, 2021

Copy link
Copy Markdown

.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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@oxalica
bpo-44239: Use platform defined data directories instead of ~/.python…
dc505f9
…_history
@oxalica
oxalica force-pushed the fix/xdg-history-path branch from f4758ed to dc505f9 Compare September 24, 2021 18:42
@oxalica

oxalica commented Sep 24, 2021

Copy link
Copy Markdown
Author

Changed to $XDG_STATE_HOME/python/history or ~/.local/state/python/history for *nix platform now.

SvartaHjarta reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eabase

eabase commented Jan 24, 2022

Copy link
Copy Markdown

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eabase eabase mentioned this pull request Jan 24, 2022
2 different history filenames, which is right?- Probably neither pyreadline3/pyreadline3#4
Open
@oxalica oxalica mannequin mentioned this pull request May 27, 2022
Use platform defined data directories instead of ~/.python_history #88405
Open
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@yochem

yochem commented Jan 11, 2023

Copy link
Copy Markdown

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MestreLion

MestreLion commented Jun 5, 2023

Copy link
Copy Markdown

Any chance for this to move forward?

arhadthedev and nicolas-graves reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev 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
@arhadthedev
Merge branch 'main' into fix/xdg-history-path
1d5fd6e
arhadthedev
arhadthedev reviewed Jun 5, 2023
View reviewed changes
Comment thread Doc/library/site.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev
3.11 -> 3.13
9240a0b
arhadthedev
arhadthedev reviewed Jun 5, 2023
View reviewed changes
Comment thread Doc/library/site.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev
Fix the Check Documentation failed check
dbb6ccd
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@arhadthedev arhadthedev arhadthedev left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

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.

10 participants

@oxalica @the-knights-who-say-ni @Ayushparikh-code @SvartaHjarta @eabase @yochem @MestreLion @arhadthedev @ezio-melotti @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.