gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
1.01k stars 35 forks source link

Fix `source_roots` in JSON schema #282

Closed edgarrmondragon closed 2 weeks ago

edgarrmondragon commented 2 weeks ago

Hi πŸ‘‹

Trying out tach for the first time in some personal and work projects and already loving it!

I noticed the JSON schema is outdated, so this PR is a small patch to fix it.

Maybe it's worth doing something like https://github.com/astral-sh/ruff/commit/4888afd423c3d730e7840399d34227e2f4679277 and publish the schema to https://github.com/SchemaStore/schemastore?

emdoyle commented 2 weeks ago

The ruff commit is super helpful, I had never heard of schemars before!

I think the reason this probably wasn't caught recently is because of our move from YML to TOML -- we used to have a directive at the top of our YML file, but that didn't seem to work for TOML, do you have type hints for the schema working in your IDE?

I'm definitely open to publishing on SchemaStore as well, I'll look into that.

edgarrmondragon commented 1 week ago

do you have type hints for the schema working in your IDE?

Yeah, I use VSCode with Taplo's Even Better TOML extension and configured it to use the schema in this repo with

// .vscode/settings.json
{
    "evenBetterToml.schema.associations": {
        "tach\\.toml": "https://raw.githubusercontent.com/gauge-sh/tach/main/public/tach-yml-schema.json"
    }
}
edgarrmondragon commented 1 week ago

do you have type hints for the schema working in your IDE?

Yeah, I use VSCode with Taplo's Even Better TOML extension and configured it to use the schema in this repo with

// .vscode/settings.json
{
    "evenBetterToml.schema.associations": {
        "tach\\.toml": "https://raw.githubusercontent.com/gauge-sh/tach/main/public/tach-yml-schema.json"
    }
}

... and I just realized that instead of changing the VSCode settings, putting this line at the top of tach.toml also works for that extension:

#:schema https://raw.githubusercontent.com/gauge-sh/tach/main/public/tach-yml-schema.json
exclude = [
    ".*__pycache__",
]
source_roots = [
    "src",
]
exact = true
forbid_circular_dependencies = true
ignore_type_checking_imports = true

...