{"id":8314,"library":"metadata-please","title":"Metadata Please","description":"metadata-please is a Python library designed for simple extraction of metadata from Python distribution artifacts. It supports extracting metadata from source distributions (sdists), wheel files, and project directories containing `pyproject.toml` or `setup.py`. The current version is 0.2.1, with releases occurring on an as-needed basis for improvements and bug fixes.","status":"active","version":"0.2.1","language":"python","source_language":"en","source_url":"https://github.com/python-packaging/metadata-please/","tags":["packaging","metadata","sdist","wheel","pyproject.toml","setup.py","build system"],"install":[{"cmd":"pip install metadata-please","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"wrong":"from metadata_please import get_metadata","symbol":"from_source_checkout","correct":"from metadata_please import from_source_checkout"},{"symbol":"from_wheel","correct":"from metadata_please import from_wheel"},{"symbol":"from_tar_sdist","correct":"from metadata_please import from_tar_sdist"}],"quickstart":{"code":"from metadata_please import get_metadata\nfrom pathlib import Path\nimport tempfile\nimport shutil\n\n# Create dummy files for demonstration\ndef create_dummy_sdist(path):\n    path.mkdir(parents=True, exist_ok=True)\n    with open(path / 'setup.py', 'w') as f:\n        f.write(\"from setuptools import setup; setup(name='dummy_sdist', version='0.1.0')\")\n    # In a real scenario, you'd run `python setup.py sdist`\n    # For this example, we'll just point to the dir as if it were an sdist source\n\ndef create_dummy_pyproject_toml(path):\n    path.mkdir(parents=True, exist_ok=True)\n    with open(path / 'pyproject.toml', 'w') as f:\n        f.write('[project]\\nname = \"dummy-toml\"\\nversion = \"0.2.0\"')\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n    tmp_path = Path(tmpdir)\n\n    # Example 1: Project directory with setup.py (simplified as source dir)\n    sdist_source_dir = tmp_path / \"dummy_sdist_project\"\n    create_dummy_sdist(sdist_source_dir)\n    metadata_sdist = get_metadata(sdist_source_dir)\n    print(f\"sdist project Name: {metadata_sdist.name}, Version: {metadata_sdist.version}\")\n\n    # Example 2: Project directory with pyproject.toml\n    pyproject_source_dir = tmp_path / \"dummy_toml_project\"\n    create_dummy_pyproject_toml(pyproject_source_dir)\n    metadata_toml = get_metadata(pyproject_source_dir)\n    print(f\"pyproject.toml project Name: {metadata_toml.name}, Version: {metadata_toml.version}\")\n\n    # Note: For actual .tar.gz (sdist) or .whl (wheel) files,\n    # you would replace the paths with your actual artifact files.\n    # Creating real sdist/wheel files dynamically for a quickstart is complex.\n    # The library is designed to work with these file types directly.\n    # Example (conceptual for artifact files):\n    # real_sdist_path = Path(\"path/to/your_package-1.0.0.tar.gz\")\n    # metadata_real_sdist = get_metadata(real_sdist_path)\n    # print(f\"Real sdist Name: {metadata_real_sdist.name}\")\n","lang":"python","description":"The `get_metadata` function is the primary entry point for `metadata-please`. It takes a `Path` object pointing to a Python artifact (sdist, wheel) or a project source directory (containing `pyproject.toml` or `setup.py`) and returns a metadata object. The example demonstrates usage for project source directories."},"warnings":[{"fix":"For comprehensive runtime introspection of *installed* packages, consider `importlib.metadata` (standard library for Python 3.8+ or `importlib_metadata` backport).","message":"The library primarily extracts *core metadata* as defined by Python packaging standards. While it can read `setup.py` and `pyproject.toml`, it may not extract all arbitrary fields or dynamic metadata generated by complex build systems (e.g., `setuptools_scm`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `setup.py` files conform to standard, readable patterns for metadata declaration. For projects using `pyproject.toml` (PEP 621), metadata extraction is generally more reliable.","message":"Direct parsing of `setup.py` (added in v0.2.0) has inherent limitations as `setup.py` is executable Python code. `metadata-please` attempts to safely extract static metadata, but complex or dynamically generated values might not be fully captured without executing the file in a controlled environment.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"search_vec":"'0.2.1':41 'artifact':19 'as-need':47 'basi':50 'bug':54 'build':62 'contain':33 'current':38 'design':10 'directori':32 'distribut':18,26 'extract':13,22 'file':29 'fix':55 'improv':52 'librari':9 'metadata':1,4,15,23,57 'metadata-pleas':3 'need':49 'occur':44 'packag':56 'pleas':2,5 'project':31 'pyproject.toml':34,60 'python':8,17 'releas':43 'sdist':27,58 'setup.py':36,61 'simpl':12 'sourc':25 'support':21 'system':63 'version':39 'wheel':28,59","created_at":"2026-04-16T17:01:33.486137+00:00","updated_at":"2026-04-16T17:01:33.486137+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/python-packaging/metadata-please","docs":null,"changelog":null,"pypi":"https://pypi.org/project/metadata-please/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}