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

Add pipx install github pull request support #812

Open
glensc opened this issue Feb 14, 2022 · 12 comments
Open

Add pipx install github pull request support #812

glensc opened this issue Feb 14, 2022 · 12 comments
Labels
docs good first issue Good for newcomers

Comments

@glensc
Copy link

glensc commented Feb 14, 2022

How would this feature be useful?

pipx is for end users. end users typically don't understand how to figure out repo and branch of a pull request

Describe the solution you'd like

pipx install https://github.com/pypa/pipx/pull/794

Describe alternatives you've considered

The alternative, the current is to:

  1. open pr
  2. figure out source repo
  3. figure out branch name
  4. build git+https url
  5. pipx install that url

and even advanced users have trouble doing that:

pipx install git+https://github.com/meowmeowmeowcat/pipx@fix-#781

oh, glad I picked that example. some shells may need to deal with escapes, like # for UNIX, ^ for windows

also, once the PR is merged, and the branch deleted the branch name option won't work, would need to use git hash of the last commit or merge commit.

for initial implementation having support for open PR's would be already big step forward.

@cs01
Copy link
Member

cs01 commented Feb 16, 2022

Why would an end user want to install from a pull request? This seems like an exceedingly rare use case.

@glensc
Copy link
Author

glensc commented Feb 16, 2022

developer: can you test this fix from this pull request?
user: ??????

@tony
Copy link

tony commented Mar 14, 2022

Why would an end user want to install from a pull request? This seems like an exceedingly rare use case.

@cs01 This would be incredibly helpful. Here's an example:

python-poetry/poetry#4852 (comment)

Install with pipx:

pip install pipx
pipx install --suffix=@pyenv 'poetry @ git+https://github.com/finswimmer/poetry.git@proof-of-concept-pyenv'
poetry@pyenv --version

When there's an bug or improvement, this can be used to get the users in the issue to test the pull request easily.

This saves a ton of effort. gh pr checkout has a similar utility.

I'm stunned this doesn't already exist. 🤷 I'm fine with doing it manually in the mean time by hand, but when reviewing lots of PRs this would save time.

Edit: NPM / yarn has a convention for this at https://stackoverflow.com/a/36743127/1396928

@glensc
Copy link
Author

glensc commented Mar 14, 2022

The pull/ID/head is not npm specific, it's just a git ref, however it does not work:

WARNING: Did not find branch or tag 'pull/838/head', assuming revision or ref.

Perhaps that is the first thing to resolve.

➜ pipx install --suffix=@pr 'git+https://github.com/Taxel/PlexTraktSync@pull/838/head'
⣟ determining package name from 'git+https://github.com/Taxel/PlexTraktSync@pull/838/head'
  WARNING: Did not find branch or tag 'pull/838/head', assuming revision or ref.
  error: subprocess-exited-with-error

  × git checkout -q pull/838/head did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error: pathspec 'pull/838/head' did not match any file(s) known to git
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git checkout -q pull/838/head did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Cannot determine package name from spec 'git+https://github.com/Taxel/PlexTraktSync@pull/838/head'. Check package
spec for errors.

@glensc
Copy link
Author

glensc commented Mar 14, 2022

Update: This usage works:

➜ pipx install --suffix=@pr 'git+https://github.com/Taxel/PlexTraktSync@refs/pull/838/head'
  installed package PlexTraktSync 0.18.0.dev0 (PlexTraktSync@pr), installed using Python 3.10.2
  These apps are now globally available
    - plextraktsync@pr
done! ✨ 🌟 ✨

But projects need to be installable from git branch:

@tony
Copy link

tony commented Mar 14, 2022

@glensc Perhaps make a PR to add it to README / docs and see what the feedback is? I think others would find it helpful

@ThisNekoGuy
Copy link

As a user myself, I'm a bit confused why I can't just run something like:

pipx install git+https://github.com/simons-public/protonfixes

when doing it with pip3 would normally be enough otherwise :/

@dukecat0 dukecat0 added the docs label Mar 8, 2023
@dukecat0 dukecat0 added the good first issue Good for newcomers label Jul 3, 2023
@glensc
Copy link
Author

glensc commented Jan 24, 2024

@gaborbernat your last message is truncated (or not formatted properly)

this is what I see

image

@gaborbernat gaborbernat reopened this Jan 24, 2024
@gaborbernat
Copy link
Contributor

While this is doable, would require us integrating against the GitHub API, which makes me nervous because then tomorrow a GitLab user would show up, and where would that end? As such, I'm currently -0.1 on doing this.

As a user myself, I'm a bit confused why I can't just run something like:

pipx install git+https://github.com/simons-public/protonfixes

This works and is not Git server dependent.

@glensc
Copy link
Author

glensc commented Jan 24, 2024

What I see what needs to be done here is to document this experience:

and by "But projects need to be installable from git branch" I mean that I needed to make changes in code not to rely on CI part that generated version, i.e. version would have some default.

@glensc
Copy link
Author

glensc commented Jan 24, 2024

i also found need to use --force flag to be able to reinstall from same pr, if it had new commits. so maybe pipx side could improve that it can detect that automatically. it does save some repo metadata, so if that changes, allow reinstall without force warning?

glensc added a commit to glensc/python-pytrakt that referenced this issue Jan 24, 2024
Currently not installable from source because version "Uknown" does not parse.

Refs:
- pypa/pipx#812 (comment)
@glensc
Copy link
Author

glensc commented Jan 24, 2024

here's more minimal changes needed to be able to install from source:

it relied CI to fill __version__, so that was not installable, so used value in source repo that would also be a valid version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants