httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.37k stars 3.67k forks source link

Conditional requirements are broken with wheel #227

Closed Jayin closed 9 years ago

Jayin commented 10 years ago

in win7

C:\Users\Lenovo>pip install --upgrade httpie
Requirement already up-to-date: httpie in c:\python27\lib\site-packages
Cleaning up...

C:\Users\Lenovo>http httpie.org
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\Python27\Scripts\http.exe\__main__.py", line 5, in <module>
  File "C:\Python27\lib\site-packages\httpie\__main__.py", line 6, in <module>
    from .core import main
  File "C:\Python27\lib\site-packages\httpie\core.py", line 23, in <module>
    from .downloads import Download
  File "C:\Python27\lib\site-packages\httpie\downloads.py", line 15, in <module>

    from .output import RawStream
  File "C:\Python27\lib\site-packages\httpie\output.py", line 19, in <module>
    from .models import HTTPRequest, HTTPResponse, Environment
  File "C:\Python27\lib\site-packages\httpie\models.py", line 8, in <module>
    class Environment(object):
  File "C:\Python27\lib\site-packages\httpie\models.py", line 34, in Environment

    from colorama.initialise import wrap_stream
ImportError: No module named colorama.initialise
kjerk commented 10 years ago

Same problem here. pip install colorama fixed the problem, so probably just needs the dependency added to the install script.

rebornix commented 10 years ago

Same here. It's weird that their test doesn't cover this scenario.

jkbrzt commented 10 years ago

It's a bug, sorry about that. Will be fixed hopefully soon. The same problem will occur with argparse on Python versions that don't included it (2.6, 3.0, 3.1).

It's because the conditional dependencies in setup.py don't work with the new wheel format. It looks like with wheel==0.24.0, once released, it will be possible to define environment-specific dependencies again:

http://wheel.readthedocs.org/en/latest/#defining-conditional-dependencies

extras_require={
    ':python_version == "2.6" or python_version == "3.0" or python_version == "3.1"': [
        'argparse>=1.2.1'
    ],
    ':sys_platform == "win32"': [
        'colorama>=0.2.4'
    ],
}

But maybe we could drop support for wheel until things improve. The primary reason why It was introduced was to fix #148.

jkbrzt commented 9 years ago

This should be fixed in HTTPie v0.9.0. See:

https://github.com/jakubroztocil/httpie/issues/255#issuecomment-72316343