{"id":8509,"library":"pyproject-parser","title":"pyproject-parser","description":"pyproject-parser is a Python library designed to parse and access data from 'pyproject.toml' files, adhering to PEP 517 and PEP 621 specifications. It simplifies programmatic access to project metadata, build system configurations, and other sections defined in 'pyproject.toml'. The library is actively maintained, with frequent releases, often including pre-releases (betas) before stable versions, and is currently at version 0.14.0.","status":"active","version":"0.14.0","language":"en","source_language":"en","source_url":"https://github.com/repo-helper/pyproject-parser","tags":["pyproject","toml","parser","build-system","pep517","pep621"],"install":[{"cmd":"pip install pyproject-parser","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for TOML parsing.","package":"tomlkit"}],"imports":[{"note":"The primary class for parsing is now directly exposed in the top-level package.","wrong":"from pyproject_parser.parser import PyProject","symbol":"PyProject","correct":"from pyproject_parser import PyProject"}],"quickstart":{"code":"from pyproject_parser import PyProject\nfrom pathlib import Path\n\n# Create a dummy pyproject.toml for demonstration\ndummy_toml_content = '''\n[project]\nname = \"my-awesome-project\"\nversion = \"0.1.0\"\nauthors = [\n    {name = \"John Doe\", email = \"john@example.com\"}\n]\ndescription = \"A minimal project\"\nreadme = \"README.md\"\nrequires-python = \">=3.8\"\nkeywords = [\"python\", \"example\"]\nclassifiers = [\n    \"Programming Language :: Python :: 3\"\n]\n\n[build-system]\nrequires = [\"setuptools>=61.0.0\", \"wheel\"]\nbuild-backend = \"setuptools.build_meta\"\n'''\n\ndummy_toml_path = Path(\"dummy_pyproject.toml\")\ndummy_toml_path.write_text(dummy_toml_content)\n\ntry:\n    project = PyProject.from_path(dummy_toml_path)\n\n    print(f\"Project Name: {project.name}\")\n    print(f\"Project Version: {project.version}\")\n    print(f\"Required Python: {project.requires_python}\")\n    if project.authors:\n        print(f\"Author: {project.authors[0].name} <{project.authors[0].email}>\")\nfinally:\n    # Clean up the dummy file\n    dummy_toml_path.unlink()","lang":"python","description":"This quickstart demonstrates how to load a 'pyproject.toml' file and access its project metadata using the `PyProject` class and its `from_path` method. It creates a temporary dummy 'pyproject.toml' to ensure the example is runnable."},"warnings":[{"fix":"Review the `CHANGELOG.rst` for detailed changes. Adapt code to use the new `PyProject` constructor signature and access metadata via `project.name`, `project.version`, etc. instead of deprecated properties.","message":"Major API overhaul in versions 0.9.0 and 0.10.0 introduced significant breaking changes to the PyProject class's constructor and property names (e.g., `project_name` was renamed to `name`, `project` property removed).","severity":"breaking","affected_versions":"0.9.0, 0.10.0"},{"fix":"Update calls from `PyProject.from_path(path=some_path)` to `PyProject.from_path(filename=some_path)`.","message":"The `PyProject.from_path()` method's `path` argument was renamed to `filename` in version 0.10.0.","severity":"breaking","affected_versions":"0.10.0"},{"fix":"Replace usage of `parse()` or `load()` with `PyProject.from_path()` or `PyProject.from_string()`.","message":"The top-level `parse` and `load` helper functions (e.g., `from pyproject_parser import parse`) were removed in version 0.12.0.","severity":"breaking","affected_versions":"0.12.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change `project.project_name` to `project.name`.","cause":"In versions 0.10.0 and later, the `project_name` property was removed and replaced by the `name` property to align with PEP 621.","error":"AttributeError: 'PyProject' object has no attribute 'project_name'"},{"fix":"Update the call to use `PyProject.from_path(filename=my_path)` instead of `PyProject.from_path(path=my_path)`.","cause":"The argument for specifying the TOML file path was renamed from `path` to `filename` in version 0.10.0.","error":"TypeError: PyProject.from_path() got an unexpected keyword argument 'path'"},{"fix":"Refactor code to use `PyProject.from_path()` for file parsing or `PyProject.from_string()` for string content.","cause":"The standalone `parse` and `load` helper functions were removed in version 0.12.0, consolidating parsing functionality into the `PyProject` class.","error":"ImportError: cannot import name 'parse' from 'pyproject_parser'"}]}