Skip to content

Add a function to delete files individually #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

suricactus
Copy link
Collaborator

@suricactus suricactus commented Jul 16, 2025

I know there are delete_files but is a bit annoying that it only accepts glob. Sometimes you need a simple file to be deleted.

Copy link
Member

@gounux gounux left a comment

Choose a reason for hiding this comment

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

Code looks good, thanks !


_resp = ctx.obj["client"].delete_file(project_id, filename, version_id)

log(f'Successfully deleted file "{filename}" in project "{project_id}"…')
Copy link
Member

Choose a reason for hiding this comment

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

Am not super fan of those when logging the finish of a successful operation. Personal taste here, feel free to ignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Used quite intensively everywhere else. But in this case it is actually not needed, as it is nothing that takes longer time (processing), I just copy pasted another line in the code. Fixed.

self,
project_id: str,
filename: str,
version_id: Optional[str],
Copy link
Member

Choose a reason for hiding this comment

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

I was about to suggest the version_id: str | None typing, but it seems that the project is python >= 3.8, so better keep it this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, 3.9 is dead by the end of the year, then we upgade to a newer target Python version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants