Skip to content

Commit 422d872

Browse files
committed
fix(deps): make python-dotenv a base dependency
- the osw CLI is a base console script, but .env loading required osw[mcp] - without dotenv the implicit .env search returned silently, so the CLI reported missing credentials instead of the missing package - drop the now redundant entry from the mcp extra - update the docstrings and error message that named osw[mcp]
1 parent 56711ed commit 422d872

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎pyproject.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ dependencies = [
5050
# the osw CLI (src/osw/cli); a base dependency, not an extra, so `pip
5151
# install osw` never ships a broken `osw` console script
5252
"typer",
53+
# .env loading (osw.service.config). Also a base dependency: without it the
54+
# CLI silently cannot find a .env file and reports missing credentials
55+
"python-dotenv>=1.0",
5356
]
5457

5558
[project.urls]
@@ -76,8 +79,6 @@ mcp = [
7679
# official MCP Python SDK; provides MCPServer from mcp.server.
7780
# requires 2.x: 1.x has no MCPServer, and 2.0 removed the vendored FastMCP.
7881
"mcp>=2",
79-
# .env loading for the stdio server (OSW_DOMAIN/OSW_USERNAME/OSW_PASSWORD)
80-
"python-dotenv>=1.0",
8182
]
8283
workflow = [
8384
"prefect>=2.20.25,<3.0",

‎src/osw/mcp/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
write and manage entities, page slots and files on a live OSL instance.
66
77
``main`` is imported lazily so ``import osw.mcp`` does not require the optional
8-
``mcp`` / ``python-dotenv`` dependencies unless the server is actually started.
8+
``mcp`` dependency unless the server is actually started.
99
"""
1010

1111
from __future__ import annotations

‎src/osw/service/config.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ def set_env_file_discovery(enabled: bool) -> None:
264264
def _load_env_file() -> None:
265265
"""Load a .env file if one is configured or (when enabled) discoverable.
266266
267-
dotenv is optional (it ships with the ``mcp`` extra). An *explicitly*
267+
dotenv is a base dependency, so it is normally present. It is still
268+
imported defensively, for an environment that stripped it: an *explicitly*
268269
configured env file with dotenv missing is an error, because the operator
269270
asked for something that cannot happen. An implicit search is skipped
270271
silently.
@@ -286,7 +287,7 @@ def _load_env_file() -> None:
286287
name = next((n for n in ENV_FILE if os.getenv(n) == path), ENV_FILE[0])
287288
raise RuntimeError(
288289
f"{name} is set (to '{path}') but python-dotenv is not installed. "
289-
"Install the osw[mcp] extra to use an env file."
290+
"Install python-dotenv (a dependency of osw) to use an env file."
290291
)
291292
if path:
292293
dotenv.load_dotenv(path)

‎uv.lock‎

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)