Skip to content

The s3:, gs: and az: schemes

Needs uripath: pip install "objpath[uri]".

objpath.uri

The s3:, gs: and az: schemes of uripath: S3URIPath, GSURIPath and AZURIPath, URI paths that delegate to S3Path, GSPath and AZPath.

Importing this module needs uripath: pip install "objpath[uri]". uripath loads it by itself, through the uripath.schemes entry points, the first time a path of one of the schemes is used.

AZURIPath

Bases: ObjectStoreURIPath

az: scheme (az://account/container/key/path): read/write/list via azure.storage.blob, done by an AZPath on the client of backend (a BaseAZBackend; without one, the backend every path of the account shares, authenticated by azure-identity's DefaultAzureCredential). Needs the az extra. The account has the containers as its directories; see AZPath for the prefix emulation of directories below them.

account property

The storage account: the host of the URI.

backend instance-attribute

container property

The name of the container: the first segment of the path, empty for the account itself.

rmdir()

Source code in src/objpath/uri.py
200
201
202
203
204
205
206
def rmdir(self):
    if self.container:
        return super().rmdir()
    self.stat()
    raise PermissionError(
        _errno.EACCES, "removing a container is not supported", str(self)
    )

stat(*, follow_symlinks=True)

Source code in src/objpath/uri.py
169
170
171
172
173
174
175
176
177
178
179
def stat(self, *, follow_symlinks=True):
    if self.container:
        return super().stat(follow_symlinks=follow_symlinks)
    self._pop_stat_hint()
    # The account: ask the server whether it answers, as a container root
    # does. A one-item listing needs only the permission the rest uses.
    client = self.backend.client()
    with _az_translate_errors(self):
        for _ in client.list_containers(results_per_page=1):
            break
    return FileStat(is_dir=True)

GSURIPath

Bases: ObjectStoreURIPath

gs: scheme (gs://bucket/key/path): read/write/list via google.cloud.storage, done by a GSPath on the client of backend (a BaseGSBackend; without one, the backend every gs: path of the process shares). Needs the gs extra. See GSPath for the prefix emulation of directories.

backend instance-attribute

bucket property

The name of the bucket: the host of the URI.

S3URIPath

Bases: ObjectStoreURIPath

s3: scheme (s3://bucket/key/path): read/write/list via boto3, done by an S3Path on the client of backend (a BaseS3Backend; without one, the backend every s3: path of the process shares). Needs the s3 extra. See S3Path for the prefix emulation of directories.

backend instance-attribute

bucket property

The name of the bucket: the host of the URI.