Skip to main content

Storage instance with file operation support for multiple backends.

Project description

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.


Build Status Deploy Status Codecov Black code style License PyPi GitHub Pages


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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

darca_storage-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

darca_storage-0.0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file darca_storage-0.0.1.tar.gz.

File metadata

  • Download URL: darca_storage-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for darca_storage-0.0.1.tar.gz
Algorithm Hash digest
SHA256 86fa44299b76fe9add669c7c9e19380d4462776a3573e5027409cd135f16c1f7
MD5 16b33802f20a891d299653e03955ba34
BLAKE2b-256 e7400b3e8b94a12a76514eb364f3e9813ea4d9f2a4f8567fb4e13bead4cf9ee1

See more details on using hashes here.

Provenance

The following attestation bundles were made for darca_storage-0.0.1.tar.gz:

Publisher: cd.yml on roelkist/darca-storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file darca_storage-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: darca_storage-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for darca_storage-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d05622c19c5b28e9957ff2c1566a9f9a2f4a3c28ac0a4790c3294170d8a58b47
MD5 bda7756ede6c9a3433bc033fad73dfb7
BLAKE2b-256 d970d4ba1422d93cff6ccb0000b4cac985ae354759e86ec38da0290e94988d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for darca_storage-0.0.1-py3-none-any.whl:

Publisher: cd.yml on roelkist/darca-storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page