Async-first, secure, and extensible storage backend abstraction for the Darca ecosystem.
darca-storage provides a clean interface for reading and writing to structured storage backends — local, cloud, or custom — with support for path confinement, credential injection, and session-aware logic.
Features
✅ Async-compatible FileBackend interface
🔐 Scoped access via ScopedFileBackend
🧠 Session-aware StorageClient with observability
🔌 Pluggable storage connectors (e.g., file://)
🔄 Credential and user context propagation
🧪 Easy to test and extend
📦 Installation
pip install darca-storage
Or using Poetry:
poetry add darca-storage
Quick Example
from darca_storage.factory import StorageConnectorFactory
client = await StorageConnectorFactory.from_url("file:///tmp/darca")
await client.write("hello.txt", content="Hello Darca!")
text = await client.read("hello.txt")
print(text)
Security by Default
All paths are resolved via ScopedFileBackend, which:
Normalizes and confines all access to a declared base_path
Prevents path traversal (e.g., ../../etc/passwd)
Raises StorageClientPathViolation if the boundary is violated
Extending
Implement a new backend:
class MyBackend(FileBackend):
async def read(self, path: str, *, binary=False) -> Union[str, bytes]:
...
Implement a new connector:
class MyConnector(StorageConnector):
async def connect(self) -> FileBackend:
return ScopedFileBackend(...)
Then register your scheme inside StorageConnectorFactory.
📚 Documentation
Visit the full documentation:
👉 https://roelkist.github.io/darca-storage/
To build locally:
make docs
🧪 Testing
Run all tests using:
make test
Coverage and reports:
Generates coverage.svg badge
Stores HTML output in htmlcov/
Fully parallel test support with xdist
🤝 Contributing
We welcome all contributions!
Create a new branch from main
Use PRs to submit changes
You can also open feature requests or issues using our GitHub templates
See CONTRIBUTING.rst for detailed guidelines.
📄 License
This project is licensed under the MIT License. See LICENSE for details.
Release files for darca-storage 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| darca_storage-0.0.1.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| darca_storage-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / darca_storage-0.0.1.tar.gz
| Download URL | darca_storage-0.0.1.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86fa44299b76fe9add669c7c9e19380d4462776a3573e5027409cd135f16c1f7
|
|
BLAKE2b-256 checksum How to use checksums |
e7400b3e8b94a12a76514eb364f3e9813ea4d9f2a4f8567fb4e13bead4cf9ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2025.
Transparency logRelease files / darca_storage-0.0.1-py3-none-any.whl
| Download URL | darca_storage-0.0.1-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d05622c19c5b28e9957ff2c1566a9f9a2f4a3c28ac0a4790c3294170d8a58b47
|
|
BLAKE2b-256 checksum How to use checksums |
d970d4ba1422d93cff6ccb0000b4cac985ae354759e86ec38da0290e94988d8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2025.
Transparency log