Currently, ruff-sync is highly focused on syncing the [tool.ruff] section of pyproject.toml. While Ruff is becoming the standard for many Python linting and formatting tasks, many projects still use other tools that store their configuration in pyproject.toml, such as:
- mypy:
[tool.mypy]
- pytest:
[tool.pytest.ini_options]
- coverage:
[tool.coverage.run], [tool.coverage.report]
It would be great if ruff-sync could be generalized to sync a user-defined list of tools from the upstream pyproject.toml.
Proposed Changes
- Generalize the configuration: Add a
tools option to [tool.ruff-sync] in pyproject.toml.
[tool.ruff-sync]
# upstream = "..."
tools = ["ruff", "mypy", "pytest"] # Default: ["ruff"]
- CLI argument: Add a
--tool or --tools flag to specify which tools to sync.
ruff-sync <URL> --tool mypy --tool ruff
- Mapping tool names to table paths: Most tools use
[tool.<name>], but some might need more specific paths (e.g., pytest often uses [tool.pytest.ini_options]). We might need a way to handle these or just support top-level [tool.<name>] by default.
Implementation Ideas
- Refactor
get_ruff_tool_table and merge_ruff_toml to be generic (e.g., get_tool_table(doc, tool_name) and merge_tool_config(source, upstream, tool_name)).
- Iterate through the list of requested tools and perform the sync/merge for each.
Why?
This would make ruff-sync even more powerful for maintaining organization-wide standards across multiple repositories beyond just Ruff settings.
Currently,
ruff-syncis highly focused on syncing the[tool.ruff]section ofpyproject.toml. While Ruff is becoming the standard for many Python linting and formatting tasks, many projects still use other tools that store their configuration inpyproject.toml, such as:[tool.mypy][tool.pytest.ini_options][tool.coverage.run],[tool.coverage.report]It would be great if
ruff-synccould be generalized to sync a user-defined list of tools from the upstreampyproject.toml.Proposed Changes
toolsoption to[tool.ruff-sync]inpyproject.toml.--toolor--toolsflag to specify which tools to sync.[tool.<name>], but some might need more specific paths (e.g.,pytestoften uses[tool.pytest.ini_options]). We might need a way to handle these or just support top-level[tool.<name>]by default.Implementation Ideas
get_ruff_tool_tableandmerge_ruff_tomlto be generic (e.g.,get_tool_table(doc, tool_name)andmerge_tool_config(source, upstream, tool_name)).Why?
This would make
ruff-synceven more powerful for maintaining organization-wide standards across multiple repositories beyond just Ruff settings.