Allow storing config in Cargo.toml
Cargo manifests have a standardized way to store TOML data that configures third party tooling. The [package.metadata.bacon] space in Cargo.toml could be used to hold Bacon configs instead of a stand alone bacon.toml file. This is supported by many developer tools that are used in Rust or Rust adjacent projects, e.g. ruff, typos, git-cliff, and many more.
Obviously this should be optional, but checking that key in the manifest for config data in addition to the default stand alone config location would be appreciated by projects that already have enough clutter in the project root file space and prefer to group tooling configs together.
Interesting.
A problem is the bacon.toml file is neither small nor flat. This would probably be quite ugly.
Also, the need to prefix all keys would make it harder to copy paste between config files.
Did you try writing a Cargo.toml file with bacon config inside to see how it would look ?
Yes I am aware of exactly how it would look, and yes the extra prefix to the namespace adds verbosity. But "that would be ugly" sees like a subjective metric that should be left up to the end user. I'm not suggesting making it the default or taking away the current stand alone config option. I work on projects that go both ways and there are pros and cons for both. As far as Bacon's side goes all you have to do is load the TOML and query the correct namespace, then remove the prefix from everything. It shouldn't be too much trouble to implement or maintain and it lets projects manage their tooling however they want to along with many other tools that work the same way.
It shouldn't be too much trouble to implement
Exact.
then remove the prefix from everything
This won't be necessary if the TOML file is deserialized into the right struct.
Can you build a complete example file to serve as example and as test ?
Currently working bacon.toml:
default_job = "build"
[jobs.build]
command = [
"cargo", "build",
"--features", "luajit",
"--color", "always"
]
Proposed lines to enable the same behavior in Cargo.toml:
[package.metadata.bacon]
default_job = "build"
[package.metadata.bacon.jobs.build]
command = [
"cargo", "build",
"--features", "luajit",
"--color", "always"
]
@alerque Can you check https://github.com/Canop/bacon/pull/270 ?
Nice! I'll try to give it a test drive, possibly tomorrow.
In the mean time it wasn't relevant when I opened this issue since bacon was Rust only then, but Python projects can have something similar with pyproject.toml housing config data for Python tooling (e.g. typos, ruff, etc.). Since you're coming out with new config places and now Bacon supports Pylint, it might be worth pre-empting the requests for that while you are at it. It works the same way.
I saw you mentionned it in the other issue, and it's a good point.
But there doesn't seem to be any Python+bacon user yet, so I'll wait before investing more time on Python support.