Skip to content

Commit 202b77b

Browse files
committed
add py folder
1 parent 00e3f66 commit 202b77b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/datacustomcode/run.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import importlib
16+
from pathlib import Path
1617
import runpy
18+
import sys
1719
from typing import List, Union
1820

1921
from datacustomcode.config import config
@@ -31,7 +33,7 @@ def run_entrypoint(
3133
entrypoint: The entrypoint script to run.
3234
config_file: The config file to use.
3335
dependencies: The dependencies to import.
34-
profile: The profile to use.
36+
profile: The credentials profile to use.
3537
"""
3638
if profile != "default":
3739
if config.reader_config and hasattr(config.reader_config, "options"):
@@ -54,4 +56,13 @@ def run_entrypoint(
5456
raise exc
5557
except (ModuleNotFoundError, AttributeError) as inner_exc:
5658
raise inner_exc from exc
59+
add_py_folder(entrypoint)
5760
runpy.run_path(entrypoint, init_globals=globals(), run_name="__main__")
61+
62+
63+
def add_py_folder(entrypoint: str):
64+
default_py_folder = "py-files" # Hardcoded folder name
65+
cwd = Path.cwd().joinpath(entrypoint)
66+
py_folder = cwd.parent.joinpath(default_py_folder)
67+
68+
sys.path.append(str(py_folder))

0 commit comments

Comments
 (0)