git-repo
git-repo copied to clipboard
Fix setup error when using pip 10
This changes setup.py, so it does not rely on pip internals to form the list of install requires.
@nikitavbv Great ... but what do you think of this approach here:
diff --git a/requirements-test.txt b/requirements-test.txt
index 700db9b..9ede2ac 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,5 +1,3 @@
--r requirements.txt
--e .
pytest
pytest-cov
pytest-sugar
diff --git a/setup.py b/setup.py
index 125164c..2be25d4 100644
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,6 @@ from setuptools import setup, find_packages
import sys, os
-import pip
-
from setuptools import setup, find_packages, dist
from setuptools.command.test import test as TestCommand
from distutils.core import Command
@@ -120,16 +118,9 @@ requirements_links = []
def requirements(spec=None):
spec = '{}{}.txt'.format('requirements',
'-'+spec if spec else '')
- requires = []
-
- requirements = pip.req.parse_requirements(
- spec, session=pip.download.PipSession())
- for item in requirements:
- if getattr(item, 'link', None):
- requirements_links.append(str(item.link))
- if item.req:
- requires.append(str(item.req))
+ with open(spec, 'r') as requirements_txt:
+ requires = requirements_txt.read().splitlines()
return requires
Also, it might be interesting to move tests_required to an extra_required (e.g. pip install -e. [tests]). What do you think @guyzmo ?
what would be the advantage of switching the tests_required to extra_required? :thinking:
/extra_require/¹ allows installation of test-related dependencies independently, unlike /tests_require/² which is invoked when the test command is called. The change here would happen in how to install dependencies, for example:
on setup.py:
extras_require={ "test'": ["pytest"] }
|$ pip install -e. [test]|
Even the integration with tox would be simpler, as we could leave the dependencies (replacing requirements-test.txt) in setup.py and call them in "deps" in tox.ini:
deps = . [test]
[1] - https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies [2] - https://setuptools.readthedocs.io/en/latest/setuptools.html?highlight=tests_require#developer-s-guide |
On 8/26/19 1:09 PM, guyzmo wrote:
what would be the advantage of switching the |tests_required| to |extra_required|? 🤔
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/guyzmo/git-repo/pull/191?email_source=notifications&email_token=AAIPKPHMHC6HPG2ONSJC4QTQGP54FA5CNFSM4FIP3BNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5E24RY#issuecomment-524922439, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIPKPFT2NGERP4WVS3N4ZLQGP54FANCNFSM4FIP3BNA.