Skip to content

Persistent dynamic core metadata breaks user assumptions #1334

Closed
@hroncok

Description

@hroncok

Hello,

in Fedora, @frenzymadness wanted to update hatchling from 1.21 to 1.22.2. However, we encountered several Fedora packages using hatchling to regress.

For many of the packages, we essentially do:

  • download sdist archive from PyPI
  • extract/unpack it
  • apply downstream changes (e.g. patches or sed calls to relax an overly specific dependency)
  • build a wheel via PEP 517 API

However, the downstream changes to metadata in pyproject.toml are now silently ignored because all the metadata is read from PKG-INFO.

I have looked up the changelog which says:

Metadata for the wheel target now defaults to the PKG-INFO metadata within source distributions

It seems like this has happened in #1309

I am aware of no prior discussion and there is no rationale provided in the PR -- it looks like the change appeared out of the blue. What problem does this solve? What is the purpose of this behavior?

I assume that when I change the metadata in pyproject.toml it will affect the wheel. And many other folks in Fedora assume the same. This change breaks that assumption.

Essentially, this seems like a cache that fails to be invalidated. Would you please consider our use case and try to mitigate the impact of this change by doing for example one of the following?

  • check the mtime stamps of pyproject.toml and PKG-INFO -- invalidate PKG-INFO if pyproject.toml is newer
  • include a checksum or another indicator in PKG-INFO to see if it is up-to-date (I don't know if the specification for PKG-INFO allows custom headers) and ignore/regenerate it if it is out of sync
  • only read metadata from PKG-INFO if working with archived (i.e. not extracted) sdists (I don't know if hatchling can detect that)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions