Skip to content

🚸 Show Top-3 files larger than threshold on deploy command#190

Open
YuriiMotov wants to merge 9 commits intomainfrom
list-files-command
Open

🚸 Show Top-3 files larger than threshold on deploy command#190
YuriiMotov wants to merge 9 commits intomainfrom
list-files-command

Conversation

@YuriiMotov
Copy link
Copy Markdown
Contributor

@YuriiMotov YuriiMotov commented Apr 29, 2026

Show Top-3 largest files (larger than configurable threshold) when there are large files in project directory.

image

The page in docs could describe the intention of this warning and the way to configure custom threshold.
We may also want to ignore this warning for specified files only (ignore not by size threshold, but by file name), so that it would allow having large file (for example, LLM-model), but still warn on other large files

@YuriiMotov YuriiMotov added the feature New feature or request label Apr 29, 2026
@YuriiMotov YuriiMotov marked this pull request as ready for review April 29, 2026 12:09
toolkit.print(f" [dim]...and {len(large_files) - 3} more[/dim]")

large_files_docs_url = (
"https://fastapicloud.com/docs/deployment#control-what-is-uploaded"
Copy link
Copy Markdown
Contributor Author

@YuriiMotov YuriiMotov Apr 29, 2026

Choose a reason for hiding this comment

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

This page doesn't exist yet. We will need to create it first and update the link here.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a deploy-time warning to help users identify unexpectedly large files in the app directory before upload, showing the top 3 largest files above a configurable threshold.

Changes:

  • Introduces _get_large_files() and a shared _rignore_walk() wrapper to scan the deploy directory using existing ignore rules.
  • Adds --large-file-threshold option to deploy and prints a warning listing the top-3 largest files above the threshold (plus a “...and N more” indicator).
  • Adds unit tests for _get_large_files() and CLI-level tests validating the warning output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/fastapi_cloud_cli/commands/deploy.py Adds large-file detection, new CLI option, and warning output during deploy.
tests/test_deploy_utils.py Adds unit tests for _get_large_files() behavior and ignore handling.
tests/test_cli_deploy.py Adds integration-style tests for deploy output: warning, top-3 behavior, and custom threshold.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fastapi_cloud_cli/commands/deploy.py Outdated
Comment thread src/fastapi_cloud_cli/commands/deploy.py
Comment on lines +838 to +839
fsize_mb = fsize // (1024 * 1024)
toolkit.print(f" • {fname} [yellow]({fsize_mb} MB)[/yellow]")
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.

_format_size rounds the value, so 10 MB + 1 byte will be printed as 10.00 MB. It will also be confusing.
I think it's fine as it is

Comment thread src/fastapi_cloud_cli/commands/deploy.py Outdated
Comment on lines +831 to +835
large_files = _get_large_files(app_path, threshold_mb=large_file_threshold)
if large_files:
toolkit.print(
f"⚠️ Some uploaded files are larger than {large_file_threshold} MB ⚖️ :",
tag="warning",
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.

I think this additional directory traversal will not add big overhead.
Alternative is to embed this into archive function, but, IMO, the code will be less clear

@YuriiMotov YuriiMotov requested a review from patrick91 April 29, 2026 13:01
@YuriiMotov YuriiMotov changed the title 💄 Show Top-3 files larger than threshold on deploy command 🚸 Show Top-3 files larger than threshold on deploy command Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants