Skip to content

Commit

Permalink
Merge pull request #42 from causy-dev/add-workspace-path-to-sys-path
Browse files Browse the repository at this point in the history
add current workspace path to sys path
  • Loading branch information
LilithWittmann authored Jun 25, 2024
2 parents fe34729 + f35afea commit c3a6068
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions causy/workspaces/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import questionary
import typer
import os
import sys

import yaml
from markdown.extensions.toc import slugify
Expand Down Expand Up @@ -98,6 +99,8 @@ def _current_workspace(fail_if_none: bool = True) -> Workspace:

workspace_data = None
workspace_path = os.path.join(os.getcwd(), WORKSPACE_FILE_NAME)
# add the current directory to the path to allow for imports
sys.path.append(os.getcwd())
if os.path.exists(workspace_path):
with open(workspace_path, "r") as f:
workspace_data = f.read()
Expand Down Expand Up @@ -590,6 +593,7 @@ def init():
Initialize a new workspace in the current directory.
"""
workspace_path = os.path.join(os.getcwd(), WORKSPACE_FILE_NAME)
sys.path.append(os.getcwd())

if os.path.exists(workspace_path):
typer.confirm(
Expand Down

0 comments on commit c3a6068

Please sign in to comment.