Skip to content
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

Switch from appdirs to platformdirs #10178

Closed
gaborbernat opened this issue Jul 20, 2021 · 9 comments · Fixed by #10202
Closed

Switch from appdirs to platformdirs #10178

gaborbernat opened this issue Jul 20, 2021 · 9 comments · Fixed by #10202

Comments

@gaborbernat
Copy link

We've forked appdirs under platformdirs https://github.com/platformdirs/platformdirs, is better maintain so I propose pip to switch part of its vendoring 👍

@DiddiLeija
Copy link
Member

So, do you want to vendor platformdirs instead of appdirs?

@gaborbernat
Copy link
Author

Yes that's my proposal.

@pradyunsg
Copy link
Member

None of the paths or APIs changed, right?

@gaborbernat
Copy link
Author

gaborbernat commented Jul 21, 2021

Yeah, fully backward compatible API-wise. We fixed some bugs, so paths might alter depending on what you're using, see https://github.com/platformdirs/platformdirs/blob/main/tests/test_comp_with_appdirs.py#L31-L32.

@uranusjr uranusjr added this to the 21.2 milestone Jul 21, 2021
@uranusjr
Copy link
Member

Tentitively adding this to 21.2 since I think this can be done as the vendor upgrade process.

@uranusjr
Copy link
Member

I took a look at the compatibility test. Pip does not use user_log_dir at all, and does not pass the version argument to site_config_dir. So I think we are covered? I'll work on a PR for this.

@uranusjr
Copy link
Member

Bad news, appdirs is used by pkg_resources, so we need to patch it. Not a showstopper, but it does mean the conversion would not be trivial. So I'm removing this from the 21.2 milestone to give it more time.

@uranusjr uranusjr removed this from the 21.2 milestone Jul 24, 2021
@domdfcoding
Copy link
Contributor

I have made a start on the switch, including patching pkg_resources (see domdfcoding@f6513eb).

I'm working on the tests now, but they're proving troublesome because the current monkeypatching approach doesn't work with platformdirs.

@uranusjr
Copy link
Member

One way we could make it work is to make all appdirs/platformdirs calls go through the pip._internals.utils wrapper, so we can just monkeypatch that module instead.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants