Skip to content

Commit 343f791

Browse files
Improve read_pyproject docstring with reStructuredText format
Convert docstring to reStructuredText format and document both test hooks (_given_result and _given_definition). Clarifies that _given_definition is ignored when _given_result is provided. Note: Python 3.10 pin removed from pre-commit configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ec99afe commit 343f791

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ repos:
1818
hooks:
1919
- id: mypy
2020
args: [--strict]
21-
language_version: "3.10"
2221
additional_dependencies:
2322
- types-setuptools
2423
- tokenize-rt==3.2.0

src/setuptools_scm/_integration/pyproject_reading.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,19 @@ def read_pyproject(
178178
) -> PyProjectData:
179179
"""Read and parse pyproject configuration.
180180
181-
This function supports dependency injection for tests via `_given_result`.
182-
183-
Parameters:
184-
- path: Path to the pyproject file
185-
- tool_name: The tool section name (default: `setuptools_scm`)
186-
- canonical_build_package_name: Normalized build requirement name
187-
- _given_result: Optional testing hook. Can be:
188-
- PyProjectData: returned directly
189-
- InvalidTomlError | FileNotFoundError: raised directly
190-
- None: read from filesystem
181+
This function supports dependency injection for tests via ``_given_result``
182+
and ``_given_definition``.
183+
184+
:param path: Path to the pyproject file
185+
:param tool_name: The tool section name (default: ``setuptools_scm``)
186+
:param canonical_build_package_name: Normalized build requirement name
187+
:param _given_result: Optional testing hook. Can be:
188+
- ``PyProjectData``: returned directly
189+
- ``InvalidTomlError`` | ``FileNotFoundError``: raised directly
190+
- ``None``: read from filesystem (default)
191+
:param _given_definition: Optional testing hook to provide parsed TOML content.
192+
When provided, this dictionary is used instead of reading and parsing
193+
the file from disk. Ignored if ``_given_result`` is provided.
191194
"""
192195

193196
if _given_result is not None:

0 commit comments

Comments
 (0)