asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

Don't complain if a patch file doesn't exist for a particular version of python #134

Closed jfly closed 2 years ago

jfly commented 2 years ago

I hope this isn't too controversial: I personally have this ASDF_PYTHON_PATCHES_DIRECTORY globally set up on my machine, which is super useful when I install/reinstall random versions of Python, but is kind of annoying when I try to install versions of python that don't actually need a patch: I have to create an empty file just to get it to install.

With this change, I don't have to do that: instead I only have to create .patch files for the versions of Python that need it.

jfly commented 2 years ago

Bump! How do you feel about this, @danhper?

danhper commented 2 years ago

Hi! I feel like this is slightly hacky for no good reason. I think that simply prepending the command by env -u ASDF_PYTHON_PATCHES_DIRECTORY should do the job. Or am I missing something?

jfly commented 2 years ago

Thanks for the reply! You are correct that prepending with env -u ASDF_PYTHON_PATCHES_DIRECTORY is one way to work around this issue, and I would understand if you choose to reject this PR.

Let me try to explain my thinking: I'm trying to get my projects into a state where their dependencies are captured in a .tool-versions file that asdf understands, with my end goal being that I can reformat my laptop and get working again with nothing more than a git clone and an asdf install. I'm achieving that goal right now by creating various empty patch files (example), but I'd love to not have to create those in the first place. The env -u approach you suggest doesn't quite achieve my goals because it requires me to sometimes run asdf install and sometimes run env -u ASDF_PYTHON_PATCHES_DIRECTORY asdf install, which seems needlessly annoying.

danhper commented 2 years ago

Sorry for the massive delay. I think that makes sense indeed, thanks for the PR

jfly commented 2 years ago

Thanks, @danhper. I sure appreciate it!