kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.58k stars 83 forks source link

yq-2.10.0 breaks on python 2.7 #83

Closed mochi99999 closed 4 years ago

mochi99999 commented 4 years ago

argcomplete brings in more-itertools which broke for me

Collecting more-itertools (from zipp>=0.5->importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq==2.10.0)
  Using cached https://files.pythonhosted.org/packages/df/8c/c278395367a46c00d28036143fdc6583db8f98622b83875403f16473509b/more-itertools-8.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-JO6UHk/more-itertools/setup.py", line 5, in <module>
        from more_itertools import __version__
      File "/tmp/pip-build-JO6UHk/more-itertools/more_itertools/__init__.py", line 1, in <module>
        from .more import *  # noqa
      File "/tmp/pip-build-JO6UHk/more-itertools/more_itertools/more.py", line 480
        yield from iterable
                 ^
    SyntaxError: invalid syntax
kislyuk commented 4 years ago

I am unable to reproduce. Here is what I get:

>pip install yq
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting yq
  Downloading https://files.pythonhosted.org/packages/c3/68/8994d78dcbb92cbfb70800bb6873f2694705516f4ae14ff08c05111fefeb/yq-2.10.0-py2.py3-none-any.whl
Collecting xmltodict>=0.11.0
  Using cached https://files.pythonhosted.org/packages/28/fd/30d5c1d3ac29ce229f6bdc40bbc20b28f716e8b363140c26eff19122d8a5/xmltodict-0.12.0-py2.py3-none-any.whl
Collecting argcomplete>=1.8.1
  Using cached https://files.pythonhosted.org/packages/65/a6/4fd54d4f4fe699b8b9b709e7501a2617aa6352de074e0790adb3437ecd98/argcomplete-1.11.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./lib/python2.7/site-packages (from yq) (44.0.0)
Collecting PyYAML>=3.11
  Downloading https://files.pythonhosted.org/packages/3d/d9/ea9816aea31beeadccd03f1f8b625ecf8f645bd66744484d162d84803ce5/PyYAML-5.3.tar.gz (268kB)
     |████████████████████████████████| 276kB 6.7MB/s
Collecting importlib-metadata<2,>=0.23; python_version == "2.7"
  Using cached https://files.pythonhosted.org/packages/d7/31/74dcb59a601b95fce3b0334e8fc9db758f78e43075f22aeb3677dfb19f4c/importlib_metadata-1.4.0-py2.py3-none-any.whl
Collecting configparser>=3.5; python_version < "3"
  Using cached https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl
Collecting zipp>=0.5
  Using cached https://files.pythonhosted.org/packages/f4/50/cc72c5bcd48f6e98219fc4a88a5227e9e28b81637a99c49feba1d51f4d50/zipp-1.0.0-py2.py3-none-any.whl
Collecting contextlib2; python_version < "3"
  Using cached https://files.pythonhosted.org/packages/85/60/370352f7ef6aa96c52fb001831622f50f923c1d575427d021b8ab3311236/contextlib2-0.6.0.post1-py2.py3-none-any.whl
Collecting pathlib2; python_version < "3"
  Using cached https://files.pythonhosted.org/packages/e9/45/9c82d3666af4ef9f221cbb954e1d77ddbb513faf552aea6df5f37f1a4859/pathlib2-2.3.5-py2.py3-none-any.whl
Collecting more-itertools
  Using cached https://files.pythonhosted.org/packages/2f/9d/dcfe59e213093695f108508af1214cf9cd95cc5489e46877ec5cb56369e5/more_itertools-5.0.0-py2-none-any.whl
Collecting six
  Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Processing /Users/akislyuk/Library/Caches/pip/wheels/91/95/75/19c98a91239878abbc7c59970abd3b4e0438a7dd5b61778335/scandir-1.10.0-cp27-cp27m-macosx_10_15_x86_64.whl
Building wheels for collected packages: PyYAML
  Building wheel for PyYAML (setup.py) ... done
  Created wheel for PyYAML: filename=PyYAML-5.3-cp27-cp27m-macosx_10_15_x86_64.whl size=138629 sha256=def6fc8781100468a380cb9d550318e5ae1b50f0990c266b587a46c95683c4a3
  Stored in directory: /Users/akislyuk/Library/Caches/pip/wheels/e4/76/4d/a95b8dd7b452b69e8ed4f68b69e1b55e12c9c9624dd962b191
Successfully built PyYAML
Installing collected packages: xmltodict, configparser, six, more-itertools, zipp, contextlib2, scandir, pathlib2, importlib-metadata, argcomplete, PyYAML, yq
Successfully installed PyYAML-5.3 argcomplete-1.11.0 configparser-4.0.2 contextlib2-0.6.0.post1 importlib-metadata-1.4.0 more-itertools-5.0.0 pathlib2-2.3.5 scandir-1.10.0 six-1.13.0 xmltodict-0.12.0 yq-2.10.0 zipp-1.0.0

Note the version of more-itertools pulled in: more-itertools-5.0.0. Can you give precise steps to reproduce?

verdverm commented 4 years ago

@kislyuk pip install yq on Centos7 should work. The example you provided looks to be using cached files during install. You may be able to repro by cleaning that up first?

verdverm commented 4 years ago

https://github.com/erikrose/more-itertools/issues/354#issuecomment-565112364

TL;DR more-itertools no longer supports python2

kislyuk commented 4 years ago

I am unable to reproduce this in a new centos7 container, either.

I am closing this bug for now. If you need help, please provide precise steps for reproducing.

mochi99999 commented 4 years ago

I get this error in the ubuntu:16.04 container.

# pip install yq
Collecting yq
  Downloading https://files.pythonhosted.org/packages/c3/68/8994d78dcbb92cbfb70800bb6873f2694705516f4ae14ff08c05111fefeb/yq-2.10.0-py2.py3-none-any.whl
Collecting PyYAML>=3.11 (from yq)
  Downloading https://files.pythonhosted.org/packages/3d/d9/ea9816aea31beeadccd03f1f8b625ecf8f645bd66744484d162d84803ce5/PyYAML-5.3.tar.gz (268kB)
    100% |################################| 276kB 2.3MB/s
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from yq)
Collecting argcomplete>=1.8.1 (from yq)
  Downloading https://files.pythonhosted.org/packages/82/7d/455e149c28c320044cb763c23af375bd77d52baca041f611f5c2b4865cf4/argcomplete-1.11.1-py2.py3-none-any.whl
Collecting xmltodict>=0.11.0 (from yq)
  Downloading https://files.pythonhosted.org/packages/28/fd/30d5c1d3ac29ce229f6bdc40bbc20b28f716e8b363140c26eff19122d8a5/xmltodict-0.12.0-py2.py3-none-any.whl
Collecting importlib-metadata<2,>=0.23; python_version == "2.7" (from argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/d7/31/74dcb59a601b95fce3b0334e8fc9db758f78e43075f22aeb3677dfb19f4c/importlib_metadata-1.4.0-py2.py3-none-any.whl
Collecting contextlib2; python_version < "3" (from importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/85/60/370352f7ef6aa96c52fb001831622f50f923c1d575427d021b8ab3311236/contextlib2-0.6.0.post1-py2.py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/f4/50/cc72c5bcd48f6e98219fc4a88a5227e9e28b81637a99c49feba1d51f4d50/zipp-1.0.0-py2.py3-none-any.whl
Collecting pathlib2; python_version < "3" (from importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/e9/45/9c82d3666af4ef9f221cbb954e1d77ddbb513faf552aea6df5f37f1a4859/pathlib2-2.3.5-py2.py3-none-any.whl
Collecting configparser>=3.5; python_version < "3" (from importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl
Collecting more-itertools (from zipp>=0.5->importlib-metadata<2,>=0.23; python_version == "2.7"->argcomplete>=1.8.1->yq)
  Downloading https://files.pythonhosted.org/packages/df/8c/c278395367a46c00d28036143fdc6583db8f98622b83875403f16473509b/more-itertools-8.1.0.tar.gz (78kB)
    100% |################################| 81kB 2.6MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-3xQLWt/more-itertools/setup.py", line 5, in <module>
        from more_itertools import __version__
      File "/tmp/pip-build-3xQLWt/more-itertools/more_itertools/__init__.py", line 1, in <module>
        from .more import *  # noqa
      File "/tmp/pip-build-3xQLWt/more-itertools/more_itertools/more.py", line 480
        yield from iterable
                 ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3xQLWt/more-itertools/
You are using pip version 8.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
kislyuk commented 4 years ago

OK, thanks. Does the error still occur if you upgrade pip?

mochi99999 commented 4 years ago

@kislyuk Yes, that resolves it. Sorry, I should have tried that first. Thank you for your help.

kislyuk commented 4 years ago

No problem. I'll see if specifying a minimum version dependency on pip will have the desired effect.

verdverm commented 4 years ago

Can confirm that the pip update also solves the issue on Centos7