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

How should a PEP 508 requirement with an URL specifier be handled? #249

Closed
benoit-pierre opened this issue Aug 25, 2018 · 4 comments
Closed

Comments

@benoit-pierre
Copy link
Member

benoit-pierre commented Aug 25, 2018

Starting with pip 10.0, requirements with URL specifiers are now supported (as replacement for dependency links).

With the following sample project' setup.py:

from setuptools import setup

setup(name='projecta', version='42',
      install_requires='''
      lazyImport@git+https://gitlab.com/KOLANICH1/lazyImport.py.git#egg=lazyImport-dev
      ''')

Installing from source work, but looking at the generated wheel metadata:

> python setup.py -q bdist_wheel && unzip -p dist/projecta-42-py3-none-any.whl '*/METADATA'
Metadata-Version: 2.1
Name: projecta
Version: 42
Summary: Description!
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN
Requires-Dist: lazyImport

UNKNOWN

It works with the following patch:

 tests/test_metadata.py | 3 +++
 wheel/metadata.py      | 2 ++
 2 files changed, 5 insertions(+)

diff --git i/tests/test_metadata.py w/tests/test_metadata.py
index 3421430..2390e98 100644
--- i/tests/test_metadata.py
+++ w/tests/test_metadata.py
@@ -9,6 +9,7 @@ def test_pkginfo_to_metadata(tmpdir):
         ('Provides-Extra', 'test'),
         ('Provides-Extra', 'signatures'),
         ('Provides-Extra', 'faster-signatures'),
+        ('Requires-Dist', "pip @ https://github.com/pypa/pip/archive/1.3.1.zip"),
         ('Requires-Dist', "ed25519ll; extra == 'faster-signatures'"),
         ('Requires-Dist', "keyring; extra == 'signatures'"),
         ('Requires-Dist', "keyrings.alt; extra == 'signatures'"),
@@ -28,6 +29,8 @@ def test_pkginfo_to_metadata(tmpdir):
 
     egg_info_dir = tmpdir.ensure_dir('test.egg-info')
     egg_info_dir.join('requires.txt').write("""\
+pip@ https://github.com/pypa/pip/archive/1.3.1.zip
+
 [faster-signatures]
 ed25519ll
 
diff --git i/wheel/metadata.py w/wheel/metadata.py
index 4fa17cd..5b03e3e 100644
--- i/wheel/metadata.py
+++ w/wheel/metadata.py
@@ -17,6 +17,8 @@
 
 def requires_to_requires_dist(requirement):
     """Compose the version predicates for requirement in PEP 345 fashion."""
+    if requirement.url:
+        return " @ " + requirement.url
     requires_dist = []
     for op, ver in requirement.specs:
         requires_dist.append(op + ver)
> python setup.py -q bdist_wheel && unzip -p dist/projecta-42-py3-none-any.whl '*/METADATA'
Metadata-Version: 2.1
Name: projecta
Version: 42
Summary: Description!
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN
Requires-Dist: lazyImport @ git+https://gitlab.com/KOLANICH1/lazyImport.py.git

UNKNOWN

Unfortunately, this is technically not valid PEP 345 metadata.

@piotr-dobrogost
Copy link

install_requires's value passed to setup() is empty

@benoit-pierre
Copy link
Member Author

Oops, amended...

@benoit-pierre
Copy link
Member Author

PEP 345 is superseded by PEP 566. It's still unclear to me wether Requires-Dist: name @ url is valid 2.1 metadata or not.

@benoit-pierre
Copy link
Member Author

The consensus seems to be that this is allowed by PEP 566: python/peps#763, so I'll PR the changes.

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

No branches or pull requests

2 participants