Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My meta data is not recognized #94

Closed
buhtz opened this issue Jan 16, 2023 · 10 comments
Closed

My meta data is not recognized #94

buhtz opened this issue Jan 16, 2023 · 10 comments
Assignees
Labels

Comments

@buhtz
Copy link

buhtz commented Jan 16, 2023

How does pyorma look for the data (description, version string, etc)?

I have a pyproject.toml, the package is installed via pip --editable. I also pointed pyorma to the source folder (the local git repo). The rating is 0.

There is no PyPi release yet or planed in the future.
You can find the project in here (branch develop!)
https://codeberg.org/buhtz/hyperorg/src/branch/develop

EDIT:
There is also a lot of traceback-exceptions-output. To much to post. But one "interesting" string is Neither setup.py nor setup.cfg was found. This two files are not needed anymore today.

Do you use importlib.metadata package to check the data?

@CAM-Gerlach
Copy link
Collaborator

How does pyorma look for the data (description, version string, etc)?

Hey, so for projects in a local directory (as opposed to on PyPI, or distribution archives), while it's been improved substantially over the past couple versions, and #92 should fix the final lingering issues, you can check out the current released code here, but in summary, the following approaches are attempted, in order:

  1. Use the PEP 517 prepare_metadata_for_build_wheel hook through build to get the metadata from your project's configured PEP 517 build backend
  2. If that fails, try to read it directly from a setup.cfg, if present, using Setuptools
  3. If that fails, use the deprecated and soon to be removed hacky legacy approach of monkeypatching Setuptools to extract the metadata during a build.

Approach 1 is what is should be using nearly all of the time for any package with at least semi-modern packaging, and only falling back to 2 or 3 in case of a really old packaging config. It should work with any project using a properly configured PEP 517 build backend, or Setuptools by default (per the fallback specified in the PEP).

However, there's one big caveat to this, which #92 fixes: Currently it does not install the required versions of the build-system.requires in an isolated env to build the package, like build and pip by default, and instead just attempts to build in your local runtime environment. If the required dependency versions are installed it will be orders of magnitude faster, but if not it obviously won't work.

To fix that, #92 splits step 1 into two:

1a. Attempt to get the metadata through the project's build system if installed in the local environment
1b. If that fails, install the latest specified version of the specified build requires into an isolated environment, and build the metadata from there.

Do you use importlib.metadata package to check the data?

importlib.metadata can only extract the data from installed projects, whereas Pyroma does not assume your project is installed. However, at least for the primary Approach 1 above, the metadata it reads is esentially identical in both format and content to what importlib.metadata would read from the project if installed (assuming it was built with the same backend version as Pyroma is using above), because both read the same built METADATA file into the same email.Message structure.

We could potentially use packaging.metadata to handling reading the processing the metadata once that's matured, including from the PEP 621 [project] table in your pyproject.toml, once that's implemented in pypa/packaging#570 . That would have all the speed and more of 1a., and would avoid requiring or relying upon your build backend at all. Of course, you would need to be using the [project] table for your metadata (which at the moment is less universal than PEP 517 support in backends), and it might not catch certain (hopefully rare) issues with your backend processing the metadata, so it would probably need to be inserted in the above order as a Step 0, with at least 1a and 1b still intact as fallbacks.

@CAM-Gerlach
Copy link
Collaborator

As for your particular issue, your configuration all looks correct, and with the very limited information provided, all I can guess is that assuming you're using the latest version of Pyroma (4.1), it may be the issue fixed in #92 . Namely that the version of your build backend (Setuptools) currently installed in your runtime environment is too outdated (older than 61.0.0, in which full pyproject.toml support was added) to work properly with a fully pyproject.toml-based config—which seems somewhat plausible, given a typically old version is installed by default when you create a venv.

Therefore, I suggest the following troubleshooting steps:

  1. Ensure you're running the latest version of Pyroma (4.1)
  2. Re-install Pyroma from the PR branch in Fall back to isolated mode for metadata build & simplify codepath #92 and see if that works
  3. If not, or unable to easily do so, do pip install --upgrade pip wheel setuptools build pep517 packaging in your local runtime environment and try again

If none of that works, then you'll need to provide more information for us to give you useful help:

  • Your OS version

  • python --version

  • pip list

  • The full input and output from running Pyroma, in a code block like this:

    ```console
    
    <input and output go here>
    
    ```
    

Thanks!

@buhtz
Copy link
Author

buhtz commented Jan 17, 2023

Hi,
thanks for the detailed infos. You talked about PEP518. Isn't it about pyproject.toml? I don't know what "PEP 517 prepare_metadata_for_build_wheel hook through build" means.

Pyroma does not assume your project is installed

But it should be an option because pip install --editable is usual today and recommended.

I'm using Pyroma from PyPi. Debian 11 with Python 3.9.2.

Pip list

python3 -m pip list
Package                       Version        Editable project location
----------------------------- -------------- ---------------------------------------------
aiohttp                       3.7.4.post0
alabaster                     0.7.12
appdirs                       1.4.4
apt-xapian-index              0.49
argcomplete                   1.12.3
argon2-cffi                   18.3.0
arrow                         0.17.0
asn1crypto                    1.4.0
astor                         0.8.1
astroid                       2.5.1
async-timeout                 3.0.1
asyncio                       3.4.3
attrs                         20.3.0
audioread                     2.1.9
Automat                       20.2.0
autopep8                      1.6.0
Babel                         2.9.1
backcall                      0.2.0
bandit                        1.7.4
bcrypt                        3.1.7
beautifulsoup4                4.9.3
bitdemo                       0.0.1a1        /home/user/ownCloud/my.work/bit/bit_demo
black                         22.3.0
bleach                        3.2.1
blinker                       1.4
Bottleneck                    1.3.5
Brlapi                        0.8.2
Buhtzology                    0.1.1.dev1     /home/user/ownCloud/my.work/buhtzology
build                         0.10.0
CacheControl                  0.12.11
cairocffi                     1.2.0
certifi                       2020.6.20
cffi                          1.14.5
chardet                       4.0.0
charset-normalizer            2.1.0
click                         8.0.4
cmake                         3.22.2
colorama                      0.4.4
colorlog                      4.7.2
colour                        0.1.5
ConfigArgParse                1.5.3
configobj                     5.0.6
constantly                    15.1.0
contourpy                     1.0.6
coverage                      7.0.5
cramjam                       2.5.0
cryptography                  3.3.2
cupshelpers                   1.0
cycler                        0.10.0
dbus-python                   1.2.16
decli                         0.5.2
decorator                     4.4.2
defusedxml                    0.6.0
Deprecated                    1.2.13
diceware                      0.9.6
distlib                       0.3.1
distro                        1.5.0
docopt                        0.6.2
docstring-to-markdown         0.11
docutils                      0.17.1
doxypypy                      0.8.8.6
dparse                        0.6.2
duplicity                     0.8.17
easygui                       0.98.1
entrypoints                   0.3
et-xmlfile                    1.1.0
fasteners                     0.14.1
fastparquet                   0.8.1
feedparser                    5.2.1
filelock                      3.0.12
flake8                        6.0.0
Flask                         2.0.3
fold-to-ascii                 1.0.2.post1
fonttools                     4.38.0
fsspec                        2022.5.0
fswrap                        1.0.1
future                        0.18.2
galternatives                 1.0.8
GDAL                          3.2.2
gitdb                         4.0.10
GitPython                     3.1.30
gpg                           1.14.0-unknown
graphviz                      0.14.2
green                         3.4.2
grip                          4.6.0
html5lib                      1.1
httplib2                      0.18.1
humanize                      4.1.0
hyperlink                     21.0.0
hyperorg                      0.0.0a1        /home/user/ownCloud/my.work/hyperorg
idna                          2.10
imagesize                     1.3.0
importlib-metadata            4.11.2
incremental                   21.3.0
iniconfig                     1.1.1
invoke                        1.4.1
ipykernel                     5.4.3
ipython                       7.20.0
ipython_genutils              0.2.0
ipywidgets                    8.0.3
isort                         5.6.4
itsdangerous                  2.1.1
jedi                          0.17.2
Jinja2                        3.0.3
jsonschema                    3.2.0
jupyter-client                6.1.11
jupyter-console               6.2.0
jupyter-core                  4.7.1
jupyterlab-widgets            3.0.4
kazam                         1.4.5
kiwisolver                    1.3.1
latexcodec                    2.0.1
lazy-object-proxy             0.0.0
libvirt-python                7.0.0
llvmlite                      0.35.0
lockfile                      0.12.2
logilab-common                1.8.1
louis                         3.16.0
lunr                          0.6.2
lxml                          4.9.1
mailnag                       2.0.0
Mako                          1.1.3
Markdown                      3.3.4
MarkupSafe                    2.1.1
matplotlib                    3.6.2
mccabe                        0.7.0
mechanize                     0.4.5
meld                          3.20.2
menulibre                     2.2.1
mercurial                     5.6.1
meson                         0.56.2
mistune                       0.8.4
mock                          4.0.3
monotonic                     1.5
more-itertools                4.2.0
msgpack                       1.0.3
multidict                     5.1.0
multitasking                  0.0.9
musicbrainzngs                0.7.1
mutagen                       1.45.1
mypy-extensions               0.4.3
nbconvert                     5.6.1
nbformat                      5.1.2
netifaces                     0.10.9
notebook                      6.2.0
notify2                       0.3
numba                         0.52.0
numexpr                       2.8.3
numpy                         1.23.2
oauthlib                      3.1.0
odfpy                         1.4.1
olefile                       0.46
onboard                       1.4.1
openpyxl                      3.0.10
orgparse                      0.3.1          /home/user/.local/lib/python3.9/site-packages
packaging                     23.0
pandas                        1.5.2
pandocfilters                 1.4.3
paramiko                      2.7.2
parso                         0.7.1
path-and-address              2.0.1
pathspec                      0.9.0
patsy                         0.5.1
pbr                           5.5.0
pep517                        0.13.0
pep8                          1.7.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        8.1.2
pip                           22.3.1
platformdirs                  2.5.2
plotly                        4.14.3
pluggy                        1.0.0
ply                           3.11
plyer                         2.0.0
powerline-gitstatus           1.3.1
powerline-status              2.8.1
powerline-taskwarrior         0.7.2
prometheus-client             0.9.0
prompt-toolkit                3.0.14
psutil                        5.8.0
psycopg2                      2.8.6
puddletag                     2.0.1
py                            1.10.0
pyacoustid                    1.2.0
pyarrow                       8.0.0
pybtex                        0.24.0
pycairo                       1.16.2
pycodestyle                   2.10.0
pycparser                     2.20
pycryptodomex                 3.9.7
pycups                        2.0.1
pycurl                        7.43.0.6
pydataset                     0.2.0
pydocstyle                    6.1.1
pydoctor                      22.5.1
pyenchant                     3.2.0
pyfakefs                      5.1.dev0
pyfiglet                      0.8.post0
pyflakes                      3.0.1
pygame                        1.9.6
PyGithub                      1.55
Pygments                      2.7.1
PyGObject                     3.38.0
pygtkspellcheck               4.0.5
pyinotify                     0.9.6
PyJWT                         2.4.0
pylint                        2.7.2
PyNaCl                        1.4.0
pyOpenSSL                     20.0.1
pyparsing                     2.4.7
pyproject_hooks               1.0.0
PyQt5                         5.15.2
PyQt5-sip                     12.8.1
PyQtWebEngine                 5.15.2
pyreadstat                    1.1.4
pyroma                        4.1
pyrsistent                    0.15.5
PySimpleGUI                   4.60.4
PySimpleSOAP                  1.16.2
pysmbc                        1.0.23
PySocks                       1.7.1
pytest                        7.1.3
python-apt                    2.2.1
python-dateutil               2.8.1
python-debian                 0.1.39
python-debianbts              3.1.0
python-docs-theme             2022.1
python-docx                   0.8.11
python-gettext                4.1
python-jsonrpc-server         0.4.0
python-language-server        0.36.2
python-Levenshtein            0.12.2
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.7.0
python-ly                     0.9.6
python-poppler-qt5            0.75.0
python-slugify                4.0.0
pytz                          2021.1
pyxdg                         0.27
PyYAML                        5.3.1
pyzmq                         20.0.0
qtconsole                     5.0.2
QtPy                          1.9.0
questionary                   1.10.0
quodlibet                     4.3.0
ranger-fm                     1.9.3
reportbug                     7.10.3+deb11u1
reportlab                     3.5.59
requests                      2.25.1
retrying                      1.3.3
rope                          1.6.0
ruamel.yaml                   0.17.21
ruamel.yaml.clib              0.2.7
scipy                         1.6.0
scour                         0.38.2
seaborn                       0.12.1
Send2Trash                    1.6.0b1
setuptools                    66.0.0
six                           1.16.0
smmap                         5.0.0
snowballstemmer               2.2.0
soundconverter                4.0.0
soupsieve                     2.2.1
Sphinx                        4.4.0
sphinx-rtd-theme              1.0.0
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy                    1.3.22
stevedore                     4.1.1
styleframe                    4.1            /home/user/.local/lib/python3.9/site-packages
tables                        3.6.1
tabulate                      0.9.0
termcolor                     1.1.0
terminado                     0.9.2
terminator                    2.1.0
testpath                      0.4.4
toml                          0.10.1
tomli                         2.0.1
tomlkit                       0.11.3
torbrowser-launcher           0.3.3
tornado                       6.1
tox                           3.21.4
tqdm                          4.57.0
traitlets                     5.0.5
trash-cli                     0.17.1.14
trove-classifiers             2023.1.12
Twisted                       22.4.0
typing_extensions             4.2.0
ujson                         5.1.0
Unidecode                     1.2.0
urllib3                       1.26.5
virtualenv                    20.4.0+ds
wcwidth                       0.1.9
webencodings                  0.5.1
Werkzeug                      2.0.3
whatthepatch                  1.0.3
wheel                         0.38.4
widgetsnbextension            4.0.4
wrapt                         1.12.1
xcffib                        0.8.1
xdg                           5
XlsxWriter                    3.0.1
xlwt                          1.3.0
yapf                          0.32.0
yarl                          1.6.3
yfinance                      0.1.64
youtube-dl                    2021.12.17
zim                           0.73.5
zipp                          1.0.0
zope.interface                5.4.0

pyroma -a .
------------------------------
Checking .
Getting metadata for wheel...
Exception raised during metadata preparation
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/home/user/.local/lib/python3.9/site-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmpixijc129']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
Neither setup.py nor setup.cfg was found
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/home/user/.local/lib/python3.9/site-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmpixijc129']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
Found nothing
------------------------------
Your package does not have name data!
Your package does not have version data!
The version number should be a string.
The package's version number does not comply with PEP-386 or PEP-440.
The package had no description!
The package's long_description is quite short.
Your package does not have classifiers data.
The classifiers should specify what Python versions you support.
You should specify what Python versions you support with the 'requires-python'/'python_requires' metadata.
Your package does not have keywords data.
Your package does not have author data.
Your package does not have author_email data.
Your package should have a 'url' field with a link to the project home page, or a 'project_urls' field, with a dictionary of links, or both.
Your package does neither have a license field nor any license classifiers.
Specifying a development status in the classifiers gives users a hint of how stable your software is.
Your Cheese may have spoiled!! The only way to gather metadata from your package was to execute a patched setup.py. This indicates that your package is using very old packaging techniques, (or that your setup.py isn't executable at all), and Pyroma will soon regard that as a complete failure!
Please modernize your packaging! If it is already modern, this is a bug.
------------------------------
Final rating: 0/10
This cheese seems to contain no dairy products

@buhtz
Copy link
Author

buhtz commented Jan 17, 2023

So I installed the Pyroma from the PR.

python3 -m pip install git+https://github.com/CAM-Gerlach/pyroma.git

This is the output.

pyroma -a .
------------------------------
Checking .
Getting metadata for wheel...
Exception raised during metadata preparation
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/home/user/.local/lib/python3.9/site-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmprb6vxm_6']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
Neither setup.py nor setup.cfg was found
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 186, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/home/user/.local/lib/python3.9/site-packages/pep517/wrappers.py", line 76, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/user/.local/lib/python3.9/site-packages/pyproject_hooks/_in_process/_in_process.py', 'prepare_metadata_for_build_wheel', '/tmp/tmprb6vxm_6']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 60, in get_data
    return get_build_data(path)
  File "/home/user/.local/lib/python3.9/site-packages/pyroma/projectdata.py", line 29, in get_build_data
    metadata_dir = build.ProjectBuilder(str(path), runner=pep517.quiet_subprocess_runner).prepare("wheel", tempdir)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 384, in prepare
    return self._call_backend(
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 459, in _call_backend
    basename: str = callback(outdir, config_settings, **kwargs)
  File "/usr/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/user/.local/lib/python3.9/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke prepare_metadata_for_build_wheel
Found nothing
------------------------------
Your package does not have name data!
Your package does not have version data!
The version number should be a string.
The package's version number does not comply with PEP-386 or PEP-440.
The package had no description!
The package's long_description is quite short.
Your package does not have classifiers data.
The classifiers should specify what Python versions you support.
You should specify what Python versions you support with the 'requires-python'/'python_requires' metadata.
Your package does not have keywords data.
Your package does not have author data.
Your package does not have author_email data.
Your package should have a 'url' field with a link to the project home page, or a 'project_urls' field, with a dictionary of links, or both.
Your package does neither have a license field nor any license classifiers.
Specifying a development status in the classifiers gives users a hint of how stable your software is.
Your Cheese may have spoiled!! The only way to gather metadata from your package was to execute a patched setup.py. This indicates that your package is using very old packaging techniques, (or that your setup.py isn't executable at all), and Pyroma will soon regard that as a complete failure!
Please modernize your packaging! If it is already modern, this is a bug.
------------------------------
Final rating: 0/10
This cheese seems to contain no dairy products

@CAM-Gerlach
Copy link
Collaborator

So I installed the Pyroma from the PR.

python3 -m pip install git+https://github.com/CAM-Gerlach/pyroma.git

Thanks, but this just installs Pyroma from the default (master) branch of my fork, which is (of course) is the same as installing it from here—which is in turn the same as the latest released version. To actually install the version from the branch on my PR, you need to actually specify that:

python3 -m pip install --upgrade git+https://github.com/CAM-Gerlach/pyroma.git@improve-pep-517-approach

thanks for the detailed infos. You talked about PEP518. Isn't it about pyproject.toml? I don't know what "PEP 517 prepare_metadata_for_build_wheel hook through build" means.

You can read through the actual PEPs for the full details (I'm in the process of porting the specs to the canonical packaging.python.org site), but PEP 518 specifies the pyproject.toml [build-system] table, and PEP 517 specifies the actual standardized interface between the build backend you specify in build-system.build-backend, like Poetry, Hatch or (in your case) Setuptools; and build frontends, like pip and build. It's how your tooling knows which build backend to execute when trying to build your package.

@buhtz
Copy link
Author

buhtz commented Jan 17, 2023

python3 -m pip install --upgrade git+https://github.com/CAM-Gerlach/pyroma.git@improve-pep-517-approach

Ah, the Microsoft GitHub front-end is a bit inconsistent at this point. Now I installed the correct branch.
The error is still there.

Maybe you can clone my repo and run pyroam on it and see if you can reproduce this on your site?

@pradyunsg
Copy link

FWIW, @CAM-Gerlach the cool kids call it pyproject.toml-based builds instead of referring to the specific PEPs, especially when talking to end users. ;)

@CAM-Gerlach
Copy link
Collaborator

Maybe you can clone my repo and run pyroam on it and see if you can reproduce this on your site?

Yeah, that's what I plan to do shortly; I've just been busy these past couple days, sorry.

FWIW, @CAM-Gerlach the cool kids call it pyproject.toml-based builds instead of referring to the specific PEPs, especially when talking to end users. ;)

Yeah, I saw that discussion and I'd updated PEP 639 to formally define and consistently use the term "Pyproject metadata" to refer to the source metadata format originally defined by PEP 621, that was previously called "PEP 621 metadata". I'm still getting fully in the habit of calling builds triggered through the hooks originally defined in PEP 517 "Pyproject builds" (IMO, "pyproject.toml-based builds" is waaaay too long and klunky especially with end users, and more a rough description than a specific term). I've been a bit more hesitant because the spec isn't yet migrated and I'd had the impression that end users were more likely to be familiar with PEP 517 than the new (and still not fully established) term, but in hindsight it indeed would have been clearer and less confusing, thanks.

@CAM-Gerlach
Copy link
Collaborator

Hey, sorry for the delay—I got caught up working on some other things and this dropped off my radar.

Anyway, after testing this locally, I was able to reproduce this issue with Setuptools >=67.1.0 (but not with Setuptools <=67.0.0), and in fact ran into the same issue when attempting to build your package normally, with python -m build. The problem there was that a key used in your project.authors table was invalid (author, rather than name), and when that problem was fixed, everything worked fine. Previous Setuptools versions would pass this silently and just fail to generate the correct metadata, and pyroma would correctly flag your author metadata as missing. However, Setuptools 67.1.0 upgraded the version of validate-pyproject, which is what does the validation, from v0.7.1 to v0.12.1, and v0.11 added a new check to catch this error, which causes Setuptools to error out completely building your packages.

So, as far as I can tell, the error here is ultimately that your pyproject.toml [project] metadata is invalid, and would be caught whenever you would attempt to build and install it via the standard methods. To fix it, just change author to name in the project.authors table. If it still errors out with my branch after that, let me know (though it seems I'm not able to reproduce it).

In any case, while this appears to be a genuine error with the source metadata, we likely can handle this better, by providing a more informative error message, printing the build backend output that actually describes the error in more useful detail (like build does), and/or running validate-pyproject ourselves if a pyproject.toml is present prior to attempting to build the metadata and erroring out immediately with an informative message if the validation fails. I can take a look at that after #92 is merged.

@CAM-Gerlach CAM-Gerlach self-assigned this Feb 10, 2023
@buhtz
Copy link
Author

buhtz commented Feb 10, 2023

Thanks a lot for breaking this down. It works now with improve-pep-517-approach when I change the author into name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants