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

Windows Instruction for PipX #278

Closed
wants to merge 6 commits into from
Closed

Windows Instruction for PipX #278

wants to merge 6 commits into from

Conversation

Vaunty
Copy link

@Vaunty Vaunty commented May 20, 2024

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.

@Vaunty Vaunty marked this pull request as draft May 20, 2024 21:06
@Vaunty Vaunty marked this pull request as ready for review May 20, 2024 21:07
@lwasser
Copy link
Member

lwasser commented May 31, 2024

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

Copy link
Contributor

@lwasser

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

@lwasser
Copy link
Member

lwasser commented May 31, 2024

@pre-commit autofix

@lwasser
Copy link
Member

lwasser commented May 31, 2024

pre-commit.ci autofix

@willingc
Copy link
Collaborator

willingc commented Jun 5, 2024

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 😄

@lwasser
Copy link
Member

lwasser commented Jun 5, 2024

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
Copy link
Collaborator

ucodery commented Jun 7, 2024

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:

  • I always advocate for doing everything with pip in a venv, however PyOS went with pipx for some cases and it is probably more beginner friendly
  • we need pipx for other things than hatch and the easier to explain and get started with a tool installer is, the quicker we can get on to the meat of the guide
  • hatch could replace pipx's role, but it would add a lot of cognitive complexity and a lot of repetition on users' machines

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
Copy link
Contributor

ofek commented Jun 7, 2024

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
Copy link
Collaborator

ucodery commented Jun 7, 2024

@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
Copy link
Member

lwasser commented Jun 7, 2024

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!

If Python is not installed, dont be alarmed!
[Download Python Here](https://www.python.org/downloads/)

* Step 2: Using the "curl" command install Pip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get-pip is a great bootstrapping tool for packaging, but unless the user is forced to use a very old version of Python I would strongly recommend python -m ensurepip instead which is part of the base language.

I guess I don't use Windows enough to know if there are any corner cases ensurepip won't work and get-pip would

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong, but I believe you're referencing Lines 26 to 32! If so, I can happily replace the dated 'get-pip' with 'python -m ensurepip'. That said, I would like to note that I was using the most recent version of Python at the time. Apologies for the tardy reply!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, I don't know why I had so many lines highlighted. get-pip will work with any python version, it's just more roundabout that using the module provided with base Python. Thanks for the update.

replaced bootstrap command with native 'python -m ensurepip' command
@lwasser
Copy link
Member

lwasser commented Jul 3, 2024

hi everyone. i'm checking in here on this issue. We just merged another PR that has users install hatch from the installers rather than using pipx. At the same time - i think there is some good information here that we could still use for people that want to use pipx. i'm curious what you all think - @ucodery ?

what i'm thinking is we merge this pr as is. Then we turn it into a dropdown help tip for people who want to use pipx. that way it's not the main way to install things but an option that is hidden at first but that can be opened to learn more.

Copy link
Collaborator

@ucodery ucodery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lwasser this PR need a rebase as #308 was editing the same section. And seeing that both PRs are changing the hatch install instructions, but go in different directions, I don't think there is anything left get from doing the work of a rebase.

@lwasser
Copy link
Member

lwasser commented Jul 12, 2024

ok thank you @ucodery let's close this. @Vaunty i REALLY appreciate your help at the sprint at pycon!! we are going to close this now that we have installers that make this process of installing hatch much easier!! Best of luck to you in your degree AND please keep in touch!!

@lwasser lwasser closed this Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[UX] Clarification: 'pipx' command not found - Installation required in Windows OS
5 participants