Coding 2021-02-12
I've got my pyenv plugin working about as well as it can. I wasn't able to do everything I wanted, because it turns out pyenv runs the relevant hook code after it performs some of the logic I wanted to mess with. So, that's unfortunate, but on the bright side, I was able to delete a bunch of code from my plugin because it wasn't doing anything.
The integration between pyenv and its plugins is really nice. Aside from my self-inflicted bash bugs, working on this was so enjoyable, it's kind of a shame I can't think of any other reason to write a pyenv plugin.
Oh yes, and it does work. Take a look:
↪ pyenv fallback
3.9.1
3.8.7
3.7.9
3.6.12
pypy3.7-7.3.3
↪ pypy
Python 3.7.9 (7e6e2bb30ac5, Nov 18 2020, 10:55:52)
Not the best example, I know, but I don't want to fiddle with my fallbacks now that I've got them working, aside from the fact that 3.8.7 is shadowed by the system Python. It'll probably be more impressive if I end up thinking of things that I want pyenv-implicit-style behavior for. Like, here's something that I want to install in a virtualenv, but run wherever. I've kind of moved away from that kind of thing for now, but now I have the option to move back.
And slightly more concretely, now I have the ability to write standalone scripts or shivs against Python versions besides 3.8, without hardcoding my home directory into the shebang.
Just to reiterate, this is different from pyenv-implicit because I control which environments it looks at. So, earlier versions don't shadow newer ones unless I want them to, and virtualenvs don't get considered unless I want them to be. I think it's worse, in terms of time complexity, but I don't think the difference is perceptible.
Anyway, I guess I'm working on something else next, because this is all set, near as I can tell.
Good night.