{"library":"pyproject-toml","title":"pyproject-toml","description":"pyproject-toml is a Python library designed to parse and manage `pyproject.toml` files according to various PEPs, including PEP 517, 518, 621, and 631. It provides a structured way to access project metadata and build system configuration. The current version is 0.1.0, and it follows an infrequent release cadence based on new PEP implementations or bug fixes.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pyproject-toml"],"cli":null},"imports":["from pyproject_toml import PyProjectTOML"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pyproject_toml import PyProjectTOML\n\n# Create a dummy pyproject.toml for the example\ndummy_toml_content = \"\"\"\n[project]\nname = \"my-dummy-project\"\nversion = \"0.1.0\"\ndescription = \"A short description.\"\nrequires-python = \">=3.9\"\nauthors = [\n  {name = \"Jane Doe\", email = \"jane@example.com\"},\n]\n\"\"\"\nwith open(\"pyproject.toml\", \"w\") as f:\n    f.write(dummy_toml_content)\n\ntry:\n    # Initialize and load the pyproject.toml file\n    pyproject = PyProjectTOML()\n    data = pyproject.load()\n\n    # Access project metadata\n    project_name = data[\"project\"][\"name\"]\n    project_version = data[\"project\"][\"version\"]\n\n    print(f\"Project Name: {project_name}\")\n    print(f\"Project Version: {project_version}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Clean up the dummy file\n    if os.path.exists(\"pyproject.toml\"):\n        os.remove(\"pyproject.toml\")\n","lang":"python","description":"This quickstart demonstrates how to programmatically create a dummy `pyproject.toml` file, load it using `PyProjectTOML`, and access common project metadata like name and version. The example cleans up the created file afterwards.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}