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
¶
The 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 Serverlogs are saved here asbackend.log -
Mirumoji Launcherlogs are saved here aslauncher.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, ensure_exists=False)
module-attribute
¶
Filesystem locations used by the server and launcher
All user-writable paths derive from platformdirs and are keyed by the app's
name only. Keeping them unversioned means data, config, and logs survive a
version upgrade instead of being orphaned under a per-version subfolder
One Folder On Windows, Several On macOS / Linux
-
On Windows every path lives under a single
%LOCALAPPDATA%\mirumoji\folder, with cache and logs asCache\/Logs\subfolders of it -
On macOS and Linux the data, config, cache, and state roots are separate top-level directories, each holding its own
mirumojifolder, so no single folder holds everything. Themirumoji resetcleanup accounts for this (seelauncher/core/storage.py)
Storage Paths
# WARNING
# platformdirs honours the $XDG_*_HOME variables for these
# The following are the defaults when they are not set
user_data_path = ~/.local/share/mirumoji/
user_config_path = ~/.config/mirumoji/
user_cache_path = ~/.cache/mirumoji/
user_state_path = ~/.local/state/mirumoji/
user_log_path = ~/.local/state/mirumoji/log/
Directory Creation
This object is created with ensure_exists=False, so none of the
HOST_* directories exist merely because the library was imported