Skip to content

Paths

paths

Defines file management helpers used across the library

Uses platformdirs to define platform-specific directories in which all runtime data produced by the library is persisted. In addition, uses importlib to define a helper to resolve the location of built-in data shipped with the library when installed via pip

COMPOSE_TEMPLATE_PATH = DOCKER_DIR / 'compose' / 'compose.yaml' module-attribute

The installation-specific path to the mirumoji/docker/compose/compose.yaml package-data Docker Compose template

DOCKER_DIR = _package_path('docker') module-attribute

The installation-specific path to the mirumoji/docker package-data directory

HOST_CONFIG_FILE = HOST_STORAGE.user_config_path / 'mirumoji.env' module-attribute

File in which the launcher persists user configuration data as environment variables for the server to consume

HOST_DB_PATH = HOST_STORAGE.user_data_path / 'mirumoji.db' module-attribute

The server's SQLite Database file (user_data_path / mirumoji.db)

The full path in which the mirumoji database will be created or initialised at server startup. The database holds all mirumoji profile information, along with file references relative to HOST_MEDIA_PATH

HOST_LOG_PATH = HOST_STORAGE.user_log_path module-attribute

Then library's log directory (user_log_path)

Directory in which all *.log files generated by the library will be persisted. This path is used by both the server and the launcher.

Application Logs
  • Mirumoji Server logs are saved here as backend.log

  • Mirumoji Launcher logs are saved here as launcher.log

HOST_MEDIA_PATH = HOST_STORAGE.user_data_path / 'media_files' module-attribute

The server's media root (user_data_path / media_files)

Directory in which the server stores all media that was generated or uploaded by users at runtime. Contains sub-directories for every mirumoji profile under which the media was uploaded or generated

HOST_RENDER_DIR = HOST_STORAGE.user_cache_path / 'compose' module-attribute

Directory in which the launcher stores the rendered Docker Compose files generated from the template before running docker compose -f

HOST_REPO_PATH = HOST_STORAGE.user_data_path / 'source' module-attribute

Directory in which the launcher stores a checked out clone of the mirumoji repo to use for local Docker Image builds (user_data_path / source)

HOST_STORAGE = PlatformDirs(appname='mirumoji', appauthor=False, version=__version__, ensure_exists=False) module-attribute

Filesystem locations used by the server

All user-writable paths derive from platformdirs and are keyed by the app's name and its version so that the entire library shares the same storage paths

Storage Paths
user_data_path = %LOCALAPPDATA%\mirumoji\{version}\
user_cache_path = %LOCALAPPDATA%\mirumoji\{version}\Cache\
user_logs_path = %LOCALAPPDATA%\mirumoji\{version}\Logs\
user_data_path = ~/Library/Application Support/mirumoji/{version}/
user_cache_path = ~/Library/Caches/mirumoji/{version}/
user_logs_path = ~/Library/Logs/mirumoji/{version}/
# WARNING
# platformdirs adheres to the $XDG_DATA_HOME env variables for these
# The following are the defaults when they are not set

user_data_path = ~/.local/share/mirumoji/{version}/
user_cache_path = ~/.cache/mirumoji/{version}/
user_logs_path = ~/.local/state/log/mirumoji/{version}/
Directory Creation

This object is created with ensure_exists=False, so none of the HOST_* directories exist merely because the library was imported