-
Notifications
You must be signed in to change notification settings - Fork 319
Use XDG basedir spec to pypirc #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not aware of other Python packaging tools that support XDG like this. If they do, then it makes sense for us to support this. But otherwise, this is going to cause confusion |
pip seems to follow the XDG spec: https://pip.pypa.io/en/stable/user_guide/#config-file. It looks like they vendor appdirs for that. It looks like another option is xdg. While I appreciate apps that do this, instead of cluttering my home directory, I'm not sure it's worth the added complexity in code and documentation to support |
I'm going to close this due to inactivity. We can reopen it if somebody wants to make a compelling argument for investing in this feature. |
@bhrutledge first for all sorry for big delay, I completely lost this issue. I think that the argument of this add complexity in code has no sense, the change is only four lines with backward compatibility: import os
# Obtain config file location following XDG spec
XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config'))
XDG_TWINE_CONFIG = os.path.join(XDG_CONFIG_HOME, 'pypi', 'pypirc')
# Check for old ~/.pypirc to add backward compatibility
OLD_TWINE_CONFIG = os.path.join(os.path.expanduser('~'),'.pypirc')
# Get config file, ~/.pypirc if exists else ~/.config/pypi/pypirc
TWINE_CONFIG = OLD_TWINE_CONFIG if os.path.isfile(OLD_TWINE_CONFIG) else XDG_TWINE_CONFIG
print(TWINE_CONFIG) I have no arguments other than to follow the XDG specification give order to your home directory, it makes backups easier, it's more clean and more and more softwares follow it. IMHO, the effort is worth it. UPDATE: Take note that |
That's because
In general, I would avoid suggesting that ideas make no sense; that's likely to put the person who had the idea on the defensive. I also think the suggested code might be an over-simplification, and doesn't take into account the current implementation.
Line 49 in 9d26a5f
Where Lines 231 to 235 in 4c9d8c1
Looking at that, I realize that twine does offer an alternative to storing That said, @ogarcia, if you're motivated to open a PR for this, I'd review it. But I can't promise that it will be merged. |
Sorry about this. English not is my primary lenguage and maybe can be rude.
Ok. Knowing that the config is defined in utils.py I think that I can do a PR 😉 |
Uh oh!
There was an error while loading. Please reload this page.
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
TL;DR Simply support that
pypirc
can reside in${XDG_CONFIG_HOME}/pypi/pypirc
. Something like this:The text was updated successfully, but these errors were encountered: