Skip to content

Config in pyproject.toml resolved from the working directory, not the checked path #1017

Description

@jshwi

get_config walks up from Path.cwd(), so the checked path's own project is never consulted.

mkdir -p outer/project
printf 'def _f(x):\n    """Doc."""\n' > outer/project/m.py
printf '[tool.docsig]\n' > outer/project/pyproject.toml
printf '[tool.docsig]\ncheck-protected = true\n' > outer/pyproject.toml

(cd outer/project && python -m docsig m.py)       # exit 0
(cd outer && python -m docsig project/m.py)       # SIG203 + SIG501, exit 1

This contradicts _files.py, which already resolves gitignore patterns from the repo each checked path belongs to. It also affects the neovim plugin, which runs docsig with cwd set to the workspace root while checking a buffer that may live in a subproject.

Config will instead be read from the nearest ancestor of the checked paths whose pyproject.toml contains a [tool.docsig] table — searched from the common ancestor when several paths are given. An empty [tool.docsig] table means the project opts out; a pyproject.toml without one is skipped, so packaging-only manifests in a monorepo don't shadow the root config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions