-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support Direct URL editable requirements #13495
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
Open
ichard26
wants to merge
1
commit into
pypa:main
Choose a base branch
from
ichard26:feat/direct-editables
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,25 @@ control system being used). It is used through URL prefixes: | |
- Subversion -- `svn+` | ||
- Bazaar -- `bzr+` | ||
|
||
The general form of a VCS requirement is `ProjectName @ VCS_URL`, e.g. | ||
|
||
```none | ||
MyProject @ git+https://git.example.com/MyProject | ||
MyProject[extra] @ git+https:/git.example.com/MyProject | ||
``` | ||
|
||
This is the Direct URL ({pep}`508`) requirement syntax. It is also permissible | ||
to remove `MyProject @` portion is removed and provide a bare VCS URL. | ||
|
||
```none | ||
git+https://git.example.com/MyProject | ||
``` | ||
|
||
This is a pip specific extension. This form can be used as long as pip does | ||
not need to know the project name in advance. pip is generally able to infer | ||
the project name except in the case of {ref}`editable-vcs-installs`. In | ||
addition, extras cannot be requested using a bare VCS URL. | ||
|
||
## Supported VCS | ||
|
||
### Git | ||
|
@@ -81,8 +100,8 @@ MyProject @ svn+ssh://[email protected]/MyProject | |
You can also give specific revisions to an SVN URL, like so: | ||
|
||
```none | ||
-e svn+http://svn.example.com/svn/MyProject/trunk@2019#egg=MyProject | ||
-e svn+http://svn.example.com/svn/MyProject/trunk@{20080101}#egg=MyProject | ||
-e MyProject @ svn+http://svn.example.com/svn/MyProject/trunk@2019 | ||
-e MyProject @ svn+http://svn.example.com/svn/MyProject/trunk@{20080101} | ||
``` | ||
|
||
Note that you need to use [Editable VCS installs](#editable-vcs-installs) for | ||
|
@@ -115,6 +134,9 @@ MyProject @ bzr+http://bzr.example.com/MyProject/[email protected] | |
VCS projects can be installed in {ref}`editable mode <editable-installs>` (using | ||
the {ref}`--editable <install_--editable>` option) or not. | ||
|
||
In editable mode, the project name must be provided upfront using the Direct URL | ||
(`MyProject @ URL`) form so pip can determine the VCS clone location. | ||
|
||
- The default clone location (for editable installs) is: | ||
|
||
- `<venv path>/src/SomeProject` in virtual environments | ||
|
@@ -133,15 +155,15 @@ take on the VCS requirement (not the commit itself). | |
## URL fragments | ||
|
||
pip looks at the `subdirectory` fragments of VCS URLs for specifying the path to the | ||
Python package, when it is not in the root of the VCS directory. eg: `pkg_dir`. | ||
Python package, when it is not in the root of the VCS directory. | ||
|
||
pip also looks at the `egg` fragment specifying the "project name". In practice the | ||
`egg` fragment is only required to help pip determine the VCS clone location in editable | ||
mode. In all other circumstances, the `egg` fragment is not necessary and its use is | ||
discouraged. | ||
```{note} | ||
pip also supports an `egg` fragment to specify the "project name". This is a legacy | ||
feature and its use is discouraged in favour of the Direct URL ({pep}`508`) form. | ||
|
||
The `egg` fragment **should** be a bare {ref}`project name <pypug:name-normalization>`. | ||
Anything else is not guaranteed to work. | ||
``` | ||
|
||
````{admonition} Example | ||
If your repository layout is: | ||
|
@@ -164,6 +186,6 @@ $ pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir" | |
or: | ||
|
||
```{pip-cli} | ||
$ pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir" | ||
$ pip install -e "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir" | ||
``` | ||
```` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add support installing an editable requirement written as a Direct URL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate that I'm adding more references to individual PEPs in the user documentation, but I legitimately don't know where to find a good user guide for Direct URL requirements. Linking to the specification is not exactly user friendly. I defaulted to linking the PEP as this document already does that.
Suggestions would be welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a reference to https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers instead of the PEP.