Charm Tech will have recommendations for how to manage multiple charms in a monorepo coming this cycle, with a focus on using a single repo for the machine and Kubernetes versions of a charm. We may also be able to spend some time helping with setting this up for one or two charms – get in touch if this sounds interesting to you.
In the meantime, if you’re working on something similar, you may find it useful to know how to point standard Python development tools to a repository level pyproject.toml
file. I’m using ...
in these examples where you would fill in the relative path to this file.
-
ruff: add
extend = ...
to the[tool.ruff]
table in thepyproject.toml
files in subdirectories. Options set in this file will override those in the repo level file. -
pyright: add
extends = ...
to the[tool.pyright]
table in thepyproject.toml
files in subdirectories. Options set in this file will override those in the repo level file. Note that it must be extends, not extend, which will be silently ignored. -
codespell: Use the
--toml=...
CLI option where you invokecodespell
. Note that settings in this explicitly passed file will override those in locally discovered config files. Don’t use--config=...
, which only accepts anINI
file. -
coverage: Set the
COVERAGE_RCFILE
environment variable or use the--rcfile=...
CLI option where you invokecoverage
. Only a single config file is used – explicitly pointingcoverage
to a config file like this will make it ignore any locally discoverable config files. -
pytest: Put all your config in the repo level
pyproject.toml
file.pytest
will automatically look upwards until it finds a valid config – so if you put anypytest
config in a subdirectory,pytest
invocations from there won’t find the repo level config.