setuptools: tag_build breaks prepare_metadata_for_build_wheel

Previously reported in pypa/pip#9446.

This is similar to #1462, but for PEP 517 hooks, so I’m guessing a similar treatment is needed?

[egg_info]
tag_build = dev

[metadata]
name = pkg
version = 0.1

egg_info works as expected:

$ py -c 'from setuptools import *; setup()' egg_info >/dev/null
$ rg '^Version:' < pkg.egg-info/PKG-INFO 
Version: 0.1.dev0

But not the PEP 517 hook:

$ py -c 'import os; from setuptools.build_meta import *; prepare_metadata_for_build_wheel(os.getcwd())' >/dev/null
$ rg '^Version:' < pkg.dist-info/METADATA 
Version: 0.1.dev0dev

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

im so impressed you understand how setuptools works thanks for the efforts! i still remember ten years ago when nobody could change anything about it.

How about this:

[tox]

SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git}

[testenv]
skip_install = True
deps =
     pytest>4.6
     pytest-xdist
     mock
     sqla13: sqlalchemy@{[tox]SQLA_REPO}@rel_1_3
     sqlamaster: sqlalchemy@{[tox]SQLA_REPO}@master
     sqlalchemy: sqlalchemy>=1.3.0

     cov: pytest-cov
     mako
     python-editor>=0.3
     python-dateutil


     postgresql: sqlalchemy[postgresql]
     mysql: sqlalchemy[mysql]
     mysql: sqlalchemy[pymysql]
     oracle: sqlalchemy[oracle]
     mssql: sqlalchemy[mssql]

I was able to run tox -e sqlalchemy,sqla13,sqlamaster,postgresql with that tox file.

Due to #2536, the fix had to be rolled back and will need to be revisited in light of this new information.