pypa / pyproject-hooks

A low-level library for calling build-backends in `pyproject.toml`-based project
https://pyproject-hooks.readthedocs.io/
MIT License
122 stars 49 forks source link

pep517.check doesn't work under Py2 #57

Closed Julian closed 4 years ago

Julian commented 5 years ago

Not sure if this is intentional or not -- if it is maybe specifying a minimum Python version in the setup.py would be a nice outcome, but e.g. #51 makes me think there is intention that pep517.check works on Py2.

But, trying to use it results in:

~/Desktop
⊙  virtualenv venv; venv/bin/python -m pip install pep517; venv/bin/python -m pep517.check ~/Development/jsonschema                                                     julian@Air
Using real prefix '/usr/local/Cellar/pypy/7.1.1/libexec'
  No LICENSE.txt / LICENSE found in source
Path not in prefix '/Users/julian/.local/share/virtualenvs/venvs/include' '/usr/local/Cellar/pypy/7.1.1/libexec'
New pypy executable in /Users/julian/Desktop/venv/bin/python
Also creating executable in /Users/julian/Desktop/venv/bin/pypy
Installing setuptools, pip, wheel...
done.
Collecting pep517
/Users/julian/Desktop/venv/site-packages/pip/_vendor/msgpack/fallback.py:133: DeprecationWarning: encoding is deprecated, Use raw=False instead.
  unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs)
  Using cached https://files.pythonhosted.org/packages/a2/1f/d99c4cb3c46cfe0c356e884ef26a23dd73b5d17d2b4efca201e03e63cc28/pep517-0.6.0-py2.py3-none-any.whl
Collecting pytoml (from pep517)
  Using cached https://files.pythonhosted.org/packages/a5/47/c7f8a0f210ad18576840922e0b504f0b7f5f73aea4a52ab14c5b58517edf/pytoml-0.1.21-py2.py3-none-any.whl
Collecting importlib_metadata (from pep517)
  Using cached https://files.pythonhosted.org/packages/ad/aa/25fcbded2ab4ed4ff3071d1e000cd4f8f9c65653d2d7157dd105a8e81d42/importlib_metadata-0.19-py2.py3-none-any.whl
Collecting zipp (from pep517)
  Using cached https://files.pythonhosted.org/packages/74/3d/1ee25a26411ba0401b43c6376d2316a71addcc72ef8690b101b4ea56d76a/zipp-0.6.0-py2.py3-none-any.whl
Collecting contextlib2; python_version < "3" (from importlib_metadata->pep517)
  Using cached https://files.pythonhosted.org/packages/a2/71/8273a7eeed0aff6a854237ab5453bc9aa67deb49df4832801c21f0ff3782/contextlib2-0.5.5-py2.py3-none-any.whl
Collecting configparser>=3.5; python_version < "3" (from importlib_metadata->pep517)
  Using cached https://files.pythonhosted.org/packages/ab/1a/ec151e5e703ac80041eaccef923611bbcec2b667c20383655a06962732e9/configparser-3.8.1-py2.py3-none-any.whl
Collecting pathlib2; python_version == "3.4.*" or python_version < "3" (from importlib_metadata->pep517)
  Using cached https://files.pythonhosted.org/packages/67/c6/4dbf5dfdbe1140cadf765c3896acc098578626c35721bc7d3eb35f6a8fc1/pathlib2-2.3.4-py2.py3-none-any.whl
Collecting more-itertools (from zipp->pep517)
  Using cached https://files.pythonhosted.org/packages/2f/9d/dcfe59e213093695f108508af1214cf9cd95cc5489e46877ec5cb56369e5/more_itertools-5.0.0-py2-none-any.whl
Collecting six (from pathlib2; python_version == "3.4.*" or python_version < "3"->importlib_metadata->pep517)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "3.4.*" or python_version < "3"->importlib_metadata->pep517)
Installing collected packages: pytoml, six, more-itertools, zipp, contextlib2, configparser, scandir, pathlib2, importlib-metadata, pep517
Successfully installed configparser-3.8.1 contextlib2-0.5.5 importlib-metadata-0.19 more-itertools-5.0.0 pathlib2-2.3.4 pep517-0.6.0 pytoml-0.1.21 scandir-1.10.0 six-1.12.0 zipp-0.6.0
Traceback (most recent call last):
  File "/usr/local/Cellar/pypy/7.1.1/libexec/lib-python/2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/pypy/7.1.1/libexec/lib-python/2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/julian/Desktop/venv/site-packages/pep517/check.py", line 202, in <module>
    main()
  File "/Users/julian/Desktop/venv/site-packages/pep517/check.py", line 175, in main
    enable_colourful_output()
  File "/Users/julian/Desktop/venv/site-packages/pep517/colorlog.py", line 113, in enable_colourful_output
    handler.setFormatter(LogFormatter())
  File "/Users/julian/Desktop/venv/site-packages/pep517/colorlog.py", line 81, in __init__
    curses.tparm(fg_color, code), "ascii")
TypeError: __new__() takes at most 2 arguments (3 given)

where the hidden line there is pep517.check trying to do str(foo, "ascii"), which does not work on Py2.

takluyver commented 5 years ago

It is meant to work in Python 2.7. I think I copied the colorlog module in from a project that doesn't, and it's not really tested because it's an ancillary utility.

takluyver commented 5 years ago

So PRs welcome. ;-)

pradyunsg commented 4 years ago

Python 2 is EOL'd and most of the PyPA-maintained packaging toolchain is on-the-way to dropping support. Closing!