jettex.install¶
TinyTeX installation and management functions.
Module Overview¶
This module handles downloading, installing, and managing TinyTeX.
Functions¶
install_tinytex(version=1, install_dir=None, force=False, add_path=True, progress_callback=None)
¶
Download and install TinyTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
int
|
TinyTeX version to install - 0: infraonly (minimal, no packages) - 1: default (~90 packages for common documents) - 2: extended (more packages) |
1
|
install_dir
|
Optional[Path]
|
Custom installation directory (default: platform-specific) |
None
|
force
|
bool
|
Force reinstall even if already installed |
False
|
add_path
|
bool
|
Add TinyTeX bin to PATH |
True
|
progress_callback
|
Optional[Callable[[str, int, int], None]]
|
Optional callback(stage, downloaded, total) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
Installation directory |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If installation fails |
Source code in jettex/install.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
uninstall_tinytex(install_dir=None)
¶
Uninstall TinyTeX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_dir
|
Optional[Path]
|
Installation directory to remove (default: detect automatically) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if uninstalled successfully |
Source code in jettex/install.py
tinytex_root()
¶
Get the TinyTeX installation root directory.
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path or None: Installation directory if found |
tinytex_version()
¶
Get the installed TinyTeX/TeX Live version.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
str or None: Version string if available |
Examples¶
Basic Installation¶
Custom Installation¶
from pathlib import Path
from jettex import install_tinytex
# Install minimal version to custom directory
install_tinytex(
version=0,
install_dir=Path("/opt/tinytex"),
force=True
)
Progress Tracking¶
from jettex import install_tinytex
def on_progress(stage, downloaded, total):
if stage == "downloading":
percent = (downloaded / total) * 100 if total else 0
print(f"\rDownloading: {percent:.1f}%", end="")
elif stage == "extracting":
print("\nExtracting...")
elif stage == "complete":
print("Done!")
install_tinytex(progress_callback=on_progress)