Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ async def _upload_folder_to_blob(
) -> None:
"""Walk *folder* and upload every eligible file to the blob container.

Skips ``__pycache__``, ``.git``, ``.venv``, ``venv``, ``node_modules``
Skips directories starting with ``.`` (e.g. ``.git``, ``.venv``),
``__pycache__``, ``venv``, ``node_modules``
directories and ``.pyc`` / ``.pyo`` files.
Copy link
Copy Markdown
Member

@dargilco dargilco Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to hard code a list of folders, and this is specific to the environment you happen to run the code. A better way is to add an input variable like folder_exclutions_pattern: Optional[re.Pattern] = None, where you provide a reg ex of the folders to exclude. Default is to include all folders.

And per one of my comments earlier, please add file_pattern: Optional[re.Pattern] = None, to match what we have in dataset upload

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.


:param container_client: The blob container client to upload files to.
Expand All @@ -58,14 +59,14 @@ async def _upload_folder_to_blob(
:raises HttpResponseError: Re-raised with a friendlier message on
``AuthorizationPermissionMismatch``.
"""
skip_dirs = {"__pycache__", ".git", ".venv", "venv", "node_modules"}
skip_dirs = {"__pycache__", "venv", "node_modules"}
skip_extensions = {".pyc", ".pyo"}
files_uploaded = False

for root, dirs, files in os.walk(folder):
dirs[:] = [d for d in dirs if d not in skip_dirs]
dirs[:] = [d for d in dirs if d not in skip_dirs and not d.startswith(".")]
for file_name in files:
if any(file_name.endswith(ext) for ext in skip_extensions):
if file_name.startswith('.') or any(file_name.endswith(ext) for ext in skip_extensions):
continue
file_path = os.path.join(root, file_name)
blob_name = os.path.relpath(file_path, folder).replace("\\", "/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def _upload_folder_to_blob(
) -> None:
"""Walk *folder* and upload every eligible file to the blob container.

Skips ``__pycache__``, ``.git``, ``.venv``, ``venv``, ``node_modules``
Skips directories starting with ``.`` (e.g. ``.git``, ``.venv``),
``__pycache__``, ``venv``, ``node_modules``
directories and ``.pyc`` / ``.pyo`` files.

:param container_client: The blob container client to upload files to.
Expand All @@ -58,14 +59,14 @@ def _upload_folder_to_blob(
:raises HttpResponseError: Re-raised with a friendlier message on
``AuthorizationPermissionMismatch``.
"""
skip_dirs = {"__pycache__", ".git", ".venv", "venv", "node_modules"}
skip_dirs = {"__pycache__", "venv", "node_modules"}
skip_extensions = {".pyc", ".pyo"}
files_uploaded = False

for root, dirs, files in os.walk(folder):
dirs[:] = [d for d in dirs if d not in skip_dirs]
dirs[:] = [d for d in dirs if d not in skip_dirs and not d.startswith(".")]
for file_name in files:
if any(file_name.endswith(ext) for ext in skip_extensions):
if file_name.startswith('.') or any(file_name.endswith(ext) for ext in skip_extensions):
continue
file_path = os.path.join(root, file_name)
blob_name = os.path.relpath(file_path, folder).replace("\\", "/")
Expand Down