-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linting conda-forge.yml
does not diagnose (some) schema violations
#2152
Comments
h-vetinari
changed the title
Linting CBC does not diagnose wrong usage correctly
Linting Nov 21, 2024
conda-forge.yml
does not diagnose (some) schema violations
With an addition of from conda.base.constants import KNOWN_SUBDIRS
from pydantic import ConfigDict, Field, create_model
from enum import StrEnum
dirs = [subdir.replace("-", "_") for subdir in KNOWN_SUBDIRS if "-" in subdir]
Platforms = StrEnum("Platforms", dirs)
BuildPlatform = create_model(
"build_platform",
__config__=ConfigDict(extra='forbid'),
**{
platform.value: (Platforms, Field(default=platform.value))
for platform in Platforms
},
) to yield >>> BuildPlatform(wrong="linux_64")
pydantic_core._pydantic_core.ValidationError: 1 validation error for build_platform
wrong
Extra inputs are not permitted [type=extra_forbidden, input_value='linux_64', input_type=str]
For further information visit https://errors.pydantic.dev/2.9/v/extra_forbidden However, if I add |
3 tasks
I found that the work for this has already been done by @ytausch in #1920. I merged main in that PR and verified that it correctly diagnoses wrong values (as hints), and with a pretty nice message too:
|
This was referenced Nov 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following file as
conda-forge.yml
yields a clean slate from the linterdespite the fact that, based on
schema.py
(or at least the obvious intent there), it should fail:conda-smithy/conda_smithy/schema.py
Lines 548 to 563 in 2b18d8d
All three of those are using pydantic's
create_model
, which I presume is not working as intended here.The text was updated successfully, but these errors were encountered: