syrusakbary / promise

Ultra-performant Promise implementation in Python
MIT License
362 stars 76 forks source link

Can`t install graphene-django due to bug in promise install_requires definition #90

Open ValkoVolodya opened 3 years ago

ValkoVolodya commented 3 years ago

Hello!

Tried to compile my requirements file via pip-compile, that contains:

graphene-django==2.10.1
graphene==2.1.8

but get an error:

 error in promise setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected ',' or end-of-list in typing>=3.6.4; python_version < '3.5' at ; python_version < '3.5'

Error is here: https://github.com/syrusakbary/promise/blob/master/setup.py#L60

ValkoVolodya commented 3 years ago

@syrusakbary can you please help?

tdaff commented 3 years ago

@ValkoVolodya that looks like an environment marker, rather than a typo. pip-compile version 2 or newer should at least be parsing them correctly https://github.com/jazzband/pip-tools/pull/647 and filtering them.

ValkoVolodya commented 3 years ago

@tdaff , yeah, thanks, now I see, that is valid, but I use version 5.2.0 of pip-compile, but problem is still here( Maybe something wrong with pip-compile itself..

ValkoVolodya commented 3 years ago

I asked about this problem in pip-tools repo - https://github.com/jazzband/pip-tools/issues/1327 and problem is that wheel file for version 2.3 is not downloaded - https://pypi.org/project/promise/#files for now I try to pin older version with wheel downloaded

webknjaz commented 3 years ago

To be fair, this setup.py problem is also legitimate. Uploading a wheel will help but it is a band-aid.

Inline env markers aren't well-supported by old setuptools so this will only work if the end-users know that they need to have a minimum setuptools version of 36.2 0 upfront. And when you migrate to using a declarative setup.cfg config, it will be 36.2.7.

A more portable solution would be to use markers in the nameless extras definitions (this seems to be supported since v0.7):

-    extras_require={"test": tests_require},
+    extras_require={
+        ":python_version < '3.5'": ["typing>=3.6.4"],
+        "test": tests_require,
+    },
     install_requires=[
-        "typing>=3.6.4; python_version < '3.5'",
         "six"
     ],

Although, my ultimate recommendation is to use PEP517. To activate it, simply add a pyproject.toml with the minimum or pinned version of setuptools and wheel. This way, pip will know to provision the right versions of build deps when building from sdist. Also, for building the dists for publishing, it is now recommended to use https://github.com/pypa/build.