skill.wheel¶
The wheel-included-skills placement method: a tested build recipe.
The real skill files live once, in the repository’s top-level skills/<name>/ (where
gh skill and the wider ecosystem look), and the build copies that folder into the
wheel as <pkg>/_skills/ so a pip install carries them too (addaix/skill#8, #31).
The copy exists only in the built wheel, never in the repository, so gh skill sees
each skill once; it is a copy, never a symlink, because whether gh skill follows a
symlink is unverified.
wheel_skills_config()gives thepyproject.tomlsettings as a dict (hatchling or setuptools), to merge into an existing file;wheel_skills_snippet()the same as TOML text, for a file that has no such table yet.check_wheel_skills()checks a built wheel against the repository: everyskills/<name>/file is in the wheel under<pkg>/_skills/<name>/, byte for byte, everySKILL.mdexactly once, and the repository holds each skill once.skill install-from-package <distribution>then finds<pkg>/_skillsin the installed package (skill.install.PACKAGE_SKILLS_SUBPATHS).
>>> print(wheel_skills_snippet("my_pkg"))
[tool.hatch.build.targets.wheel.force-include]
"skills" = "my_pkg/_skills"
Module Attributes
The folder, inside the import package, that the build copies |
Functions
|
The |
|
|
|
Check a built wheel against the repository it was built from. |
Classes
|
What |
- skill.wheel.WHEEL_SKILLS_DIR = '_skills'¶
The folder, inside the import package, that the build copies
skills/to.
- class skill.wheel.WheelSkillsReport(skills=list(), problems=list(), warnings=list())[source]¶
Bases:
objectWhat
check_wheel_skills()found.okwhen there are noproblems;warnings(such as a developer skill shipped to users) do not fail it.
- skill.wheel.check_wheel_skills(wheel, repo_root='.', *, package=None, source='skills', target_dir='_skills')[source]¶
Check a built wheel against the repository it was built from.
Problems (
report.okis false):a repository skill (
<source>/<name>/) missing from the wheel, or one of its files missing or different in<package>/<target_dir>/<name>/;a skill whose
SKILL.mdthe wheel holds more than once (anywhere), or a skill in the wheel’s<target_dir>that the repository does not have;a skill whose real
SKILL.mdthe repository holds in more than one non-hidden place (gh skillreports duplicates), or a committed copy of the in-wheel folder (<package>/<target_dir>) in the repository.
Warning
a skill whose
audienceisdeveloperships to users.packagedefaults to the one import package that has a<target_dir>in the wheel.- Return type:
- skill.wheel.wheel_skills_config(package, *, backend='hatch', source='skills', target_dir='_skills')[source]¶
The
pyproject.tomlsettings that putsourceinto the wheel as<package>/<target_dir>, as a nested dict to merge into the file (with tomlkit, say) rather than append to it.hatch:force-include. hatchling copies the files, following links, and skips its built-in excludes (.DS_Store,.pytest_cache…).setuptools:<package>.<target_dir>declared as a package whose directory issource, with all its files as package data.
The build must see
source: a wheel built from an sdist (the default ofpython -m build) needs it in the sdist too.>>> wheel_skills_config("p") {'tool': {'hatch': {'build': {'targets': {'wheel': {'force-include': {'skills': 'p/_skills'}}}}}}}- Return type:
- skill.wheel.wheel_skills_snippet(package, *, backend='hatch', source='skills', target_dir='_skills')[source]¶
wheel_skills_config()aspyproject.tomltext, for a file that has none of these tables yet (merge the dict instead when it has).>>> print(wheel_skills_snippet("p", backend="setuptools")) [tool.setuptools] packages = ["p", "p._skills"] package-dir = { "p._skills" = "skills" } package-data = { "p._skills" = ["**/*"] }- Return type: