Repository¶
- class audb.Repository(name, host, backend)[source]¶
Repository object.
It stores all information needed to address a repository: the repository name, host, and the backend name. With
Repository.create_backend_interface()it also provides a method to create a backend interface to access the repository.- Parameters:
name (
str) – repository namehost (
str) – repository hostbackend (
str) – repository backend
Examples
>>> Repository("data-local", "/data", "file-system") Repository('data-local', '/data', 'file-system')
backend¶
- Repository.backend¶
Repository backend name.
backend_registry¶
- Repository.backend_registry = {'artifactory': <class 'audbackend.core.backend.artifactory.Artifactory'>, 'file-system': <class 'audbackend.core.backend.filesystem.FileSystem'>, 'minio': <class 'audbackend.core.backend.minio.Minio'>, 's3': <class 'audbackend.core.backend.minio.Minio'>}¶
Backend registry.
Holds mapping between registered backend names, and their corresponding backend classes. The
"artifactory"backend is currently not available under Python >=3.13.
create_backend_interface()¶
- Repository.create_backend_interface()[source]¶
Create backend interface to access repository.
It wraps an
audbackend.interface.Versionedinterface around it. The files will then be stored with the following structure on the backend (shown by the example of version 1.0.0 of the emodb dataset):emodb/1.0.0/db.yaml <-- header emodb/1.0.0/db.zip <-- dependency table emodb/attachment/1.0.0/... <-- attachments emodb/media/1.0.0/... <-- media files emodb/meta/1.0.0/... <-- tables
When
Repository.backendequalsartifactory, it wraps anaudbackend.interface.Maveninterface around it. The files will then be stored with the following structure on the Artifactory backend (shown by the example of version 1.0.0 of the emodb dataset):emodb/db/1.0.0/db-1.0.0.yaml <-- header emodb/db/1.0.0/db-1.0.0.zip <-- dependency table emodb/attachment/.../1.0.0/... <-- attachments emodb/media/.../1.0.0/... <-- media files emodb/meta/.../1.0.0/... <-- tables
The returned backend instance has not yet established a connection to the backend. To establish a connection, use the backend with a
withstatement, or use theopen()andclose()methods of the backend class. The backend is stored as the inside thebackendattribute of the returned backend interface.- Return type:
type[Base]- Returns:
interface to repository
- Raises:
ValueError – if an artifactory backend is requested in Python>=3.13
ValueError – if a non-supported backend is requested
host¶
- Repository.host¶
Repository host.
name¶
- Repository.name¶
Repository name.
register()¶
- classmethod Repository.register(backend_name, backend_class)[source]¶
Register backend class.
Adds an entry to the dictionary stored in the class variable
Repository.backend_registry, mapping a backend name to an actual backend class.- Parameters:
backend_name (
str) – name of the backend, e.g."file-system"backend_class (
type[Base]) – class of the backend, that should be associated withbackend_name, e.g."audbackend.backend.Filesystem"
Examples
>>> import audbackend >>> audb.Repository.register("file-system", audbackend.backend.FileSystem)