Skip to content

Paths

paths

Functions:

Name Description
global_kb_dir

Return the default global KB cache directory.

global_kb_path

Return the path of the global KB database for a given Odoo version.

project_kb_path

Return the path of the project KB database for a given repo root.

stats_dir

Return the oops data directory, respecting XDG_DATA_HOME.

stats_file

Return the path to the usage-event JSONL file.

stats_flush_marker

Return the path to the flush-timestamp marker file.

global_kb_dir

global_kb_dir() -> Path

Return the default global KB cache directory.

Returns:

Type Description
Path

~/.cache/oops/kb (does not check for existence).

Source code in src/oops/core/paths.py
def global_kb_dir() -> Path:
    """Return the default global KB cache directory.

    Returns:
        ``~/.cache/oops/kb`` (does not check for existence).
    """
    return Path.home() / ".cache" / "oops" / "kb"

global_kb_path

global_kb_path(version: str) -> Path

Return the path of the global KB database for a given Odoo version.

Parameters:

Name Type Description Default

version

str

Odoo version string, e.g. '17.0'.

required

Returns:

Type Description
Path

~/.cache/oops/kb/<version>.db (does not check for existence).

Source code in src/oops/core/paths.py
def global_kb_path(version: str) -> Path:
    """Return the path of the global KB database for a given Odoo version.

    Args:
        version: Odoo version string, e.g. ``'17.0'``.

    Returns:
        ``~/.cache/oops/kb/<version>.db`` (does not check for existence).
    """
    return global_kb_dir() / f"{version}.db"

project_kb_path

project_kb_path(repo_root: Path) -> Path

Return the path of the project KB database for a given repo root.

Returns:

Type Description
Path

<repo_root>/.oops-cache/kb.db (does not check for existence).

Source code in src/oops/core/paths.py
def project_kb_path(repo_root: Path) -> Path:
    """Return the path of the project KB database for a given repo root.

    Returns:
        ``<repo_root>/.oops-cache/kb.db`` (does not check for existence).
    """
    return repo_root / CACHE_DIR_NAME / "kb.db"

stats_dir

stats_dir() -> Path

Return the oops data directory, respecting XDG_DATA_HOME.

Returns:

Type Description
Path

$XDG_DATA_HOME/oops when the env var is set, otherwise

Path

~/.local/share/oops.

Source code in src/oops/core/paths.py
def stats_dir() -> Path:
    """Return the oops data directory, respecting ``XDG_DATA_HOME``.

    Returns:
        ``$XDG_DATA_HOME/oops`` when the env var is set, otherwise
        ``~/.local/share/oops``.
    """
    base = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share"))
    return base / "oops"

stats_file

stats_file() -> Path

Return the path to the usage-event JSONL file.

Returns:

Type Description
Path

<stats_dir>/stats.jsonl

Source code in src/oops/core/paths.py
def stats_file() -> Path:
    """Return the path to the usage-event JSONL file.

    Returns:
        ``<stats_dir>/stats.jsonl``
    """
    return stats_dir() / "stats.jsonl"

stats_flush_marker

stats_flush_marker() -> Path

Return the path to the flush-timestamp marker file.

Returns:

Type Description
Path

<stats_dir>/stats_last_flush

Source code in src/oops/core/paths.py
def stats_flush_marker() -> Path:
    """Return the path to the flush-timestamp marker file.

    Returns:
        ``<stats_dir>/stats_last_flush``
    """
    return stats_dir() / "stats_last_flush"