Skip to content

[FR] Tool-specific toml config #1643

Open
@webknjaz

Description

@webknjaz

Is your feature request related to a problem? Please describe.

I maintain enough projects to have a need to synchronize the configs occasionally. Synchronizing configs where sections tend to get shuffled is rather tricky on scale, which is one of the reasons for keeping configs in tool-specific files (the other reason, for me, is that it also makes it obvious where to look for a config right away). Some projects also make use of git skeletons that employ git merge to synchronize configs that are primarily maintained in an upstream "skeleton" repository to downstreams that may occasionally diverge over time — in such case, having configs separate also helps with reducing merge conflicts a lot.

.coveragerc already solves this problem, but since the ecosystem seems to be moving away from plain INI files (because of some shortcomings) towards using TOML, it seems natural for coverage.py to also have a TOML version of such a config.

Why not pyproject.toml? It's suitable for people who don't have to maintain similar configs for different tools across many projects, which is not my case, hence the feature request...

Describe the solution you'd like

I think there should be a .coveragerc.toml where people could put their configs that would take precedence over all other files (provided that either of tomli or tomllib is importable).
I expect that the structure (section names etc.) would be exactly the same as for pyproject.toml to allow for easy migration between the two (plus, it's easier to maintain as the parsing code could essentially be the same).

Describe alternatives you've considered

Keeping the config in .coveragerc.

Additional context

One example of using the Git skeleton approach is https://blog.jaraco.com/skeleton/.
Among other tools following this approach are Towncrier (supports towncrier.toml and pyproject.toml with the section name [tool.towncrier]) and pip-tools (supports .pip-tools.toml and pyproject.toml with the section name [tool.pip-tools]; release pending).

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