Skip to content
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

fix: regenerate schema #1993

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion conda_smithy/data/conda-forge.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@
"Nullable": {
"const": null,
"description": "Created to avoid issue with schema validation of null values in lists or dicts.",
"enum": [
null
],
"title": "Nullable"
},
"Platforms": {
Expand Down Expand Up @@ -1712,7 +1715,8 @@
"conda-build",
"conda-build+classic",
"conda-build+conda-libmamba-solver",
"mambabuild"
"mambabuild",
"rattler-build"
],
"type": "string"
},
Expand Down
6 changes: 3 additions & 3 deletions conda_smithy/data/conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ azure:
pool:
vmImage: ubuntu-latest
swapfile_size: 0GiB
timeoutInMinutes: 360
timeout_in_minutes: 360
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused how this will affect us. This change appeared because the corresponding Pydantic model field was renamed from timeoutInMinutes to timeout_in_minutes in the ruff PR, so that is right, @wolfv.

To not change our schema though, I set this alias here:

timeout_in_minutes: Optional[int] = Field(
default=360,
description="Timeout in minutes for the job",
alias="timeoutInMinutes",
)

However, because we save the default values with model_dump, which by default does not respect aliases this defaults yaml file now has a different field name.

This actually breaks the logic setting field defaults, I suppose:

def _read_forge_config(forge_dir, forge_yml=None):
# Load default values from the conda-forge.yml file
with open(CONDA_FORGE_YAML_DEFAULTS_FILE) as fh:
default_config = yaml.safe_load(fh.read())
if forge_yml is None:
forge_yml = os.path.join(forge_dir, "conda-forge.yml")
if not os.path.exists(forge_yml):
raise RuntimeError(
f"Could not find config file {forge_yml}."
" Either you are not rerendering inside the feedstock root (likely)"
" or there's no `conda-forge.yml` in the feedstock root (unlikely)."
" Add an empty `conda-forge.yml` file in"
" feedstock root if it's the latter."
)
with open(forge_yml) as fh:
documents = list(yaml.safe_load_all(fh))
file_config = (documents or [None])[0] or {}
# Validate loaded configuration against a JSON schema.
validate_lints, validate_hints = validate_json_schema(file_config)
for err in chain(validate_lints, validate_hints):
logger.warning(
"%s: %s = %s -> %s",
os.path.relpath(forge_yml, forge_dir),
err.json_path,
err.instance,
err.message,
)
logger.debug("Relevant schema:\n%s", json.dumps(err.schema, indent=2))
# The config is just the union of the defaults, and the overridden
# values.
config = _update_dict_within_dict(file_config.items(), default_config)

variables: {}
settings_osx:
pool:
vmImage: macOS-12
swapfile_size: null
timeoutInMinutes: 360
timeout_in_minutes: 360
variables: {}
settings_win:
pool:
vmImage: windows-2022
swapfile_size: null
timeoutInMinutes: 360
timeout_in_minutes: 360
variables:
CONDA_BLD_PATH: D:\\bld\\
UPLOAD_TEMP: D:\\tmp
Expand Down
Loading