code: def update_ml_package_versions_py(config_path):
      with open(config_path) as f:
          config = {}
          for name, cfg in yaml.load(f, Loader=yaml.SafeLoader).items():
              # Extract required fields
              pip_release = extract_field(
                  cfg, ("package_info", "pip_release")
              )
              min_version = extract_field(cfg, ("models", "minimum"))
              max_version = extract_field(cfg, ("models", "maximum"))
              if min_version:
                  config[name] = {
                      "package_info": {
                          "pip_release": pip_release,
                      },
                      "models": {
                          "minimum": min_version,
                          "maximum": max_version,
                      },
                  }
              else:
                  config[name] = {
                      "package_info": {
                          "pip_release": pip_release,
                      }
                  }
  
              min_version = extract_field(
                  cfg, ("autologging", "minimum")
              )
              max_version = extract_field(
                  cfg, ("autologging", "maximum")
              )
              if (pip_release, min_version, max_version).count(
                  None
              ) > 0:
                  continue
  
              config[name].update(
                  {
                      "autologging": {
                          "minimum": min_version,
                          "maximum": max_version,
                      }
                  },
              )
  
          this_file = Path(__file__).name
          dst = Path("mlflow", "ml_package_versions.py")
          config = json.dumps(config, indent=4)
          Path(dst).write_text(
              f"""\
  # This file was auto-generated by {this_file}.
  # Please do not edit it manually.
  
  _ML_PACKAGE_VERSIONS = {config}
  """
          )
  
file_path: mlflow/dev/update_ml_package_versions.py
imports: import json
  import re
  import urllib.request
  from pathlib import Path
  import yaml
  from packaging.version import Version
label_desc: Use image node_id 7 for calling a global function with example usage: update_ml_package_versions_py(config_path) without return types