or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mdexternal-apis.mdindex.mdpackage-management.mdtext-processing.mdtranslation.md
tile.json

package-management.mddocs/

Package Management

Comprehensive package management system for installing, updating, and managing translation model packages. Supports both local file installation and remote package repositories with automatic dependency resolution.

Capabilities

Package Discovery

Functions for finding and listing translation packages from various sources.

def get_installed_packages(path: Path = None) -> list[Package]:
    """
    Get list of installed translation packages.
    
    Args:
        path (Path, optional): Custom package directory path
        
    Returns:
        list[Package]: List of installed packages
    """

def get_available_packages() -> list[AvailablePackage]:
    """
    Get list of packages available for download from remote repository.
    
    Returns:
        list[AvailablePackage]: List of downloadable packages
    """

def update_package_index():
    """
    Download and update the remote package index.
    Updates local cache with latest available packages.
    """

Package Installation

Functions for installing packages from various sources.

def install_from_path(path: Path):
    """
    Install translation package from local file.
    
    Args:
        path (Path): Path to .argosmodel package file
        
    Raises:
        FileNotFoundError: If package file doesn't exist
        Exception: If package installation fails
    """

def uninstall(pkg: Package):
    """
    Remove installed translation package.
    
    Args:
        pkg (Package): Package to remove
    """

Package Utilities

Utility functions for package management operations.

def argospm_package_name(pkg: IPackage) -> str:
    """
    Get standardized package name for argospm.
    
    Args:
        pkg (IPackage): Package object
        
    Returns:
        str: Standardized package name
    """

# Threading support
package_lock: Lock  # Threading lock for package operations

Package Interfaces

Abstract and concrete package representations.

IPackage (Abstract Interface)

Base interface for all package types with common metadata and operations.

class IPackage:
    """Abstract interface for translation packages."""
    
    # Package metadata
    package_path: Path        # Path to package installation
    package_version: str      # Package version string
    argos_version: str       # Compatible Argos version
    from_code: str           # Source language code
    from_name: str           # Source language name
    to_code: str             # Target language code
    to_name: str             # Target language name
    from_codes: list         # Multiple source language codes
    to_codes: list           # Multiple target language codes
    links: list[str]         # Download URLs
    type: str                # Package type identifier
    languages: list          # Supported language definitions
    dependencies: list       # Required package dependencies
    source_languages: list   # Source language metadata
    target_languages: list   # Target language metadata
    
    def load_metadata_from_json(self, metadata):
        """
        Load package metadata from JSON configuration.
        
        Args:
            metadata: JSON metadata object
        """
    
    def get_readme(self) -> str:
        """
        Get package README content (abstract method).
        
        Returns:
            str: README text content
        """
    
    def get_description(self):
        """
        Get package description (abstract method).
        
        Returns:
            Package description string
        """

Package (Installed Package)

Concrete implementation for locally installed translation packages.

class Package(IPackage):
    def __init__(self, package_path: Path):
        """
        Initialize installed package from directory path.
        
        Args:
            package_path (Path): Path to installed package directory
        """
    
    def update(self):
        """
        Update package to newer version if available.
        Downloads and installs newer version from remote repository.
        """
    
    def get_readme(self) -> str | None:
        """
        Get package README content from installed files.
        
        Returns:
            str | None: README content or None if not available
        """
    
    def get_description(self):
        """
        Get package description from metadata.
        
        Returns:
            Package description string
        """

AvailablePackage (Downloadable Package)

Represents packages available for download from remote repositories.

class AvailablePackage(IPackage):
    def __init__(self, metadata):
        """
        Initialize available package from remote metadata.
        
        Args:
            metadata: Package metadata from remote index
        """
    
    def download(self) -> Path:
        """
        Download package file to local cache.
        
        Returns:
            Path: Path to downloaded package file
            
        Raises:
            Exception: If download fails
        """
    
    def install(self):
        """
        Download and install package.
        Combines download() and install_from_path() operations.
        """
    
    def get_description(self):
        """
        Get package description from remote metadata.
        
        Returns:
            Package description string
        """

Deprecated Functions

def load_available_packages() -> list[Package]:
    """
    DEPRECATED: Use get_available_packages() instead.
    Load available packages from remote repository.
    """

Command Line Package Manager (argospm)

The argospm command-line tool provides comprehensive package management capabilities.

Core Functions

def main():
    """Main entry point for argospm command-line tool."""

def update_index(args):
    """Update package index from remote repository."""

def get_available_packages() -> list[AvailablePackage]:
    """Get available packages with automatic index updates."""

def install_package_print_path(available_package: AvailablePackage):
    """Install package with progress output and path display."""

def install_all_packages():
    """Install all available packages from repository."""

def install_package(args):
    """Install specific package by name or criteria."""

def search_packages(args):
    """Search for packages matching criteria."""

def list_packages(args):
    """List installed packages with details."""

def remove_package(args):
    """Remove installed package by name."""

Usage Examples

Basic Package Management

from argostranslate import package

# Update package index
package.update_package_index()

# List available packages
available = package.get_available_packages()
for pkg in available:
    print(f"{pkg.from_name} -> {pkg.to_name} (v{pkg.package_version})")

# Install a specific package
en_to_es = [p for p in available if p.from_code == "en" and p.to_code == "es"]
if en_to_es:
    en_to_es[0].install()
    print("Package installed successfully")

# List installed packages
installed = package.get_installed_packages()
for pkg in installed:
    print(f"Installed: {pkg.from_name} -> {pkg.to_name}")

Installing from Local File

from argostranslate import package
from pathlib import Path

# Install from local .argosmodel file
package_file = Path("/path/to/translation-model.argosmodel")
if package_file.exists():
    package.install_from_path(package_file)
    print("Package installed from local file")

Package Information and Management

from argostranslate import package

# Get detailed package information
installed_packages = package.get_installed_packages()
for pkg in installed_packages:
    print(f"Package: {pkg.from_name} -> {pkg.to_name}")
    print(f"Version: {pkg.package_version}")
    print(f"Path: {pkg.package_path}")
    
    # Get README if available
    readme = pkg.get_readme()
    if readme:
        print(f"README: {readme[:100]}...")
    
    # Update package if newer version available
    try:
        pkg.update()
        print("Package updated successfully")
    except Exception as e:
        print(f"Update failed: {e}")

Advanced Package Operations

from argostranslate import package

# Search for specific language pairs
available = package.get_available_packages()

# Find packages for a specific source language  
english_packages = [p for p in available if p.from_code == "en"]
print(f"Found {len(english_packages)} packages from English")

# Install multiple packages
for pkg in english_packages[:5]:  # Install first 5
    try:
        pkg.install()
        print(f"Installed: {pkg.from_name} -> {pkg.to_name}")
    except Exception as e:
        print(f"Failed to install {pkg.from_name} -> {pkg.to_name}: {e}")

# Remove packages
installed = package.get_installed_packages()
for pkg in installed:
    if pkg.from_code == "en" and pkg.to_code == "fr":
        package.uninstall(pkg)
        print("Removed English -> French package")
        break

Working with Package Metadata

from argostranslate import package

# Examine package dependencies and metadata
available = package.get_available_packages()
for pkg in available:
    print(f"\nPackage: {pkg.from_name} -> {pkg.to_name}")
    print(f"  Version: {pkg.package_version}")
    print(f"  Type: {pkg.type}")
    print(f"  Dependencies: {pkg.dependencies}")
    print(f"  Download links: {len(pkg.links)}")
    
    # Get standardized package name
    std_name = package.argospm_package_name(pkg)
    print(f"  Standard name: {std_name}")

Command Line Usage

argospm Commands

# Update package index
argospm update

# List available packages
argospm search

# Install specific package
argospm install translate-en_es

# List installed packages  
argospm list

# Remove package
argospm remove translate-en_es

# Install all available packages
argospm install --all

Package File Format

Translation packages use the .argosmodel extension and contain:

  • Neural translation models (CTranslate2 format)
  • Tokenization models (SentencePiece or BPE)
  • Package metadata (JSON configuration)
  • README and documentation files
  • Language-specific processing rules

Packages are distributed as compressed archives that can be installed locally or downloaded from remote repositories.