1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515import importlib
16+ from pathlib import Path
1617import runpy
18+ import sys
1719from typing import List , Union
1820
1921from datacustomcode .config import config
@@ -31,8 +33,9 @@ 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 """
38+ add_py_folder (entrypoint )
3639 if profile != "default" :
3740 if config .reader_config and hasattr (config .reader_config , "options" ):
3841 config .reader_config .options ["credentials_profile" ] = profile
@@ -55,3 +58,11 @@ def run_entrypoint(
5558 except (ModuleNotFoundError , AttributeError ) as inner_exc :
5659 raise inner_exc from exc
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