Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f0f6e85
feat: add DEFAULT_INSTALL_DIR and DEFAULT_PROJECT_DIR constants
devin-ai-integration[bot] Aug 27, 2025
6462055
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
c277ecf
fix: address maintainer feedback on constants
devin-ai-integration[bot] Aug 27, 2025
bc5ec6c
Merge branch 'devin/1756252455-cleanup-constants' of https://git-mana…
devin-ai-integration[bot] Aug 27, 2025
175f84b
fix: address all maintainer feedback on constants
devin-ai-integration[bot] Aug 27, 2025
d9394e2
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
4a9cf21
fix: simplify local_mount_dir path per maintainer feedback
devin-ai-integration[bot] Aug 27, 2025
92cee85
Merge branch 'devin/1756252455-cleanup-constants' of https://git-mana…
devin-ai-integration[bot] Aug 27, 2025
856db03
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
0737b14
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
fc1a825
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
2f3ae1e
fix: update constants implementation and docstrings per maintainer fe…
devin-ai-integration[bot] Aug 27, 2025
10ba681
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
7110098
Merge remote changes with local constants updates
devin-ai-integration[bot] Aug 27, 2025
5236707
docs: update DEFAULT_PROJECT_DIR docstring per maintainer feedback
devin-ai-integration[bot] Aug 27, 2025
ccd4f83
Merge remote changes with Aaron's latest docstring updates
devin-ai-integration[bot] Aug 27, 2025
62828d0
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
ddc34ea
fix: remove trailing whitespace and fix mypy type error in constants
devin-ai-integration[bot] Aug 27, 2025
17c38df
Merge Aaron's updates with trailing whitespace fix
devin-ai-integration[bot] Aug 27, 2025
c80d235
Merge branch 'main' into devin/1756252455-cleanup-constants
aaronsteers Aug 27, 2025
5768d21
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
9fafad5
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
1e4cd67
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
03250ac
Apply suggestion from @aaronsteers
aaronsteers Aug 27, 2025
e95d918
refactor: simplify constants implementation per Aaron's feedback
devin-ai-integration[bot] Aug 27, 2025
debea12
resolve merge conflicts: apply Aaron's single-line format suggestions
devin-ai-integration[bot] Aug 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions airbyte/_executors/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from airbyte._util.meta import is_windows
from airbyte._util.telemetry import EventState, log_install_state
from airbyte._util.venv_util import get_bin_dir
from airbyte.constants import NO_UV
from airbyte.constants import DEFAULT_INSTALL_DIR, NO_UV


if TYPE_CHECKING:
Expand Down Expand Up @@ -65,7 +65,9 @@ def __init__(
if metadata and metadata.pypi_package_name
else f"airbyte-{self.name}"
)
self.install_root = install_root or Path.cwd()
self.install_root = install_root or DEFAULT_INSTALL_DIR or Path.cwd()
with suppress(Exception):
self.install_root.mkdir(parents=True, exist_ok=True)
self.use_python = use_python

def _get_venv_name(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions airbyte/_executors/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from airbyte._executors.python import VenvExecutor
from airbyte._util.meta import which
from airbyte._util.telemetry import EventState, log_install_state # Non-public API
from airbyte.constants import AIRBYTE_OFFLINE_MODE, TEMP_DIR_OVERRIDE
from airbyte.constants import AIRBYTE_OFFLINE_MODE, DEFAULT_PROJECT_DIR, TEMP_DIR_OVERRIDE
from airbyte.sources.registry import ConnectorMetadata, InstallType, get_connector_metadata
from airbyte.version import get_version

Expand Down Expand Up @@ -282,7 +282,7 @@ def get_connector_executor( # noqa: PLR0912, PLR0913, PLR0914, PLR0915, C901 #
host_temp_dir = TEMP_DIR_OVERRIDE or Path(tempfile.gettempdir())
container_temp_dir = DEFAULT_AIRBYTE_CONTAINER_TEMP_DIR

local_mount_dir = Path().absolute() / name
local_mount_dir = DEFAULT_PROJECT_DIR / name
local_mount_dir.mkdir(exist_ok=True)

volumes = {
Expand Down
7 changes: 4 additions & 3 deletions airbyte/caches/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

from airbyte import exceptions as exc
from airbyte.caches.duckdb import DuckDBCache
from airbyte.constants import DEFAULT_GOOGLE_DRIVE_MOUNT_PATH, DEFAULT_PROJECT_DIR


# Google drive constants:

_MY_DRIVE = "MyDrive"
"""The default name of the user's personal Google Drive."""

_GOOGLE_DRIVE_DEFAULT_MOUNT_PATH = "/content/drive"
_GOOGLE_DRIVE_DEFAULT_MOUNT_PATH = DEFAULT_GOOGLE_DRIVE_MOUNT_PATH
"""The recommended path to mount Google Drive to."""


Expand All @@ -29,7 +30,7 @@ def get_default_cache() -> DuckDBCache:
Cache files are stored in the `.cache` directory, relative to the current
working directory.
"""
cache_dir = Path("./.cache/default_cache")
cache_dir = DEFAULT_PROJECT_DIR / "cache" / "default_cache"
return DuckDBCache(
db_path=cache_dir / "default_cache.duckdb",
cache_dir=cache_dir,
Expand Down Expand Up @@ -66,7 +67,7 @@ def new_local_cache(
)

cache_name = cache_name or str(ulid.ULID())
cache_dir = cache_dir or Path(f"./.cache/{cache_name}")
cache_dir = cache_dir or (DEFAULT_PROJECT_DIR / "cache" / cache_name)
if not isinstance(cache_dir, Path):
cache_dir = Path(cache_dir)

Expand Down
26 changes: 26 additions & 0 deletions airbyte/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@
your mounted Google Drive by setting this to a path like `/content/drive/MyDrive/Airbyte/cache`.
"""

DEFAULT_PROJECT_DIR: Path = (
Path(os.getenv("AIRBYTE_PROJECT_DIR", "") or Path.cwd()).expanduser().absolute()
)
"""Default project directory.

Can be overridden by setting the `AIRBYTE_PROJECT_DIR` environment variable.

If not set, defaults to the current working directory.

This serves as the parent directory for both cache and install directories when not explicitly
configured.
"""

DEFAULT_INSTALL_DIR: Path = (
Path(os.getenv("AIRBYTE_INSTALL_DIR", "") or DEFAULT_PROJECT_DIR).expanduser().absolute()
)
"""Default install directory for connectors.

If not set, defaults to `DEFAULT_PROJECT_DIR` (`AIRBYTE_PROJECT_DIR` env var) or the current
working directory if neither is set.
"""


DEFAULT_GOOGLE_DRIVE_MOUNT_PATH = "/content/drive"
"""Default path to mount Google Drive in Google Colab environments."""

DEFAULT_ARROW_MAX_CHUNK_SIZE = 100_000
"""The default number of records to include in each batch of an Arrow dataset."""

Expand Down
Loading