Skip to content

Use req @ url syntax to install from remote VCS#1207

Merged
pradyunsg merged 1 commit intopypa:mainfrom
matthewfeickert:fix/use-req-url-syntax
Feb 13, 2023
Merged

Use req @ url syntax to install from remote VCS#1207
pradyunsg merged 1 commit intopypa:mainfrom
matthewfeickert:fix/use-req-url-syntax

Conversation

@matthewfeickert
Copy link
Copy Markdown
Contributor

@matthewfeickert matthewfeickert commented Feb 11, 2023

Use 'req @ url' syntax when using pip to install from a remote git repository over 'url#egg=req' to avoid the use of #egg= fragments with a non-PEP 508 name. This will be required in pip v25.0+.

@matthewfeickert
Copy link
Copy Markdown
Contributor Author

This is ready for review. Let me know if you have any questions. 👍

cc @pradyunsg @pfmoore given their involvement in pypa/pip#11617

Copy link
Copy Markdown
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

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

Could you add whitespace around @? IMO that makes it clearer and easier to read.

* Use 'req @ url' syntax when using pip to install from a remote git
  repository over 'url#egg=req' to avoid the use of #egg= fragments
  with a non-PEP 508 name. This will be required in pip v25.0+.
   - c.f. pypa/pip#11617 for more details.
@matthewfeickert
Copy link
Copy Markdown
Contributor Author

Could you add whitespace around @? IMO that makes it clearer and easier to read.

Sure. I applied that universally, rebased, and force-with-lease pushed back.

@matthewfeickert matthewfeickert changed the title fix: Use 'req@url' syntax to install from remote VCS fix: Use 'req @ url' syntax to install from remote VCS Feb 13, 2023
@pradyunsg pradyunsg changed the title fix: Use 'req @ url' syntax to install from remote VCS Use req @ url syntax to install from remote VCS Feb 13, 2023
@pradyunsg pradyunsg merged commit d36954f into pypa:main Feb 13, 2023
@matthewfeickert matthewfeickert deleted the fix/use-req-url-syntax branch February 13, 2023 13:06
@sinoroc
Copy link
Copy Markdown
Contributor

sinoroc commented Feb 14, 2023

There are issues with sub-directories.

pip install "git+https://example.com/repo/app.git#egg=app&subdirectory=setup

was transformed into

pip install "app&subdirectory=setup @ git+https://example.com/repo/app.git"

which does not seem correct to me. Is it?

@matthewfeickert
Copy link
Copy Markdown
Contributor Author

matthewfeickert commented Feb 14, 2023

@sinoroc do you have a failing example?

@pradyunsg you were BDFL-Delegate for PEP 610 so maybe you can comment more here.

@sinoroc
Copy link
Copy Markdown
Contributor

sinoroc commented Feb 14, 2023

I might be wrong, but I do not think it has anything to do with "PEP 610 – Recording the Direct URL Origin of installed distributions". The issue is that this is not a valid requirement notation for the pip CLI.

The best I can find is this section of pip's documentation on "URL fragments" in "VCS Support" which lists two accepted notations for VCS with subdirectory:

  • python -m pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"
  • python -m pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"

@matthewfeickert
Copy link
Copy Markdown
Contributor Author

Thanks @sinoroc. Indeed it looks like

python -m pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"

is what should have been done. I'll open up a fix PR with this correction once I've finished making coffee.

matthewfeickert added a commit to matthewfeickert/packaging.python.org that referenced this pull request Feb 14, 2023
* Use the correct syntax for url fragments with pip of the form
  python -m pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"
   - c.f. https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments
* Revises PR pypa#1207

Co-authored-by: sinoroc <sinoroc.code+git@gmail.com>
pradyunsg pushed a commit that referenced this pull request Feb 14, 2023
* Use the correct syntax for url fragments with pip of the form
  python -m pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"
   - c.f. https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments
* Revises PR #1207

Co-authored-by: sinoroc <sinoroc.code+git@gmail.com>
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