{"id":432,"library":"docstring-parser","title":"docstring-parser","description":"A Python library for parsing docstrings in reST, Google, and Numpydoc formats. Current version: 0.17.0, released on July 21, 2025. Maintained with a stable release cadence.","status":"active","version":"0.17.0","language":"python","source_language":"en","source_url":"https://github.com/rr-/docstring_parser","tags":["docstring","parsing","reST","Google","Numpydoc"],"install":[{"cmd":"pip install docstring-parser","lang":"bash","label":"Install docstring-parser"}],"dependencies":[{"reason":"Provides type hints for Python 3.8 and earlier versions","package":"typing","optional":false}],"imports":[{"note":"Ensure correct import path to access the 'parse' function.","symbol":"parse","correct":"from docstring_parser import parse"}],"quickstart":{"code":"from docstring_parser import parse\n\n# Sample docstring\ndocstring = \"\"\"\nThis is a sample function.\n\n:param x: The input value\n:type x: int\n:return: The squared value of x\n:rtype: int\n\"\"\"\n\n# Parse the docstring\nparsed = parse(docstring)\n\n# Access parsed components\nprint(f\"Description: {parsed.short_description}\")\nprint(f\"Parameters: {parsed.params}\")\nprint(f\"Returns: {parsed.returns}\")","lang":"python","description":"A quickstart guide demonstrating how to parse a sample docstring using the 'parse' function from docstring_parser."},"warnings":[{"fix":"Update function calls to include the 'style' parameter, e.g., 'parse(docstring, style=DocstringStyle.AUTO)'.","message":"In version 0.17.0, the 'parse' function now requires the 'style' parameter to be explicitly set. Omitting it will raise a TypeError.","severity":"breaking","affected_versions":"0.17.0"},{"fix":"Replace calls to 'parse_from_object' with 'parse' and specify the 'style' parameter.","message":"The 'parse_from_object' function is deprecated and will be removed in a future release. Use 'parse' with the appropriate style parameter instead.","severity":"deprecated","affected_versions":"0.17.0"},{"fix":"Always specify the correct 'style' parameter when calling 'parse'.","message":"When parsing docstrings with the 'parse' function, ensure that the 'style' parameter matches the docstring format (e.g., 'reST', 'Google', 'Numpydoc') to avoid parsing errors.","severity":"gotcha","affected_versions":"0.17.0"}],"env_vars":null,"last_verified":"2026-05-12T13:45:42.243Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install docstring-parser`","cause":"The 'docstring_parser' library has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'docstring_parser'"},{"fix":"Ensure only one version of `docstring-parser` (and no conflicting forks) is installed and that it's up to date. Uninstall conflicting packages and reinstall `docstring-parser`.","cause":"This error typically occurs due to incompatible versions of `docstring-parser` or conflicts with a `docstring-parser-fork` package, where the expected class `DocstringAttr` may not exist or has been renamed in the installed version.","error":"ImportError: cannot import name 'DocstringAttr' from 'docstring_parser.common'"},{"fix":"Correct the docstring format to adhere strictly to the expected style, ensuring parameters are defined with a colon, e.g., `param_name: description`.","cause":"The docstring being parsed, particularly in Google style (e.g., in an `Args:` section), has a malformed entry where a colon (':') is expected but another character (like a hyphen '-') is found, causing the `split` operation to fail.","error":"ValueError: not enough values to unpack (expected 2, got 1)"},{"fix":"Either add the missing parameter to the function's signature or remove its documentation from the docstring to match the actual function definition.","cause":"A parameter is documented in the function's docstring (e.g., using `@param` or `Args:`) but does not actually exist in the function's definition (its signature).","error":"ValueError: Arg X in docstring not found in function signature"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.03,"mem_mb":1.5,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.07,"mem_mb":1.8,"disk_size":"19.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":1.8,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.07,"mem_mb":1.7,"disk_size":"11.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.06,"mem_mb":1.7,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":2,"disk_size":"11.4M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.05,"mem_mb":1.8,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.03,"mem_mb":1.5,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.02,"mem_mb":1.5,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}