skill-creator quick_validate.py still fails without undeclared PyYAML dependency

Open 💬 3 comments Opened Jul 14, 2026 by ruonanzh

Summary

skill-creator/scripts/quick_validate.py still fails in a clean Python environment because it imports yaml at module load time, while the bundled skill-creator does not include a requirements.txt, pyproject.toml, or another dependency bootstrap mechanism.

This is related to #11990, but the fix in #12080 only lazy-loaded PyYAML in generate_openai_yaml.py so that init_skill.py can run without PyYAML. It did not update quick_validate.py.

Reproduction

  1. Use a Python environment without PyYAML installed.
  2. Run:
python3 ~/.codex/skills/.system/skill-creator/scripts/quick_validate.py /path/to/a/skill
  1. The script exits before validating the skill:
Traceback (most recent call last):
  ...
ModuleNotFoundError: No module named 'yaml'

Expected

The bundled Skill validator should either:

  • run without undeclared third-party dependencies, or
  • provide and document a deterministic way to install/run its Python dependencies.

Actual

quick_validate.py imports yaml unconditionally:

import yaml

The bundled skill-creator directory does not include a Python dependency manifest, so the validation step documented by the Skill fails on a clean Python installation.

Current source

The same unconditional import is present on main:

codex-rs/skills/src/assets/samples/skill-creator/scripts/quick_validate.py

Environment

  • Codex CLI: 0.135.0
  • OS: macOS Apple Silicon
  • Python environment: clean environment without PyYAML

Suggested fixes

Any of the following would resolve the issue:

  1. Make the validator self-contained.
  2. Bundle a dependency manifest and invoke it through a managed environment.
  3. Add a PEP 723 inline dependency declaration and a documented runner.
  4. At minimum, catch the missing dependency and print an actionable installation command instead of a traceback.

A local workaround is to run the validator in an isolated environment, for example:

uv run --isolated --no-project --with PyYAML python \
  ~/.codex/skills/.system/skill-creator/scripts/quick_validate.py \
  /path/to/a/skill

View original on GitHub ↗

3 Comments

vismaytiwari · 1 month ago

Ran into this one too. The root cause is small: quick_validate.py imports PyYAML at the top of the module, whereas its sibling generate_openai_yaml.py was already switched to a lazy import back in #12080 — this script just got missed in that sweep. So on a clean environment the documented validation step dies with a bare ModuleNotFoundError: No module named 'yaml' before it can tell you anything useful.

Since the validator genuinely needs a YAML parser, the cleanest fix (one of the options you listed) is to import it lazily and turn a missing dependency into an actionable message instead of a traceback — dropping the top-level import yaml and doing this right before it's needed in validate_skill:

    try:
        import yaml
    except ImportError:
        return (
            False,
            "PyYAML is required to validate skills. Install it with "
            "'pip install pyyaml', or run this script via "
            "'uv run --with pyyaml quick_validate.py <skill_directory>'.",
        )

It slots in cleanly because validate_skill already returns (bool, message) and __main__ just prints the message and exits non-zero.

I checked both paths: in a fresh venv without PyYAML it now prints that message and exits 1 (no traceback), and with PyYAML installed it validates exactly as before.

One aside — the same top-level import yaml also lives in plugin-creator/scripts/validate_plugin.py, so it'd hit the same wall; might be worth folding into the same fix. Happy to put a PR together if that's helpful.

x-typo · 1 month ago

Confirmed this still reproduces on a newer macOS desktop/runtime bundle.

Environment:

  • ChatGPT/Codex desktop app: 26.715.31251
  • Workspace runtime bundle: 26.715.12143
  • Codex CLI: 0.144.4
  • macOS: 26.5.2 (25F84), Apple Silicon
  • Homebrew Python: 3.14.4
  • Codex bundled Python: 3.12.13

Both the default Homebrew Python and Codex's bundled Python fail before validation starts:

python3 $CODEX_HOME/skills/.system/skill-creator/scripts/quick_validate.py <valid-skill-directory>

Traceback (most recent call last):
  File ".../quick_validate.py", line 10, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

So the documented validator still cannot run with either Python environment supplied/available to Codex without an ad hoc dependency installation or substitute validator.

ashahabov · 1 month ago

I reproduced this with the Codex Desktop bundled Python on Windows 11. importlib.util.find_spec("yaml") returns None:

# powershell
$codexPython = "$env:USERPROFILE\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
& $codexPython -c "import importlib.util; print(importlib.util.find_spec('yaml'))"

and because import yaml runs at module level, quick_validate.py exits before it evaluates the skill when PyYAML is unavailable.

This is the same failure reported in #24195 and #30935, and the unconditional import remains in current main.

The uv run --with PyYAML workaround validates the skill, but it relies on a user-managed environment; installing into the Codex runtime is not durable because runtime and bundle updates replace it.

Could a maintainer confirm the intended resolution and invite an external PR? I would keep the change narrow: make the validator's dependency contract deterministic (the team-preferred option of declared/bundled PyYAML or a supported self-contained fallback).