Skip to content

Support syncing other pyproject.toml tool configurations (e.g., mypy, pytest) #69

@Kilo59

Description

@Kilo59

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

  1. Generalize the configuration: Add a tools option to [tool.ruff-sync] in pyproject.toml.
    [tool.ruff-sync]
    # upstream = "..."
    tools = ["ruff", "mypy", "pytest"]  # Default: ["ruff"]
  2. CLI argument: Add a --tool or --tools flag to specify which tools to sync.
    ruff-sync <URL> --tool mypy --tool ruff
  3. 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.

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