Skip to content

[FEATURE]: Read configuration from pyproject.toml #231

@tahv

Description

@tahv

Feature Description

It would be nice if codebook could parse the configuration from a pyproject.toml in the project directory. pyproject.toml allows for arbitrary tool configuration in the [tool] table.

Use Case

Python projects tend to centralize tools configuration in pyproject.toml.

Proposed Solution

  • If codebook.toml or .codebook.toml are not found in the project directory, look for a pyproject.toml.
  • If [tool.codebook] exists, parse it for configuration.
  • It's expected that settings under [tool.codebook] are the same as codebook.toml root.

Alternative Solutions

No response

Examples

The README.md Configuration Options in a pyproject.toml.

[tool.codebook]
dictionaries = ["en_us", "en_gb"]
words = ["codebook", "rustc"]
flag_words = ["todo", "fixme"]
include_paths = ["src/**/*.rs", "lib/**/*.rs"]
ignore_paths = ["target/**/*", "**/*.json", ".git/**/*"]
ignore_patterns = [
    '\b[ATCG]+\b',
    '\d{3}-\d{2}-\d{4}',
    '^[A-Z]{2,}$',
    'https?://[^\s]+'
]
min_word_length = 3
use_global = true

Additional Context

Example references:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions