pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.14k stars 146 forks source link

"pip install pdoc3" fails because of "yanked" version of "setuptools-scm 6.2.0" #357

Closed dlukyanov closed 3 years ago

dlukyanov commented 3 years ago

pip install pdoc3 fails with error:

Collecting pdoc3==0.10.0
  Downloading https://files.pythonhosted.org/packages/95/be/69267c988fb7236cd60c452a4e7fb9a7991729476db490b634a07e7dfcdf/pdoc3-0.10.0.tar.gz (86kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k7kdl0l8/pdoc3/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k7kdl0l8/pdoc3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-k7kdl0l8/pdoc3/pip-egg-info
          cwd: /tmp/pip-install-k7kdl0l8/pdoc3/
     Complete output (21 lines):
     Traceback (most recent call last):
       ...
       File "/usr/lib/python3.8/site-packages/setuptools/dist.py", line 735, in finalize_options
         ep.load()(self, ep.name, value)
       File "/tmp/pip-install-k7kdl0l8/pdoc3/.eggs/setuptools_scm-6.2.0-py3.8.egg/setuptools_scm/integration.py", line 29, in version_keyword
         dist.metadata.version = _get_version(config)
       File "/tmp/pip-install-k7kdl0l8/pdoc3/.eggs/setuptools_scm-6.2.0-py3.8.egg/setuptools_scm/__init__.py", line 188, in _get_version
         dump_version(
       File "/tmp/pip-install-k7kdl0l8/pdoc3/.eggs/setuptools_scm-6.2.0-py3.8.egg/setuptools_scm/__init__.py", line 94, in dump_version
         version_fields = parsed_version.release
     AttributeError: 'Version' object has no attribute 'release'

Steps to Reproduce

Dockerfile:

FROM registry.access.redhat.com/ubi8/ubi

RUN yum install -y \
        python38 \
        python38-pip \
        python38-devel \
        gcc-c++ \
        procps

# RUN pip3 install setuptools-scm==6.0.1  # uncomment this to make it work
# current version of setuptools-scm 6.2.0 with label=yanked
# and pdoc3 uses the latest even it's not a release?
RUN pip3 install pdoc3==0.10.0

ENTRYPOINT /bin/bash

use command to build docker and it will fail:

docker build -t test-pdoc3 -f Dockerfile .

NOTE: this docker was working fine just several days ago and now it fails.

After investigation i found that pdoc3 uses setuptools_scm-6.2.0 (yanked version) during setup...

https://pypi.org/project/setuptools-scm/6.2.0/

kernc commented 3 years ago

We specify any setuptools-scm version as a setup requirement: https://github.com/pdoc3/pdoc/blob/f358893e4fcfd7f29857a7ff5491b606ff146d39/setup.py#L53-L56 If pip install pdoc3 pulls in the yanked version, I'd say that's a pip/setuptools bug. See https://github.com/pypa/pip/issues/8262.

It might help (and is perhaps always advised) to run this beforehand:

RUN pip3 install --upgrade pip setuptools
pfmoore commented 3 years ago

Older versions of setuptools would handle setup_requires using easy_install which is no longer supported and does not respect the "yanked" flag. New versions of setuptools should pass setup_requires as build requirements, which recent versions of pip will install normally into an isolated build environment, respecting the "yanked" flag.

@dlukyanov please ensure this issue can be reproduced using the latest versions of pip and setuptools. It's not possible to tell from the information in your report what versions of pip and setuptools are being used.

dlukyanov commented 3 years ago
# python3 --version
Python 3.8.6

# python3 -m pip install pip --upgrade
Successfully installed pip-21.2.4

# python3 -m pip --version
pip 21.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

after this if you try to install pdoc3 - it will fail with error described above

however after python3 -m pip install pip setuptools --upgrade the installation of pdoc3 works fine.