Skip to content

Parse Python Core Metadata files (METADATA and PKG-INFO) #102

Description

@andrew

I'm inspecting Python distribution archives without installing packages or executing setup.py. Their *.dist-info/METADATA and PKG-INFO files contain identity, dependency declarations, and package descriptions, but Parse does not recognise either format.

At library revision 04d388904f3439cbabf24ac986353a7f12266086, using Go 1.27.1:

data := []byte("Metadata-Version: 2.1\nName: example\nVersion: 1.0.0\nSummary: Currency conversion\nRequires-Dist: requests>=2\n\nPackage documentation.\n")
for _, name := range []string{"example-1.0.0.dist-info/METADATA", "example-1.0.0/PKG-INFO"} {
    result, err := manifests.Parse(name, data)
    fmt.Printf("file=%s result=%+v error=%v\n", name, result, err)
}

Both calls return UnknownFileError. This is a library call; no git-pkgs CLI is involved. The same result occurs with real wheel metadata, including Jupyter and python-telegram-bot.

Please recognise Python Core Metadata and return package identity and Requires-Dist declarations. Descriptive output should preserve Summary, Keywords, Home-page, repeated Project-URL headers, Description-Content-Type, and the description body. Cover folded headers, Unicode, optional fields, and older descriptions stored in a Description header. Parsing should remain a pure function of the supplied bytes.

Add public Parse tests for wheel and sdist member paths, including dependency markers and extras. Descriptive output is tracked at #101; broader distribution-format work is tracked at #80.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions