scitex_hub.appmaker
SciTeX App Tools — init, validate, develop, publish, and manage app plugins.
- scitex_hub.appmaker.init_app(target_dir: str | Path, name: str, *, label: str = '', icon: str = 'fas fa-puzzle-piece', description: str = '', manifest: dict | None = None, license_id: str = 'AGPL-3.0', overwrite: bool = False, frontend_type: str = 'html') list[str][source]
Generate complete app boilerplate in target_dir.
- Parameters:
target_dir (path) – Project directory (e.g. data/users/alice/proj/my_app/).
name (str) – Python module name (must end with _app, e.g. ‘my_awesome_app’).
label (str) – Human-readable label (default: derived from name).
icon (str) – Font Awesome icon class (default: ‘fas fa-puzzle-piece’).
description (str) – Short description for the app.
manifest (dict, optional) – Extra manifest fields to merge.
license_id (str) – SPDX license identifier (default: ‘AGPL-3.0’).
overwrite (bool) – If True, overwrite existing files (default: False).
frontend_type (str) – Frontend type: ‘html’ (default) or ‘react’ for React+Vite+Zustand.
- Returns:
Relative paths of created files.
- Return type:
- scitex_hub.appmaker.get_current() str[source]
Get the name of the currently active app.
Reads from SCITEX_CURRENT_APP environment variable. Returns empty string if not set.
- scitex_hub.appmaker.switch_to(app_name: str) bool[source]
Switch the active app.
Sets the SCITEX_CURRENT_APP env var for the current process. For browser-side switching, use the UI automation API.
- scitex_hub.appmaker.list_all(*, server_url: str | None = None) list[dict][source]
List all available apps.
If running inside Django, reads from the registry directly. Otherwise, queries the server API.
- scitex_hub.appmaker.get_info(app_name: str) dict[str, Any][source]
Get detailed info for a specific app from its manifest.
Tries Django registry first, then falls back to reading manifest.json from the app directory.
- scitex_hub.appmaker.install_app(app_name: str, *, server_url: str | None = None, token: str | None = None) dict[source]
Install an app from the store.
Requires authentication. Returns result dict with success/error.
- scitex_hub.appmaker.check_deps(manifest: dict[str, Any]) dict[str, list[str]][source]
Check which dependencies from a manifest are missing.
- Parameters:
manifest – Parsed manifest.json dict (must have
dependencieskey).- Returns:
Dict mapping dep type → list of missing dependency specs. Empty dict means all dependencies are satisfied.
- scitex_hub.appmaker.check_deps_from_manifest(manifest_path: Path) dict[str, list[str]][source]
Convenience: load manifest.json then check deps.
- scitex_hub.appmaker.install_deps(manifest: dict[str, Any], dep_type: str, *, timeout: int = 300) dict[str, Any][source]
Install dependencies of a specific type from a manifest.
- Parameters:
manifest – Parsed manifest.json dict.
dep_type – One of “python”, “system”, “node”, “r”.
timeout – Max seconds for the install command.
- Returns:
Dict with
success,installed,errorkeys.
- scitex_hub.appmaker.format_missing_report(missing: dict[str, list[str]]) str[source]
Format missing dependencies as a human-readable string.
- scitex_hub.appmaker.build_container(app_dir: Path, *, output_dir: Path | None = None, timeout: int = 600) dict[str, Any][source]
Build an Apptainer container from a .def file in an app directory.
Looks for
containerfield in manifest.json. If it’s a .def file, builds it into a .sif file.- Parameters:
app_dir – Path to the app directory containing manifest.json.
output_dir – Where to place the .sif file. Defaults to app_dir.
timeout – Max build time in seconds.
- Returns:
Dict with
success,sif_path,errorkeys.
- scitex_hub.appmaker.get_prefs(app_name: str, *, prefs_path: Path | None = None) dict[str, Any][source]
Get saved preferences for an app.
Returns empty dict if no preferences saved.
- scitex_hub.appmaker.set_prefs(app_name: str, prefs: dict[str, Any], *, prefs_path: Path | None = None) None[source]
Save preferences for an app. Merges with existing preferences.
- scitex_hub.appmaker.delete_prefs(app_name: str, *, prefs_path: Path | None = None) bool[source]
Delete all preferences for an app. Returns True if prefs existed.
- scitex_hub.appmaker.list_prefs(*, prefs_path: Path | None = None) dict[str, Any][source]
List all saved preferences for all apps.
- scitex_hub.appmaker.validate(app_dir: str | Path) list[str][source]
Run all validations on a local app directory.
Returns list of error strings (empty = valid).
- scitex_hub.appmaker.validate_structure(app_dir: str | Path) list[str][source]
Check that required files exist.
- scitex_hub.appmaker.validate_security(app_dir: str | Path) list[str][source]
Scan Python files for forbidden patterns.
- scitex_hub.appmaker.validate_manifest(app_dir: str | Path) list[str][source]
Check manifest.json schema and content.
- scitex_hub.appmaker.validate_templates(app_dir: str | Path) list[str][source]
Check template compliance with workspace frame rules.
- scitex_hub.appmaker.validate_css(app_dir: str | Path) list[str][source]
Check CSS compliance with workspace frame rules.
- scitex_hub.appmaker.validate_dependencies(app_dir: str | Path) list[str][source]
Check that manifest.json dependencies field is well-formed.
- scitex_hub.appmaker.generate_license_text(spdx_id: str, author: str = '', year: int | None = None) str | None[source]
Generate full license text for the given SPDX identifier.
- scitex_hub.appmaker.dev_server(app_dir: str | Path, port: int = 8000) None[source]
Set up a local app for development in the SciTeX workspace.
Validates the app, creates a symlink into apps/ if needed, and prints remaining manual steps.
- Parameters:
app_dir (path) – Path to the app plugin directory.
port (int) – Port number for the dev server (default: 8000).
- scitex_hub.appmaker.publish(app_dir: str | Path, server_url: str, token: str) dict[source]
Validate locally then submit the app for review via JWT endpoint.
- Parameters:
app_dir (path) – Directory containing the app with manifest.json.
server_url (str) – Base URL of the SciTeX Cloud server (e.g. http://127.0.0.1:8000).
token (str) – JWT access token (Bearer auth).
- Returns:
Server response with ‘success’ and ‘pr_url’ keys.
- Return type: