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

Remove deprecated support for VCS pseudo URLs #9436

Merged
merged 5 commits into from
Jan 19, 2021
Merged

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Jan 9, 2021

This transforms the deprecation introduced in pip 20.0 into an error, simplifying the code and enabling easier reasoning about editable requirements (which are now guaranteed to be URLs or local directories).

In #7554, there was one user comment about the git+locadir#egg=... syntax which found a satisfactory alternative.

Closes #7554

@sbidoul sbidoul marked this pull request as ready for review January 9, 2021 20:41
@sbidoul sbidoul added this to the 21.0 milestone Jan 9, 2021
src/pip/_internal/req/constructors.py Outdated Show resolved Hide resolved
news/7554.removal.rst Outdated Show resolved Hide resolved
'(beginning with svn+, git+, hg+, or bzr+).'.format(editable_req)
f'{editable_req} is not a valid editable requirement. '
f'It should either be a path to a local project or a VCS URL '
f'(beginning with {backends}).'
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we should not simply show vcs.all_schemes directly.
Otherwise, we might crash on someone using git+ftp (or something else) and tell him to use a VCS URL beginning with git+ which is already the case.
Yes, it seems far fetched ^^

Copy link
Member Author

@sbidoul sbidoul Jan 14, 2021

Choose a reason for hiding this comment

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

Two possible issues with that are
1/ the list of all schemes is very long
2/ it still contains git, svn, etc (without +)

Regarding 2/, VCS schemes without + such as git:// are supported in editable mode only (see a few lines above), and I think it's not something we want to encourage. I suspect we could remove the schemes without + from all_schemes without changing behaviour, but I'm not 100% sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

@xavfernandez I've double checked and I don't see a reason for having the schemes without + in the list of all VCS schemes. So I removed them and did as you suggested to show the full list of supported schemes in the error message.

@@ -26,7 +26,7 @@ class Bazaar(VersionControl):
repo_name = 'branch'
schemes = (
'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp',
'bzr+lp',
'bzr+lp', 'bzr+file'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'bzr+lp', 'bzr+file'
'bzr+lp', 'bzr+file',

Copy link
Member Author

Choose a reason for hiding this comment

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

done

sbidoul and others added 5 commits January 18, 2021 09:08
Now that we don't need to support git@
pseudo-urls, we can simplify the test for
valid VCS URLs based on link.is_vcs, which
is turns is based on the URL scheme.

This also means we fail earlier if a git@ pseudo
URL is used.

Since VCS requirements are not validated to be URLs
in Requirement constructors, we can simplify update_editable.
Co-authored-by: Xavier Fernandez <[email protected]>
These schemes without + are support in an ad-hoc fashion in
parse_editable_requirement.
When an editable requirement is neither a local directory nor
a URL with a supported VCS scheme, we show the full list
of supported VCS schemes in the error message.
@sbidoul sbidoul merged commit 8de9edf into pypa:master Jan 19, 2021
@sbidoul sbidoul deleted the vcs-url-sbi branch January 19, 2021 10:07
@sbidoul
Copy link
Member Author

sbidoul commented Jan 19, 2021

Thanks for the reviews @xavfernandez and @uranusjr.

aalexanderr added a commit to aalexanderr/fetchcode that referenced this pull request Aug 23, 2021
WARNING: fetchcode's vcs will not work on this commit.
This is result of separating pip's code from changes made in scope of
this repository.

This should make it easier to track potentially replicated issues from
pip when taking their vcs pkg.

It also made cleaning up easier, due to some maintenance activities done
in pip:
- dropping Python 2 & 3.5 support
  pypa/pip#9189
- modernized code after above - partially done, tracked in:
  pypa/pip#8802
- added py3.9 support
- updated vendored libraries (e.g. fixing CVE-2021-28363)
  multiple PRs

pip._internal.vcs (and related code) changes:
- Fetch resources that are missing locally:
  pypa/pip#8817
- Improve SVN version parser (Windows)
  pypa/pip#8665
- Always close stderr after subprocess completion:
  pypa/pip#9156
- Remove vcs export feature:
  pypa/pip#9713
- Remove support for git+ssh@ scheme in favour of git+ssh://
  pypa/pip#9436
- Security fix in git tags parsing (CVE-2021-3572):
  pypa/pip#9827
- Reimplement Git version parsing:
  pypa/pip#10117

In next commits, most of pip's internals will be removed from fetchcode,
leaving only vcs module with supporting code (like utils functions,
tests (which will be added & submitted with this change))

This will allow for changes such as ability to add return codes
(probably via futures) from long running downloads and other features.

Switching to having own vcs module might also be a good call due to
pip._internal.vcs close integration with pip's cli in vcs module (some
pip code has been commented out in commit mentioned below)

While generally copy-pasting code without history is bad idea, this
commit follows precedence set in this repo by:
8046215
with exception that all changes to pip's code will be submitted as separate
commits.

It has been agreed with @pombredanne & @TG1999 that history from pip
will be rebased on fetchcode by @pombredanne (thanks!). It will be done
only for the files that are of concern for fetchcode to limit noise in
git history.

I'm leaving this commit without SoB intentionally, as this is not my
work, but that of the many pip's authors:
https://github.com/pypa/pip/blob/21.2.4/AUTHORS.txt
License of pip: MIT (https://pypi.org/project/pip/)
aalexanderr added a commit to aalexanderr/fetchcode that referenced this pull request Oct 1, 2021
Please note that fetchcode's vcs might not work on this branch.
Initially pip was commited without it's history and with few changes
applied. This update approaches this differently- by commiting pip code
in a single commit & applying changes on top of it in separate commits.
While much of pip's code will be stripped from this repository,
the goal of this is to make it easier to take changes from upstream,
even after the code will be modified.
While git-subtree could be used it brings it's own set of issues.

Update should make it easier to track potentially replicated issues from
pip when taking their vcs pkg.

It also made cleaning up easier, due to some maintenance activities done
in pip:
- dropping Python 2 & 3.5 support
  pypa/pip#9189
- modernized code after above - partially done, tracked in:
  pypa/pip#8802
- added py3.9 support
- updated vendored libraries (e.g. fixing CVE-2021-28363)
  multiple PRs

pip._internal.vcs (and related code) changes between
20.1.1 and 21.2.4
- Fetch resources that are missing locally:
  pypa/pip#8817
- Improve SVN version parser (Windows)
  pypa/pip#8665
- Always close stderr after subprocess completion:
  pypa/pip#9156
- Remove vcs export feature:
  pypa/pip#9713
- Remove support for git+ssh@ scheme in favour of git+ssh://
  pypa/pip#9436
- Security fix in git tags parsing (CVE-2021-3572):
  pypa/pip#9827
- Reimplement Git version parsing:
  pypa/pip#10117

In next commits, most of pip's internals will be removed from fetchcode,
leaving only vcs module with supporting code (like utils functions,
tests (which will be submitted alongside this change))

This will allow for changes such as ability to add return codes
(probably via futures) from long running downloads and other features.

Switching to having own vcs module might also be a good call due to
pip._internal.vcs integration with pip's cli in vcs module (some
pip code has been commented out in commit mentioned below)

While generally copy-pasting code (rather than using
submodules/subtrees etc) makes it harder to track, my git-foo is not great
enough for me to attempt regrafting subset of pips history that is of
note from fetchcode perspective.
It has been agreed with @pombredanne & @TG1999 that history from pip
will be regrafted on fetchcode by @pombredanne (thanks!). It will be done
only for the files that are of concern for fetchcode to limit noise in
git history.

The code submitted in scope of this commit is work of many pip's authors
that can bee seen here:
https://github.com/pypa/pip/blob/21.2.4/AUTHORS.txt

Pip is licensed under MIT (https://pypi.org/project/pip/)

Signed-off-by: Alexander Mazuruk <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing support for git+git@ VCS requirement scheme
3 participants