Skip to content

Commit

Permalink
feat: check if user is working with namespace packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CheeseCake87 committed Aug 31, 2024
1 parent 573e2e9 commit 036963f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/flask_imp/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@ def cast_to_import_str(app_name: str, folder_path: Path) -> str:
"""
Takes the folder path and converts it to a string that can be imported
"""

# to work with namespace packages
if "." in app_name:
app_name = app_name.split(".")[:1][0]

folder_parts = folder_path.parts
parts = folder_parts[folder_parts.index(app_name) :]
parts = folder_parts[folder_parts.index(app_name):]

if sys.version_info.major == 3:
if sys.version_info.minor < 9:
return ".".join(parts).replace(".py", "")
Expand Down

0 comments on commit 036963f

Please sign in to comment.