hatch.toml in .config under project root
Thanks for a very useful project. We are standardising on Hatch across all our projects and want to put tools configuration in a .config folder under the project root where possible.
Is it possible to put hatch.toml is a subdirectory under project root eg. MY_PROJECT_ROOT/.config/hatch.toml?
If not, would you consider adding support for either specifying a path to hatch.toml or specifically allowing MY_PROJECT_ROOT/.config/hatch.toml as a default location that Hatch looks in?
~~Top-level --config https://hatch.pypa.io/latest/cli/reference/~~
Nevermind
We're looking to put the project-specific settings (i.e. those that usually go in pyproject.toml or hatch.toml) in .config/hatch.toml. It looks like the --config option above is for general hatch configuration.
The text here implies that the project configuration file must be located in the project root: "By default, Hatch will look for a pyproject.toml file in the current working directory and any parent directories. The directory storing the first found file will be considered the project root." Could you confirm that this is the case?
Yes that is correct. And you're right I interpreted this issue to be about Hatch configuration, sorry about that.
Sure, I am comfortable with adding a fallback to .config/hatch.toml.
@ofek We have a nice Hatch setup now for our projects eg. https://github.com/OCHA-DAP/hdx-python-country. We use Hatch in GitHub Actions for running lint and tests as well as publishing to PyPI. All of our configuration is under .config (Black, Ruff, pre-commit, pytest, coverage). Putting hatch.toml in there will be the icing on the cake.
@ofek Just wondering if you'd be able to look into this issue? We're still keeping hatch config in pyproject.toml but would be great to be able to move it to .config/hatch.toml
Also when using fmt is it possible to tell it to look under .config for ruff.toml when using the following to make it use our ruff config rather than Hatch defaults?
[tool.hatch.envs.hatch-static-analysis]
config-path = "none"
Sorry for the wait, this will be in the next release.
Yes you can put your Ruff config there.
@ofek Just checking to see if you'd be able to look into adding support for .config/hatch.toml?