r/learnpython • u/PhilosopherNext1448 • 55m ago
How do you centralize tool configurations (ty, ruff, pytest, ...) between multiple repositories?
In our software department we have a few dozen python libraries that different teams maintain, some open source, some closed source. I'm trying to centralize commonalities between them so that all pipelines run the same stages, that all pre-commit hooks are the same, and so on. I got most of it working, except that I don't have a good way to centralize configurations. For example I want all repos to use a common set of ruff linter rules, all documentation builds to use the same template and plugins, pin the most of the [dev] dependencies to the same versions..
Was wondering if anyone has experience with this :) I've been back and forth with Claude for quite a while, but I wasn't a fan of its ideas (using templates, copier, custom scripts, monorepo)
•
u/SCD_minecraft 46m ago
Solution for that i saw (but not used personally) is monorepo
Basically, multiple repositories in one acual repository plus some dedicated tool to manage that
•
u/neural_dataops 25m ago
Since you want to avoid a monorepo and template drift across dozens of repos, the cleanest native pattern in Python is publishing a lightweight internal meta-package (like company-dev-tools) to your private PyPI or artifact registry.
Put ruff, ty, pytest, and pre-commit with exact pinned versions inside that meta-package's pyproject.toml. Every repo then declares just a single dev dependency on company-dev-tools, so Renovate or Dependabot updates all of them across every repo with one version bump.
For sharing Ruff and docs configs without copying files around, Ruff supports extend in pyproject.toml. You can either ship a base ruff.toml inside your internal wheel and point repos to it, or use a reusable CI workflow (GitHub Actions or GitLab CI) that injects the central ruff.toml and Sphinx/MkDocs config at pipeline runtime while still letting individual repos override specific rules locally. For pre-commit, pointing repo in .pre-commit-config.yaml to an internal pre-commit-hooks git tag lets you update hook versions everywhere with a standard pre-commit autoupdate PR.
Which CI platform are you running? That usually decides whether injecting configs in the CI pipeline or bundling them inside the dev wheel feels cleaner.
•
u/Due-Mortgage-6854 20m ago
publish a company-dev-tools meta-package