conda-forge / conda-smithy

The tool for managing conda-forge feedstocks.
https://conda-forge.org/
BSD 3-Clause "New" or "Revised" License
152 stars 183 forks source link

ENH: lint incorrect distro names in `os_version` #2155

Open h-vetinari opened 1 day ago

h-vetinari commented 1 day ago

This is for linting wrong distro values used in os_version (which becomes more important after https://github.com/conda-forge/conda-forge-pinning-feedstock/pull/6626, as it might lead to zipping problems and thus rerender errors).

With this PR, a conda-forge.yml of

os_version:
  linux_64: wrong

would lead to

pydantic_core._pydantic_core.ValidationError: 1 validation error for ConfigModel
os_version.linux_64
  Input should be 'cos7', 'ubi8', 'alma8' or 'alma9' [type=literal_error, input_value='wrong', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error

We'll certainly want to polish this further (e.g. into a concrete hint/lint), hence this is a draft. It's also a draft because by themselves, the changes in dc74f555ef90a16113732f7015a1f1507f9e5c66 do not work. It needs #1920 (or something similar) to actually work, see #2152. Currently it includes that PR, which should be merged first.

isuruf commented 7 hours ago

Why do you need the other PR for this PR? Shouldn't your last commit work on its own?

h-vetinari commented 7 hours ago

Why do you need the other PR for this PR? Shouldn't your last commit work on its own?

I thought so too, but I've tested it, and it has no effect (which is why I ended up opening #2152)

h-vetinari commented 7 hours ago

Although, now with the discussions about the JSON schema etc. - perhaps I'm missing whatever the equivalent of https://github.com/conda-forge/conda-smithy/pull/2155/commits/efb395fd16bfd3dea8c8e1e63085f3173a97c887 is on the JSON side? 🤔

h-vetinari commented 7 hours ago

perhaps I'm missing whatever the equivalent of https://github.com/conda-forge/conda-smithy/commit/efb395fd16bfd3dea8c8e1e63085f3173a97c887 is on the JSON side? 🤔

Yeah, I hadn't gotten how the JSON schema needs to be regenerated after changing the pydantic model.

Opened an issue for making that more obvious: https://github.com/conda-forge/conda-smithy/issues/2160