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

Feature: Add install from pull request instructions #838

Merged
merged 6 commits into from
Aug 4, 2022
Merged

Conversation

glensc
Copy link
Collaborator

@glensc glensc commented Mar 14, 2022

See pypa/pipx#812 (comment)

Usage:

Install code from Pull request

Replace 838 with a pull request you intend to install

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

You can also use a convenience wrapper (this requires you install plextraktsync with pipx first):

$ plextraktsync self-update --pr 838

@glensc glensc self-assigned this Mar 14, 2022
@glensc
Copy link
Collaborator Author

glensc commented Mar 14, 2022

@tony saw your comment. can you help out?

This project isn't installable even when using an existing tag or branch:

$ pipx install --suffix=@pr git+https://github.com/Taxel/PlexTraktSync@0.18.21
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [56 lines of output]
      Traceback (most recent call last):
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__
          req = REQUIREMENT.parseString(requirement_string)
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
          raise exc
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
          loc, tokens = self._parse( instring, 0 )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
          loc,tokens = self.parseImpl( instring, preloc, doActions )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
          loc, exprtokens = e._parse( instring, loc, doActions )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
          loc,tokens = self.parseImpl( instring, preloc, doActions )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
          return self.expr._parse( instring, loc, doActions, callPreParse=False )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
          loc,tokens = self.parseImpl( instring, preloc, doActions )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
          loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
          loc,tokens = self.parseImpl( instring, preloc, doActions )
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/pyparsing.py", line 2711, in parseImpl
          raise ParseException(instring, loc, self.errmsg, self)
      pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/glen/.local/pipx/shared/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 1, in <module>
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 122, in setup
          dist.parse_config_files()
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/declarative_requirements/integration.py", line 104, in wrapper
          dist._finalize_requires()
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 546, in _finalize_requires
          self._move_install_requirements_markers()
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 585, in _move_install_requirements_markers
          inst_reqs = list(_reqs.parse(spec_inst_reqs))
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3089, in __init__
          super(Requirement, self).__init__(requirement_string)
        File "/private/var/folders/jm/_gwj2_bj37g_qc4pj1xvk6fw0000gp/T/pip-build-env-oqa9xf46/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 104, in __init__
          raise InvalidRequirement(
      pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'-i https'": Expected W:(abcd...)
      [end of output]

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

× Getting requirements to build wheel 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@0.18.21'. Check package spec for
errors.

what could be missing/wrong? and how to solve?

@glensc
Copy link
Collaborator Author

glensc commented Mar 14, 2022

Removed temporarily the -i: ca31725. removing it will likely break dependabot, so it can be only temporary.

but now next problem:

➜ pipx install --suffix=@pr 'git+https://github.com/Taxel/PlexTraktSync@pipx-installab
le'
  WARNING: Built wheel for PlexTraktSync is invalid: Metadata 1.2 mandates PEP 440 version, but '0.18.x' is not
ERROR: Could not build wheels for PlexTraktSync, which is required to install pyproject.toml-based projects
Cannot determine package name from spec 'git+https://github.com/Taxel/PlexTraktSync@pipx-installable'. Check package
spec for errors.

@glensc glensc force-pushed the pipx-installable branch from 47a14ec to f2ff9a8 Compare March 14, 2022 12:18
@glensc
Copy link
Collaborator Author

glensc commented Mar 14, 2022

Ok, now can install from branch:

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

@tony
Copy link

tony commented Mar 26, 2022

If you got it working that's excellent @glensc. That was the first time I've customized the command

@simonc56
Copy link
Collaborator

simonc56 commented Aug 2, 2022

Can this PR be merged ?

What does it mean :

projects need to be installable from git branch

@glensc
Copy link
Collaborator Author

glensc commented Aug 2, 2022

it's not complete, currently contains a hack that should not be merged:

for it, a fix is proposed, but not merged:

@glensc glensc force-pushed the pipx-installable branch from 979584b to 2e20f6d Compare August 4, 2022 11:18
@glensc glensc marked this pull request as ready for review August 4, 2022 11:19
@glensc
Copy link
Collaborator Author

glensc commented Aug 4, 2022

Added plextraktsync self-update --pr 838 usage as well:

✖  plextraktsync self-update --pr 838
Updating PlexTraktSync to the pull request #838 version using pipx
⣻ determining package name from 'git+https://github.com/Taxel/PlexTraktSync@refs/pull/838/head'
Installing to existing venv 'PlexTraktSync@838'
⣟ installing PlexTraktSync from spec 'git+https://github.com/Taxel/PlexTraktSync@refs/pull/838/head'
  installed package PlexTraktSync 0.20.0.dev0 (PlexTraktSync@838), installed using Python 3.10.5
  These apps are now globally available
    - plextraktsync@838
done! ✨ 🌟 ✨

@glensc glensc changed the title Add install from pull request instructions Feature: Add install from pull request instructions Aug 4, 2022
@glensc glensc merged commit 6950748 into main Aug 4, 2022
@glensc glensc deleted the pipx-installable branch August 4, 2022 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants