{"id":27291,"library":"pyproject-dependencies","title":"pyproject-dependencies","description":"A tool to extract dependencies from pyproject.toml files in a robust way. Supports both static and dynamic dependency resolution, including optional dependencies (extras). Compatible with Python 3.7+. Current version: 1.3.2. Release cadence: irregular.","status":"active","version":"1.3.2","language":"python","source_language":"en","source_url":"https://github.com/sbidoul/pyproject-dependencies","tags":["dependencies","pyproject.toml","tool","python"],"install":[{"cmd":"pip install pyproject-dependencies","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Used internally for dependency resolution","package":"pip","optional":true}],"imports":[{"note":"No function named 'dependencies' exists at top level.","wrong":"from pyproject_dependencies import dependencies","symbol":"get_dependencies","correct":"from pyproject_dependencies import get_dependencies"},{"note":"Commonly used to list optional dependency groups.","wrong":"","symbol":"extras","correct":"from pyproject_dependencies import extras"}],"quickstart":{"code":"import os\nfrom pyproject_dependencies import get_dependencies\n\n# Assuming pyproject.toml is in the current directory\nresults = get_dependencies()\nprint('Main dependencies:', results.get('dependencies', []))\nprint('Optional groups:', results.get('extras', {}))\n\n# For a specific directory\nresults = get_dependencies('path/to/project')\nprint('Dependencies from path:', results.get('dependencies', []))","lang":"python","description":"Extract dependencies from a pyproject.toml file. Returns a dict with 'dependencies' (list of strings) and 'extras' (dict mapping group name to list of strings)."},"warnings":[{"fix":"Access results['extras'] to get optional dependency groups.","message":"Optional dependencies are not included in 'dependencies' key; they are in 'extras' dict.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"If using CLI, use --extras flag to see optional dependencies. For API, use results['extras'].","message":"In v1.3, optional dependencies were no longer printed by the CLI. The API behavior changed: extras are only returned as a separate dict key.","severity":"breaking","affected_versions":">=1.3"},{"fix":"Ensure the project can be resolved (e.g., run pip install -e .) before calling get_dependencies, or pre-compute static dependencies.","message":"Dynamic version fields (e.g., from setuptools-scm) can cause resolution failures. v1.3.1 fixed some issues but dynamic deps may still fail.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package: pip install pyproject-dependencies. Import using: from pyproject_dependencies import get_dependencies","cause":"Trying to import the module without installing it or using wrong import name.","error":"ModuleNotFoundError: No module named 'pyproject_dependencies'"},{"fix":"Check that the pyproject.toml follows PEP 621. If using a build backend that doesn't expose deps statically, consider using a different approach.","cause":"The pyproject.toml may not have a [project] table with dependencies, or the tool fails to parse them.","error":"KeyError: 'dependencies'"},{"fix":"Validate the pyproject.toml with a TOML validator.","cause":"The file is not a valid TOML file or missing required sections.","error":"ValueError: Could not parse pyproject.toml: <path>"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}