Skip to content

Fix skill path resolution and PyPI skill packaging.#79

Merged
rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:fix/issue-13-skill-loader-paths
May 18, 2026
Merged

Fix skill path resolution and PyPI skill packaging.#79
rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:fix/issue-13-skill-loader-paths

Conversation

@rosspeili
Copy link
Copy Markdown
Contributor

Description

Fixes #13: SkillLoader.load_skill("category/name") failed after pip install because relative paths were resolved only next to the installed package (site-packages/skills/), not the user’s project. PyPI wheels also shipped mostly .py files, so bundled skills loaded with empty manifests.

What changed

Core (skillware/core/loader.py)

  • Added _resolve_skill_path() with explicit search order:
    1. Existing path on disk (absolute or relative) that contains skill.py
    2. SKILLWARE_SKILL_PATH (multiple roots, os.pathsep-separated)
    3. skills/ under the current working directory, walking up to 6 parent dirs
    4. Bundled site-packages/skills/ (same layout as the repo registry)
  • Clear FileNotFoundError listing paths tried when nothing matches.

Packaging (pyproject.toml, MANIFEST.in, skills/**/__init__.py)

  • Version bump to 0.2.7
  • include-package-data = true, MANIFEST.in (graft skills), and skills = ["**/*"] so wheels include manifest.yaml, instructions.md, card.json, and data files—no per-skill pyproject.toml entries when adding skills.
  • Empty __init__.py on category packages and office/pdf_form_filler so setuptools includes the full skill tree.

Tests

  • Loader: cwd skills/, SKILLWARE_SKILL_PATH, env-over-cwd precedence, registry manifest non-empty, wheel contains skill YAML.
  • Issuer: test_registry_skills_have_packaging_init_files enforces __init__.py for new registry skills.

Docs & contributor guidance

  • docs/usage/README.md — “Finding skills on disk”
  • docs/introduction.md, docs/skills/README.md, path fixes in skill catalog pages
  • CONTRIBUTING.md, templates/python_skill/README.md — packaging checklist (__init__.py, no pyproject edits per skill)
  • README.md — pointer to path search order
  • .gitignore.ruff_cache/

Why

Environment Before After
Git clone / pip install -e . Worked (package-adjacent skills/) Same; project skills/ still found first
pip install in another app Looked only under site-packages/skills/; incomplete bundles Project ./skills/, env var, then bundled; full manifests in wheel

CI was unaffected in practice because it runs pytest from a full checkout; this aligns PyPI behavior with clone behavior.

How to verify

python -m flake8 .
pytest tests/
python -m pip wheel . --no-deps -w /tmp/wheels
# Install wheel in a venv, cd outside the repo, create ./skills/my_skill/, then:
# SkillLoader.load_skill("my_skill")  # should succeed

Type of Change

  • Bug Report Fix: Non-breaking change which fixes an execution error or framework bug
  • Framework Feature / RFC Updates: Core Framework Update (Changes to loader.py, etc.)

Checklist (all PRs)

  • My code follows the Agent Code of Conduct.
  • I have run python -m flake8 . and pytest tests/ locally (or the subset relevant to this change).

New or updated skill

Skipped — no new registry skills; only empty __init__.py files for packaging layout.

Constitution & Safety

No skill logic or constitutions changed. Loader behavior is path resolution only; execution semantics unchanged.

Related Issues

Fixes #13

Resolve registry skill IDs from SKILLWARE_SKILL_PATH, project skills/ directories, then bundled site-packages skills. Ship full skill bundles in wheels via MANIFEST.in and package-data. Add loader and packaging tests, contributor docs, and __init__.py layout for the skills package.

Fixes ARPAHLS#13
@rosspeili rosspeili merged commit e465dc4 into ARPAHLS:main May 18, 2026
5 checks passed
@rosspeili rosspeili deleted the fix/issue-13-skill-loader-paths branch May 18, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SkillLoader relative paths break when package is installed via pip

1 participant