Skip to content

♻️ / ✨ Revamp Project Template Handling - #441

Merged
MFA-X-AI merged 32 commits into
masterfrom
fahreza/install-template-cli
Sep 4, 2025
Merged

MFA-X-AI merged 32 commits into
masterfrom
fahreza/install-template-cli

Conversation

@MFA-X-AI

@MFA-X-AI MFA-X-AI commented Aug 21, 2025 •

Copy link
Copy Markdown
Member

Description

This PR replaces our Xircuits project git submodules + per-library manual installation approach with a vendoring + extras-based dependency model. Component libraries are copied into the repo (no submodules), their requirements are declared under pyproject.toml as optional-dependency groups, and a single meta extra xai-components aggregates everything including the Xircuits core. A new CLI command, xircuits sync, installs the full set in one shot.

Key Changes

1) Library Vendoring

  • No submodules: When a library is fetched, its .git directory is removed—code is now part of your repo.

  • Upstream tracking recorded in pyproject.toml:

    [tool.xircuits.components.xai-<lib>]
    source = "<repo URL>"
    path   = "xai_components/xai_<lib>"
    tag|rev = "<tag or commit>"

2) Extras-Based Dependencies + Meta Extra

  • Each library contributes its own optional-dependency group:

    [project.optional-dependencies]
    xai-<lib> = [ ... ]
  • xai-components meta extra = union of all xai-* groups plus the Xircuits core spec.

  • Smart Xircuits spec:

    • If Xircuits was installed from a local wheel, we store xircuits @ file:///…/xircuits-X.Y.Z.whl (detected via PEP 610).
    • Otherwise we pin xircuits==X.Y.Z (or fall back to xircuits if version is unknown).

3) xircuits sync CLI

  • Prefers uv when available: runs uv sync --extra xai-components and prints that it’s using uv.
  • Falls back to pip: parses pyproject.toml and runs pip install on each entry in xai-components, printing that it’s using pip.

4) Index-Based Discovery

  • Loads .xircuits/remote_lib_manifest/index.json from a configurable URL (env XIRCUITS_INDEX_URL or [DEV].INDEX_URL in .xircuits/config.ini).
  • Marks libraries as installed, incomplete, or remote based on files + satisfied dependencies.

5) Clean Install/Uninstall

  • Install (xircuits install LIBRARY_ID): vendors the library, removes .git, writes its xai-<lib> extra, rebuilds xai-components, records provenance, and best-effort installs requirements.
  • Uninstall (xircuits uninstall LIBRARY_ID): removes the vendored folder, deletes its extra and provenance, and rebuilds xai-components.

Pyproject Template (resulting shape)

Example: Xircuits from a local wheel

[project]
name = "xircuits-project-template"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = []

[project.optional-dependencies]
xai-components = [
    "flask-apscheduler==1.13.1",
    "flask-cors==4.0.2",
    "flask==3.0.2",
    "xircuits @ file:///home/user/Github/project-dir/xircuits-1.19.2-py3-none-any.whl",
]
xai-flask = [
    "flask-apscheduler==1.13.1",
    "flask-cors==4.0.2",
    "flask==3.0.2",
]

[tool.xircuits.components]

[tool.xircuits.components.xai-flask]
source = "https://github.com/XpressAI/xai-flask"
path = "xai_components/xai_flask"
tag = "v1.18.0"

Example: Xircuits from PyPI (no local wheel)

[project.optional-dependencies]
xai-components = [
    "flask-apscheduler==1.13.1",
    "flask-cors==4.0.2",
    "flask==3.0.2",
    "xircuits==1.19.2",
]

References

  • Implements [ADR-006: Migrate Component Library Installation to Vendored Architecture](./adr/0006-Migrate Component Library Installation to Vendored Architecture.md)
  • Builds on [ADR-005: Migrate Component Library Collection to Manifest Repository](./adr/0005-Migrate Component Library Collection to Manifest Repository.md)

Pull Request Type

  • Xircuits Core (JupyterLab related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please specify)

Type of Change

  • New feature
  • Bug fix
  • Breaking change (replaces submodules/manual installs)
  • Documentation update required

Tests

1) Install a Library (Vendoring)

  1. xircuits install FLASK

  2. Verify vendored folder under xai_components/xai_flask (no .git/)

  3. pyproject.toml:

    • [project.optional-dependencies].xai-flask contains normalized requirements
    • [tool.xircuits.components.xai-flask] has source, path, and tag/rev
    • xai-components is rebuilt to include union of all xai-* + Xircuits spec

2) Uninstall a Library

  1. xircuits uninstall FLASK

  2. Folder removed

  3. pyproject.toml:

    • xai-flask group removed
    • xai-components rebuilt (no flask deps)
    • provenance block removed

3) Index Refresh & Discovery

  1. xircuits list with mixed local/remote libs → statuses accurate
  2. Change manifest URL (env or config.ini) → refresh works

4) Local Wheel Handling (Xircuits Core)

  1. uv pip install /path/to/xircuits-1.19.2-py3-none-any.whl
  2. pyproject.toml shows xircuits @ file:///…/xircuits-1.19.2-py3-none-any.whl in xai-components
  3. On a clean environment, xircuits sync uses that wheel (via uv or pip fallback)

Tested on?

  • Windows
  • Linux
  • Mac
  • Others

Notes

We initially adopted uv workspaces but did not end up with them because they assume each component library is a fully packaged project. Many Xircuits libraries are lightweight, vendored code folders—not standalone packages—so vendoring + extras provides a simpler, more flexible fit.

@github-actions

Copy link
Copy Markdown

Binder 👈 Launch a binder notebook on branch XpressAI/xircuits/fahreza/install-template-cli

@MFA-X-AI
MFA-X-AI marked this pull request as ready for review August 28, 2025 06:44
@MFA-X-AI
MFA-X-AI force-pushed the fahreza/install-template-cli branch from 80c374e to cd87824 Compare September 2, 2025 04:49
@MFA-X-AI
MFA-X-AI merged commit a7d831e into master Sep 4, 2025
@MFA-X-AI
MFA-X-AI deleted the fahreza/install-template-cli branch September 9, 2025 06:05
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.

1 participant