Skip to main content

OSSFS

PyPI Status Python Version License

Tests Codecov pre-commit Black

OSSFS is a Python-based interface for file systems that enables interaction with OSS (Object Storage Service). Through OSSFS, users can utilize fsspec’s standard API to operate on OSS objects

Installation

You can install OSSFS via pip from PyPI:

$ pip install ossfs

Up-to-date package also provided through conda-forge distribution:

$ conda install -c conda-forge ossfs

Quick Start

Here is a simple example of locating and reading an object in OSS.

import ossfs
fs = ossfs.OSSFileSystem(endpoint='http://oss-cn-hangzhou.aliyuncs.com')
fs.ls('/dvc-test-anonymous/LICENSE')
[{'name': '/dvc-test-anonymous/LICENSE',
  'Key': '/dvc-test-anonymous/LICENSE',
  'type': 'file',
  'size': 11357,
  'Size': 11357,
  'StorageClass': 'OBJECT',
  'LastModified': 1622761222}]
with fs.open('/dvc-test-anonymous/LICENSE') as f:
...     print(f.readline())
b'                                 Apache License\n'

For more use case and apis please refer to the documentation of fsspec

Async OSSFS

Async OSSFS is a variant of ossfs that utilizes the third-party async OSS backend aiooss2, rather than the official sync one, oss2. Async OSSFS allows for concurrent calls within bulk operations, such as cat, put, and get etc even from normal code, and enables the direct use of fsspec in async code without blocking. The usage of async OSSFS is similar to the synchronous variant; one simply needs to replace OSSFileSystem with AioOSSFileSystem need to do is replacing the OSSFileSystem with the AioOSSFileSystem

import ossfs
fs = ossfs.AioOSSFileSystem(endpoint='http://oss-cn-hangzhou.aliyuncs.com')
print(fs.cat('/dvc-test-anonymous/LICENSE'))
b'                                 Apache License\n'
...

Although aiooss2 is not officially supported, there are still some features that are currently lacking. However, in tests involving the put/get of 1200 small files, the async version of ossfs ran ten times faster than the synchronous variant (depending on the pool size of the concurrency).

Task

time cost in (seconds)

put 1200 small files via OSSFileSystem

35.2688 (13.53)

put 1200 small files via AioOSSFileSystem

2.6060 (1.0)

get 1200 small files via OSSFileSystem

32.9096 (12.63)

get 1200 small files via AioOSSFileSystem

3.3497 (1.29)

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the Apache 2.0 license, Ossfs is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for cz-ossfs 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cz-ossfs 0.0.2
File Size Uploaded Provenance Actions
cz-ossfs-0.0.2.tar.gz 24.2 kB Without provenance Details for cz-ossfs-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cz-ossfs 0.0.2
File Interpreter ABI Platform Actions
cz_ossfs-0.0.2-py3-none-any.whl Python 3 none any Details for cz_ossfs-0.0.2-py3-none-any.whl

Total release size: 49.4 kB

Release files / cz-ossfs-0.0.2.tar.gz

Download URL cz-ossfs-0.0.2.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f7f17b296f22413b961eccec0b9cdc98ccb91ec06125358aae1dc1c24ed2b9d0
BLAKE2b-256 checksum
How to use checksums
6dcaf4470282e401829a4b9e601f4b2342dfbf5ac445261247b0809cd34bac32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release files / cz_ossfs-0.0.2-py3-none-any.whl

Download URL cz_ossfs-0.0.2-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3af231c55fc6940b5b1fded719ea1cde22149667a9915223b8b4ca212fa7ffe
BLAKE2b-256 checksum
How to use checksums
466bff0a33aff1114325bcdd85c04f5c74162fc1ada6b9c9e575082fd7b46f7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Security for cz-ossfs 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page