pyOpenSci / python-package-guide

scientific Python package recommendations & guidance curated by pyOpenSci
https://www.pyopensci.org/python-package-guide/
Other
70 stars 43 forks source link

Windows Instruction for PipX #278

Open Vaunty opened 1 month ago

Vaunty commented 1 month ago

closes #265 https://www.pyopensci.org/python-package-guide/tutorials/get-to-know-hatch.html "Get to know hatch" tutorial's first step on a Windows system caused problems for me. So, here's how I fixed that.

lwasser commented 1 month ago

@all-contributors please add @Vaunty for code, review

allcontributors[bot] commented 1 month ago

@lwasser

I've put up a pull request to add @Vaunty! :tada:

lwasser commented 1 month ago

@pre-commit autofix

lwasser commented 1 month ago

pre-commit.ci autofix

willingc commented 3 weeks ago

Thanks @Vaunty for the PR. I've corrected the typo and CI is now running green.

@lwasser @ucodery Please give this a look. I wasn't sure if we still wished to recommend pipx since hatch has improved their install experience.

Whatever is decided about this PR, we are grateful that @Vaunty took the time to write up this PR :smile:

lwasser commented 3 weeks ago

oops - @willingc i see that you've seen this. i'm sorry! i left you a note on another issue about it. i haven't looked closely at the hatch installers. but if that is the easiest way to go we should update the lessons to suggest that route -- BUT get windows users to test it first.

Then we can leave a note in the docs about the other ways to install linking to @ofek documentation on installing hatch. @ucodery do you have any opinion by chance?

i myself don't yet have a windows instance to test but i thought about making one - there is a windows non profit license i think!

ucodery commented 3 weeks ago

Hmmmm, it does appear that Hatch has installers for Mac and Windows which is nice, but not for Linux (there are prebuilt binaries, but this is not a great install journey - it's the same as download.python.org basically). My personal strategy is to always install python software in the virtualenv I am doing all my package development work in. That keeps the install story the same between all three platforms, and stays away from system global installs which can get confusing even when they're not sharing environments with other global tools. It is also my personal preference to not use pipx, but IIRC the PyOS consensus was pro-pipx. If it was only a question of using a Hatch gui installer or using pipx gui installer and then pipx installing hatch, I think it could make sense to skip pipx and go straight to Hatch. But the issue is that hatch is not the one and only tool we might want to recommend be installed for all projects. Other software commonly installed with pipx: black, mypy, ipython, pipdeptree and for any of these other tools we would have to again answer the question of how users should install them; probably with pipx, but now hatch is the odd one out.

A slightly different strategy for future tools is to recommend anything needed in a tutorial be installed using hatch envs. This would leverage hatch as a replacement for pipx, but it's not such a straightforward switch. Hatch can manage any number of envs and keep them isolated, but adopting this means we would have to teach hatch environment management, and how and when to switch envs before getting readers a win by installing a tool they need. Also Hatch is still a per-project environment management tool, nothing global. So each project could have a mypy env that isolates that tool from the project itself, but when moving to a new project that env would have to be copied over every time (in both config and the creation of a new virtual environment behind the scenes).

my summay:

So we should probably get the pipx getting started guide rock solid and also give it its own page that can be linked to each time we reference it in a guide.

ofek commented 3 weeks ago

But the issue is that hatch is not the one and only tool we might want to recommend be installed for all projects

After I get finished with workspaces I'm going to add a top level command group that is basically like pipx e.g. hatch pipx but not called that.

ucodery commented 3 weeks ago

@ofek I didn't realize it was you that inherited Guido's crystal ball 😆 seems like you are always half a release away from a new feature that will greatly simplify guides like this!

lwasser commented 3 weeks ago

this is amazing. so @ucodery i'm just now reading your comments after just going through the other pipx issues (we had a lot of them!). it seems to me that installing pipx is really painful. i agree with your sentiment BUT i don't think the installation process is worth it right now. the other thing is hatch installs python for you if you don't have it. so a totally new user could install hatch + python will get installed and be up and running. i didn't even know about the pipx like functionality!! wow!

i just opened this issue #301 i'm leaning towards the installers but i do want your input ucodery after reading that comment above that was super thoughtful and very much true. so i'm open to discussing this more. BUT it seems like the thing that is left here is to figure out how to best install hatch on linux? is that true? i always forget that even tho mac is linux-esk it's a totally different installation path. could you comment on #301 around the linux piece - we might now want to implement this update until we know we have a sound linux solution too! i will ping you and ofek there now if you don't mind. i feel like we are close to a solution!