Skip to content

feat: Support configurable home directory via TAU_HOME environment variable#466

Open
abrahamy wants to merge 4 commits into
huggingface:mainfrom
abrahamy:feat/configurable-home-directory
Open

feat: Support configurable home directory via TAU_HOME environment variable#466
abrahamy wants to merge 4 commits into
huggingface:mainfrom
abrahamy:feat/configurable-home-directory

Conversation

@abrahamy

@abrahamy abrahamy commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Adds support for TAU_HOME and TAU_AGENTS_HOME environment variables to override the default ~/.tau and ~/.agents directories respectively.

Closes #465

Changes

  • Add _default_tau_home() and _default_agents_home() helper functions in src/tau_coding/paths.py
  • Update TauPaths dataclass to use the new helper functions as defaults
  • Add comprehensive test coverage for the new functionality (5 new tests through public API)
  • Update documentation to describe the new environment variables

Motivation

Tau currently hardcodes the user home directory to ~/.tau. This prevents users from:

  • Storing Tau configuration in XDG-compliant locations (e.g., ~/.config/tau)
  • Using different Tau home directories for different projects or contexts
  • Following organizational policies that require non-standard configuration paths
  • Managing dotfiles with tools like GNU Stow where ~/.tau isn't ideal

Implementation Details

The implementation:

  • Respects TAU_HOME when set, falls back to ~/.tau otherwise
  • Respects TAU_AGENTS_HOME when set, falls back to ~/.agents otherwise
  • Supports tilde expansion (e.g., ~/my-tau)
  • Maintains full backward compatibility
def _default_tau_home() -> Path:
    """Return the Tau home directory, respecting TAU_HOME if set."""
    if tau_home := environ.get("TAU_HOME"):
        return Path(tau_home).expanduser()
    return Path.home() / ".tau"

Testing

All existing tests pass, plus 5 new tests covering behavior through the public TauPaths API:

  • test_taupaths_defaults_to_standard_locations - Verifies default ~/.tau and ~/.agents when env vars are not set
  • test_taupaths_respects_tau_home_env_var - Verifies TAU_HOME override works
  • test_taupaths_respects_tau_agents_home_env_var - Verifies TAU_AGENTS_HOME override works
  • test_taupaths_expands_tilde_in_tau_home - Verifies tilde expansion for TAU_HOME
  • test_taupaths_expands_tilde_in_tau_agents_home - Verifies tilde expansion for TAU_AGENTS_HOME
uv run pytest tests/test_paths.py -v
# 8 passed in 0.46s

uv run pytest
# 1150 passed in 69.18s

Documentation

Updated website/content/reference/configuration.md to document:

  • The new TAU_HOME environment variable
  • The new TAU_AGENTS_HOME environment variable
  • Example usage for XDG-compliant locations

Checks

  • uv run ruff check . - passed
  • uv run ruff format --check . - passed
  • uv run mypy - passed
  • uv run pytest - all 1150 tests passed

…riable

Adds support for TAU_HOME and TAU_AGENTS_HOME environment variables to
override the default ~/.tau and ~/.agents directories respectively.

Closes huggingface#465

Changes:
- Add _default_tau_home() and _default_agents_home() helper functions
- Update TauPaths dataclass to use the new helper functions as defaults
- Add comprehensive test coverage for the new functionality
- Update documentation to describe the new environment variables

The implementation:
- Respects TAU_HOME when set, falls back to ~/.tau otherwise
- Respects TAU_AGENTS_HOME when set, falls back to ~/.agents otherwise
- Supports tilde expansion (e.g., ~/my-tau)
- Maintains full backward compatibility
@abrahamy
abrahamy requested a review from alejandro-ao as a code owner July 23, 2026 19:18
abrahamy and others added 3 commits July 23, 2026 21:35
- Remove tests for private _default_tau_home and _default_agents_home functions
- Consolidate tests to use TauPaths() constructor directly
- Add comprehensive tests for default behavior, env var override, and tilde expansion
- All 8 tests now verify behavior through the public TauPaths interface

This follows better testing practices by testing behavior rather than
implementation details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configurable home directory via TAU_HOME environment variable

1 participant