{"library":"pyproject-metadata","code":"import tomli\nfrom pyproject_metadata import StandardMetadata\n\n# Example pyproject.toml [project] data as a Python dictionary\n# In a real scenario, you'd load this from a pyproject.toml file using a TOML parser like 'tomli'\nproject_data = {\n    \"name\": \"my-project\",\n    \"version\": \"0.1.0\",\n    \"description\": \"A short description\",\n    \"requires-python\": \">=3.8\",\n    \"dependencies\": [\n        \"requests~=2.28\",\n        \"tomli>=1.1.0; python_version < \\\"3.11\\\"\"\n    ],\n    \"authors\": [\n        {\"name\": \"Your Name\", \"email\": \"your.email@example.com\"}\n    ],\n    \"license\": {\"file\": \"LICENSE\"},\n    \"readme\": \"README.md\",\n    \"classifiers\": [\n        \"Programming Language :: Python :: 3\",\n        \"License :: OSI Approved :: MIT License\"\n    ],\n    \"urls\": {\n        \"Homepage\": \"https://github.com/my-project\",\n        \"Bug Tracker\": \"https://github.com/my-project/issues\"\n    }\n}\n\n# Validate the project metadata\ntry:\n    metadata = StandardMetadata.from_pyproject(project_data, allow_extra_keys=False)\n\n    # Access validated fields\n    print(f\"Project Name: {metadata.name}\")\n    print(f\"Project Version: {metadata.version}\")\n    print(f\"Requires Python: {metadata.requires_python}\")\n    print(f\"Dependencies: {metadata.dependencies}\")\n\n    # Generate PEP 643-compliant Core Metadata (e.g., PKG-INFO content)\n    pkg_info = metadata.as_rfc822()\n    print(\"\\n--- Generated PKG-INFO ---\")\n    print(str(pkg_info))\n\nexcept Exception as e:\n    print(f\"Error validating metadata: {e}\")","lang":"python","description":"This quickstart demonstrates how to use `pyproject-metadata` to validate a Python dictionary representing `pyproject.toml`'s `[project]` table and then generate a PEP 643-compliant PKG-INFO string. It highlights the use of `StandardMetadata.from_pyproject` for validation and `as_rfc822` for output. Note that `tomli` (or another TOML parser) is needed to initially parse a `pyproject.toml` file into a dictionary.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}