pkginfo 1.8.x parsing incorrect metadata from tensorflow wheel?

Bug #1953227 reported by Tres Seaver
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pkginfo
Confirmed
Undecided
Tres Seaver

Bug Description

From this report: https://github.com/ddelange/pipgrip/pull/69

-------------------------------- %< --------------------------------
# pip install -q pkginfo~=1.8.0
>>> from pipgrip.pipper import _extract_metadata
>>> _extract_metadata("/Users/ddelange/Downloads/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl")
{'metadata_version': '1.2',
 'name': 'gast',
 'version': '0.4.0',
 'platforms': ['UNKNOWN'],
 'summary': 'Python AST that abstracts the underlying Python version',
 'description': "A generic AST to represent Python2 and Python3's Abstract Syntax Tree(AST).\n\nGAST provides a compatibility layer between the AST of various Python versions,\nas produced by ``ast.parse`` from the standard ``ast`` module.",
 'home_page': 'https://github.com/serge-sans-paille/gast/',
 'author': 'serge-sans-paille',
 'author_email': '<email address hidden>',
 'license': 'BSD 3-Clause',
 'classifiers': ['Development Status :: 4 - Beta',
  'Environment :: Console',
  'Intended Audience :: Developers',
  'License :: OSI Approved :: BSD License',
  'Natural Language :: English',
  'Programming Language :: Python :: 2',
  'Programming Language :: Python :: 2.7',
  'Programming Language :: Python :: 3',
  'Programming Language :: Python :: 3.4',
  'Programming Language :: Python :: 3.5',
  'Programming Language :: Python :: 3.6',
  'Programming Language :: Python :: 3.7'],
 'requires_python': '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'}

# pip install -q 'pkginfo<1.8.0'
>>> from pipgrip.pipper import _extract_metadata
>>> _extract_metadata("/Users/ddelange/Downloads/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl")
{'metadata_version': '2.1',
 'name': 'tensorflow',
 'version': '2.7.0',
 'platforms': ['UNKNOWN'],
 'summary': 'TensorFlow is an open source machine learning framework for everyone.',
 'keywords': 'tensorflow tensor machine learning',
 'home_page': 'https://www.tensorflow.org/',
 'author': 'Google Inc.',
 'author_email': '<email address hidden>',
 'license': 'Apache 2.0',
 'classifiers': ['Development Status :: 5 - Production/Stable',
  'Environment :: GPU :: NVIDIA CUDA :: 11.2',
  'Intended Audience :: Developers',
  'Intended Audience :: Education',
  'Intended Audience :: Science/Research',
  'License :: OSI Approved :: Apache Software License',
  'Programming Language :: Python :: 3',
  'Programming Language :: Python :: 3 :: Only',
  'Programming Language :: Python :: 3.7',
  'Programming Language :: Python :: 3.8',
  'Programming Language :: Python :: 3.9',
  'Topic :: Scientific/Engineering',
  'Topic :: Scientific/Engineering :: Artificial Intelligence',
  'Topic :: Scientific/Engineering :: Mathematics',
  'Topic :: Software Development',
  'Topic :: Software Development :: Libraries',
  'Topic :: Software Development :: Libraries :: Python Modules'],
 'download_url': 'https://github.com/tensorflow/tensorflow/tags',
 'requires_dist': ['numpy (>=1.14.5)',
  'absl-py (>=0.4.0)',
  'astunparse (>=1.6.0)',
  'libclang (>=9.0.1)',
  'flatbuffers (<3.0,>=1.12)',
  'google-pasta (>=0.1.1)',
  'h5py (>=2.9.0)',
  'keras-preprocessing (>=1.1.1)',
  'opt-einsum (>=2.3.2)',
  'protobuf (>=3.9.2)',
  'six (>=1.12.0)',
  'termcolor (>=1.1.0)',
  'typing-extensions (>=3.6.6)',
  'wheel (<1.0,>=0.32.0)',
  'wrapt (>=1.11.0)',
  'gast (<0.5.0,>=0.2.1)',
  'tensorboard (~=2.6)',
  'tensorflow-estimator (<2.8,~=2.7.0rc0)',
  'keras (<2.8,>=2.7.0rc0)',
  'tensorflow-io-gcs-filesystem (>=0.21.0)',
  'grpcio (<2.0,>=1.24.3)'],
 'description_content_type': 'text/markdown',
 'description': "[![Python](https://img.shields.io/pypi/pyversions/tensorflow.svg?style=plastic)](https://badge.fury.io/py/tensorflow)\n[![PyPI](https://badge.fury.io/py/tensorflow.svg)](https://badge.fury.io/py/tensorflow)\n\nTensorFlow is an open source software library for high performance numerical\ncomputation. Its flexible architecture allows easy deployment of computation\nacross a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters\nof servers to mobile and edge devices.\n\nOriginally developed by researchers and engineers from the Google Brain team\nwithin Google's AI organization, it comes with strong support for machine\nlearning and deep learning and the flexible numerical computation core is used\nacross many other scientific domains.\n\n\n"}
-------------------------------- %< --------------------------------

Revision history for this message
Tres Seaver (tseaver) wrote :
Download full text (3.1 KiB)

I can reproduce this report with bare `pkginfo`:

-------------------------------- %< --------------------------------
$ python3.8 -m venv /tmp/lp-1953227

$ cd /tmp/lp-1953227/

$ bin/pip install --upgrade setuptools pip wheel
...

Successfully installed pip-21.3.1 setuptools-59.4.0 wheel-0.37.0

$ bin/pip install "pkginfo~=1.8.0"
Collecting pkginfo~=1.8.0
  Downloading pkginfo-1.8.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pkginfo
Successfully installed pkginfo-1.8.2

$ wget https://files.pythonhosted.org/packages/72/8a/033b584f8dd863c07aa8877c2dd231777de0bb0b1338f4ac6a81999980ee/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl
...
2021-12-04 13:11:17 (1.76 MB/s) - ‘tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl’ saved [489633495/489633495]

$ bin/pkginfo tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl
metadata_version: 1.2
name: gast
version: 0.4.0
platforms: ['UNKNOWN']
summary: Python AST that abstracts the underlying Python version
description: A generic AST to represent Python2 and Python3's Abstract Syntax Tree(AST).

GAST provides a compatibility layer between the AST of various Python versions,
as produced by ``ast.parse`` from the standard ``ast`` module.
home_page: https://github.com/serge-sans-paille/gast/
...

$ bin/pip install "pkginfo<1.8.0"
...
Successfully installed pkginfo-1.7.1

$ bin/pkginfo tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl
metadata_version: 2.1
name: tensorflow
version: 2.7.0
platforms: ['UNKNOWN']
summary: TensorFlow is an open source machine learning framework for everyone.
description: [![Python](https://img.shields.io/pypi/pyversions/tensorflow.svg?style=plastic)](https://badge.fury.io/py/tensorflow)
[![PyPI](https://badge.fury.io/py/tensorflow.svg)](https://badge.fury.io/py/tensorflow)

TensorFlow is an open source software library for high performance numerical
computation. Its flexible architecture allows easy deployment of computation
across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters
of servers to mobile and edge devices.
...

-------------------------------- %< --------------------------------

It fails with the current release, too:

-------------------------------- %< --------------------------------
$ bin/pip install --upgrade pkginfo
...
Successfully installed pkginfo-1.8.2

$ bin/pkginfo tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl
metadata_version: 1.2
name: gast
version: 0.4.0
platforms: ['UNKNOWN']
summary: Python AST that abstracts the underlying Python version
description: A generic AST to represent Python2 and Python3's Abstract Syntax Tree(AST).
...
-------------------------------- %< --------------------------------

The 'tensorflow' wheel appears to vendor in a couple of 'gast'-related files:

-------------------------------- %< --------------------------------
$ unzip -l tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl | grep gast
     2244 2021-11-01 17:17 tensorflow/python/autograph/pyct/gast_util.py
     1165 2021-11-01 17:17 tensorflow/include/external/gast_archive/PKG-INFO
-------------------------------- %< --------------------------------

I suspect that the last one is the source of the pro...

Read more...

Changed in pkginfo:
status: New → Confirmed
Revision history for this message
Tres Seaver (tseaver) wrote :

I can confirm that the latest version of pkginfo still renders the GAST metadata from the latest version of tensorflow.

Revision history for this message
wim glenn (wim-glenn-w) wrote :

pkginfo v1.9.6

```
$ pkginfo tensorflow-2.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
metadata_version: 1.2
name: gast
version: 0.4.0
platforms: ['UNKNOWN']
summary: Python AST that abstracts the underlying Python version
description: A generic AST to represent Python2 and Python3's Abstract Syntax Tree(AST).

GAST provides a compatibility layer between the AST of various Python versions,
as produced by ``ast.parse`` from the standard ``ast`` module.
home_page: https://github.com/serge-sans-paille/gast/
author: serge-sans-paille
author_email: <email address hidden>
license: BSD 3-Clause
classifiers: ['Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Natural Language :: English', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7']
requires_python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.