feat: Transferable (#852)
In https://github.com/testcontainers/testcontainers-python/pull/676 for
copying to/from `DockerContainer`, it was suggested that we should
clarify the interface & usage a bit before proceeding. This PR aims to
push that conversation forward with some test cases illustrating
proposed usages. Although here I created a `Transferable` object, in
most cases there's no need for the caller to explicitly construct a
Transferable, just pass the `bytes | Path`
**Proposed use cases:**
1. Copy into a container by passing a `TransferSpec` into the
initializer:
```
DockerContainer(... transferrables=[TransferSpec(source, destination_in_container), ...)
```
2. Copy into the container via the builder pattern, prior to starting
the container:
```
DockerContainer(...)
.with_copy_into_container(b"some_bytes", destination_in_container)
.with_copy_into_container(some_path, destination_in_container)
```
3. Copy into the container at runtime:
```
with DockerContainer(...) as container:
container.copy_into_container(b"some_bytes", destination_in_container)
container.copy_into_container(some_path, destination_in_container)
```
---------
Co-authored-by: Roy Moore <roy@moore.co.il> R
Ryan Hoban committed
6301a0c9100986be73f6b81be18a7c569ee46320
Parent: 2ca2321
Committed by GitHub <noreply@github.com>
on 4/1/2026, 10:12:39 AM