Skip to content

Conversation

@adam-rl
Copy link
Contributor

@adam-rl adam-rl commented Nov 20, 2025

This method creates an object out of a local directory by bundling it into a compressed tarball and uploading it as an object.

@adam-rl adam-rl requested review from dines-rl and sid-rl November 20, 2025 06:10
@adam-rl
Copy link
Contributor Author

adam-rl commented Nov 20, 2025

Still adding tests, but what do we think of this so far?

So far, this is a naive implementation that holds the entire compressed directory tar in memory, and doesn't perform any filtering (dockerignore file).

I think I'd like to land a naive version first before getting fancy. Streaming upload to S3 is a bit involved.

@adam-rl adam-rl force-pushed the adam/add-object-tar branch from fb7dc38 to 7675a82 Compare November 20, 2025 06:12
@adam-rl adam-rl changed the title feat(object-storage): Add upload_from_dir helper method feat(storage-objects): Add upload_from_dir helper method Nov 20, 2025
tar_buffer = await asyncio.to_thread(synchronous_io)

obj = await self.create(name=name, content_type="tgz", metadata=metadata, ttl_ms=ttl_ms, **options)
await obj.upload_content(tar_buffer)
Copy link
Contributor

Choose a reason for hiding this comment

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

can't upload synchronous BytesIO to an async http client, smoketest throws RuntimeError: Attempted to send an sync request with an AsyncClient instance.

@adam-rl adam-rl force-pushed the adam/add-object-tar branch 5 times, most recently from ca04975 to de3523b Compare November 21, 2025 02:10
This method creates an object out of a local directory by bundling it
into a compressed tarball and uploading it as an object.
Copy link
Contributor

@sid-rl sid-rl left a comment

Choose a reason for hiding this comment

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

LGTM! Just make sure the smoketests pass before merging

@adam-rl adam-rl force-pushed the adam/add-object-tar branch from de3523b to ec6311f Compare November 21, 2025 02:34
@adam-rl
Copy link
Contributor Author

adam-rl commented Nov 21, 2025

Smoke tests pass! Woot.

@adam-rl adam-rl merged commit be5d99e into main Nov 21, 2025
7 checks passed
@adam-rl adam-rl deleted the adam/add-object-tar branch November 21, 2025 02:50
@stainless-app stainless-app bot mentioned this pull request Nov 21, 2025
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.

3 participants