Skip to content

Commit

Permalink
Use abstract spec for dependencies in setup.py
Browse files Browse the repository at this point in the history
`pip.req.parse_requirements` is not available in pip 10, so this package breaks when attempting to install it with pip 10. This change also makes the logical distinction between the abstract dependencies in setup.py and the concrete dependencies in requirements.txt.

I believe these to be reasonable version ranges based on what we have in cfgov-refresh already, what's specified in requirements.txt, and the changelog for each of the dependencies.
  • Loading branch information
willbarton committed May 21, 2018
1 parent 6270754 commit dce0967
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,16 @@
long_description = f.read()


def parse_requirements():
"""Return abstract requirements (without version numbers)
from requirements.txt.
As an exception, requirements that are URLs are used as-is.
This is tested to be compatible with pip 9.0.1.
Background: https://stackoverflow.com/a/42033122/
"""
install_requires = [
'Django>=1.8,<1.9',
'djangorestframework>=3.1,<3.2',
'elasticsearch>=2.4.1,<3',
'requests>=2.14,<2.15',
'urllib3>=1.21,<1.22',
'django-localflavor>=1.5,<1.6',
'wagtail-flags>=2.0.5,<2.2'
]

path = os.path.join(os.path.dirname(__file__), 'requirements.txt')
requirements = pip.req.parse_requirements(
path, session=pip.download.PipSession()
)
requirements = [
req.name or req.link.url
for req in requirements
if 'git+' not in (req.name or req.link.url)
]
return requirements


install_requires = parse_requirements()

setup(
name='ccdb5-api',
Expand Down

0 comments on commit dce0967

Please sign in to comment.