scitex_template
Template management for SciTeX projects.
Functions
|
|
|
|
Get information about all available SciTeX project templates. |
|
|
Create template in a tempdir and return its |
|
|
|
- scitex_template.build_directory_tree(project_dir, structure=None)[source]
Create the standard project directory tree.
- Parameters:
- Raises:
RuntimeError – If a directory cannot be created.
- Return type:
- scitex_template.clone_module(project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Create a module project template.
Tries to clone from the GitHub template repo first. Falls back to inline scaffold if clone fails.
- Parameters:
project_dir (str) – Path to project directory (will be created).
git_strategy (str, optional) – Git initialization strategy.
branch (str, optional) – Specific branch of the template repository to clone.
tag (str, optional) – Specific tag/release of the template repository to clone.
**kwargs – Additional keyword arguments forwarded to clone_project.
- Returns:
True if successful, False otherwise.
- Return type:
- scitex_template.clone_pip_project(project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Create a new pip project from the template repository.
- Parameters:
project_dir (str) – Path to project directory (will be created). Can be a simple name like “my_project” or a full path like “./projects/my_project”
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, None). Default is ‘child’.
branch (str, optional) – Specific branch of the template repository to clone. If None, clones the default branch. Mutually exclusive with tag parameter.
tag (str, optional) – Specific tag/release of the template repository to clone. If None, clones the default branch. Mutually exclusive with branch parameter.
- Returns:
True if successful, False otherwise
- Return type:
Example
>>> from scitex.template import clone_pip_project >>> clone_pip_project("my_pip_project") >>> clone_pip_project("./projects/my_project") >>> clone_pip_project("my_project", branch="develop") >>> clone_pip_project("my_project", tag="v1.0.0")
- scitex_template.clone_research(project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Create a new research project from the template repository.
- Parameters:
project_dir (str) – Path to project directory (will be created). Can be a simple name like “my_project” or a full path like “./projects/my_project”
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, None). Default is ‘child’.
branch (str, optional) – Specific branch of the template repository to clone. If None, clones the default branch. Mutually exclusive with tag parameter.
tag (str, optional) – Specific tag/release of the template repository to clone. If None, clones the default branch. Mutually exclusive with branch parameter.
- Returns:
True if successful, False otherwise
- Return type:
Example
>>> from scitex.template import clone_research >>> clone_research("my_research_project") >>> clone_research("./projects/my_project") >>> clone_research("my_project", branch="develop") >>> clone_research("my_project", tag="v1.0.0")
- scitex_template.clone_research_minimal(project_dir, git_strategy='child', branch=None, tag=None, include_dirs=None)[source]
Create a new minimal research project from scitex-writer (single source of truth).
Clones scitex-writer and keeps only essential directories for manuscript writing.
- Parameters:
project_dir (str) – Path to project directory (will be created). Can be a simple name like “my_project” or a full path like “./projects/my_project”
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, None). Default is ‘child’.
branch (str, optional) – Specific branch of the template repository to clone.
tag (str, optional) – Specific tag/release of the template repository to clone.
include_dirs (list of str, optional) – Top-level items to keep. Defaults to MINIMAL_INCLUDE_DIRS.
- Returns:
True if successful, False otherwise
- Return type:
Example
>>> from scitex.template import clone_research_minimal >>> clone_research_minimal("my_research_project") >>> clone_research_minimal("./projects/my_project")
- scitex_template.clone_scitex_minimal(project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Create a minimal scitex project with writer and scholar workspaces.
- Parameters:
project_dir (str) – Path to project directory (will be created).
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, ‘origin’, None).
branch (str, optional) – Specific branch of the writer template to clone.
tag (str, optional) – Specific tag/release of the writer template to clone.
**kwargs – Additional keyword arguments forwarded to writer ensure.
- Returns:
True if successful, False otherwise.
- Return type:
- scitex_template.clone_singularity(project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Create a new singularity project from the template repository.
- Parameters:
project_dir (str) – Path to project directory (will be created). Can be a simple name like “my_project” or a full path like “./projects/my_project”
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, None). Default is ‘child’.
branch (str, optional) – Specific branch of the template repository to clone. If None, clones the default branch. Mutually exclusive with tag parameter.
tag (str, optional) – Specific tag/release of the template repository to clone. If None, clones the default branch. Mutually exclusive with branch parameter.
- Returns:
True if successful, False otherwise
- Return type:
Example
>>> from scitex.template import clone_singularity >>> clone_singularity("my_singularity_project") >>> clone_singularity("./projects/my_project") >>> clone_singularity("my_project", branch="develop") >>> clone_singularity("my_project", tag="v1.0.0")
- scitex_template.clone_template(template_id, project_dir, git_strategy='child', branch=None, tag=None, **kwargs)[source]
Clone a project template by ID.
Unified dispatcher that resolves template IDs (including aliases) and delegates to the appropriate clone function.
- Parameters:
template_id (str) – Template identifier. Canonical IDs: research, research_minimal, scitex_minimal, pip_project, singularity, paper_directory, module, scitex_app. Aliases: minimal (->scitex_minimal), pip-project, paper, stx-module, app (->scitex_app).
project_dir (str) – Path to project directory (will be created).
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, ‘origin’, None).
branch (str, optional) – Specific branch to clone.
tag (str, optional) – Specific tag to clone.
**kwargs (
Any) – Additional keyword arguments forwarded to the clone function (e.g.include_dirsfor research_minimal).
- Returns:
True if successful, False otherwise.
- Return type:
- Raises:
ValueError – If template_id is unknown.
- scitex_template.clone_writer_directory(project_dir, git_strategy='child', branch='main', tag=None, **kwargs)[source]
Create a new paper directory from the scitex-writer template repository.
- Parameters:
project_dir (str) – Path to project directory (will be created). Can be a simple name like “my_paper” or a full path like “./papers/my_paper”
git_strategy (str, optional) – Git initialization strategy (‘child’, ‘parent’, None). Default is ‘child’.
branch (str, optional) – Specific branch of the template repository to clone. Default is ‘main’. Mutually exclusive with tag parameter.
tag (str, optional) – Specific tag/release of the template repository to clone. If None, uses the branch. Mutually exclusive with branch parameter.
- Returns:
True if successful, False otherwise
- Return type:
Example
>>> from scitex.template import clone_writer_directory >>> clone_writer_directory("my_paper") # Uses main branch >>> clone_writer_directory("./papers/my_paper") >>> clone_writer_directory("my_paper", branch="develop") >>> clone_writer_directory("my_paper", tag="v2.0.0")
- scitex_template.create_child_git(*_a, **_k)
- scitex_template.create_env_template(project_dir, metadata)[source]
Create
config/.env.templatewith project-specific placeholders.
- scitex_template.create_minimal_readme(project_dir, metadata)[source]
Create a minimal README for empty projects.
- scitex_template.create_paths_config(project_dir)[source]
Create
config/paths.jsonwith resolved directory paths.- Parameters:
project_dir (str) – Project root directory.
- Returns:
Path to the generated paths.json.
- Return type:
Path
- scitex_template.create_project_config(project_dir, metadata)[source]
Create project.yaml (or .json fallback) in
config/.
- scitex_template.create_project_readme(project_dir, metadata)[source]
Create a comprehensive README for templated projects.
- scitex_template.create_requirements_file(project_dir)[source]
Create
requirements.txtwith standard scientific packages.- Parameters:
project_dir (str) – Project root directory.
- Returns:
Path to the generated requirements.txt.
- Return type:
Path
- scitex_template.customize_minimal_template(project_dir, metadata)[source]
Customise a minimal (scitex-writer) template with project metadata.
Writes
title.texandauthors.texunder00_shared/(direct clone) orscitex/writer/00_shared/(nested layout).
- scitex_template.customize_template(project_dir, metadata, template_type='research')[source]
Customise a cloned template with project-specific information.
Replaces placeholder text in README.md, title.tex, and authors.tex.
- scitex_template.ensure_integration(project_path)[source]
Convenience function to ensure integration exists.
- Parameters:
project_path (Path) – Root path of the project
- Returns:
True if integration is set up (or already exists)
- Return type:
- scitex_template.find_parent_git(*_a, **_k)
- scitex_template.get_all_templates()[source]
Get all templates combined into one string.
- Returns:
All templates with headers, ordered by priority: 1. session - Main workflow template 2. io - File I/O patterns 3. Others (config, module, etc.)
- Return type:
- scitex_template.get_available_templates_info()[source]
Get information about all available SciTeX project templates.
- Returns:
List of template information dictionaries, each containing: - id: Template identifier (used in code) - name: Human-readable template name - description: Template description - github_url: GitHub repository URL - use_case: When to use this template - tree: Tree-command-style directory listing
- Return type:
Example
>>> from scitex.template import get_available_templates_info >>> templates = get_available_templates_info() >>> for template in templates: ... print(f"{template['name']}: {template['description']}")
- scitex_template.get_code_template(template_id, filepath=None, docstring=None)[source]
Get a code template by ID.
- scitex_template.init_git_repo(*_a, **_k)
- scitex_template.remove_child_git(*_a, **_k)
- scitex_template.setup_scholar_writer_integration(project_path, force=False)[source]
Set up scholar-writer integration structure with symlinks.
Handles two project layouts:
Standalone writer (flat): 00_shared/ at project root Creates: scholar/bib_files/ Symlink: 00_shared/bib_files/merged_scholar.bib
Nested writer (scitex ecosystem): scitex/writer/00_shared/ Creates: scitex/scholar/bib_files/ Symlink: scitex/writer/00_shared/bib_files/merged_scholar.bib
Modules
CLI for scitex-template. |
|
MCP Server for SciTeX Template - Project Scaffolding Framework. |
|
Registry of templates vendored in this repo. |