Skip to main content

Wrap data sources like files with asyncio python

Project description

Python Anyncronous File System

There are a broad variety of data sources in the current software: sql databases, files, no-sql databases, cloud storages, ... and every one has its own methods and ways to accesing the data.

A good software architecture should not be have a strong dependency to these concrete methods and this is the purpose of this library: Abstract the acccess to data sources from a software application

There already are som libraries for this purpose in python (like filesystem ) but it is not fully oriented to asyncronous programming. It has taken as reference the library aiofiles as pattern to define the system

Usage

There are only two basic classes which wrapp any data source:

  1. FileLike, which is an object with basic file methods:
    1. Binary read method to access to data bytes of the file.
    2. Asyncronous binary write method for writing bytes to the file.
    3. Context management: read and write shall be ran within a context for assuring the proper closing and handling of file inside filesystem.
  2. FileLikeSystem, which is a file system for the files. They have the following methods:
    1. open is the main method because it is the way to create and access to FileLike object. It is very important to have clear the future handling of the file:
      1. If the file will be used to only read, the mode should be r. This the default mode.
      2. If the file exist and will be written, the mode should be r+ if you will have a reading + writing process or w if it only will be written.
  3. rm to remove one or some files
  4. ls to list the filenames accesibles in the file system.

There are the following possible exception:

  • BlockingIOError if two clients are writing at the same time
  • FileNotFound if the file does not exist in the file system

Installation

Depending of what data source will be used, it is necessary to define extras:

  1. If you are using a Operating File System it is not necessary any extras
  2. If you are using Redis Data System, you'll need to add redis extra. The directory structure will be stored within the name of the variable. Ex. directory/path/filename.bin will be mapped as directory:path:filename.bin.
  3. If you are using Azure blobs, you will need to add extra azure. The directory structure will go directly to the blob name. The file system is mapped to an unique blob container.

An example of manual installation for azure environment could be: pip install aiofs[azure]

TODOS

  • It is intended to access to random access to files.
  • Amplify the file system methods to a better file handling
  • Add new data sources

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

aiofs-1.0.0.tar.gz (85.3 kB view details)

Uploaded Source

Built Distribution

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

aiofs-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file aiofs-1.0.0.tar.gz.

File metadata

  • Download URL: aiofs-1.0.0.tar.gz
  • Upload date:
  • Size: 85.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aiofs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b673285ad8025cf1a55c68fe1c80e65724be66517b15c46956807d59c6c234e8
MD5 af04f2b0553835ea40e8b9fe0778fd31
BLAKE2b-256 3efd87064462e6c0117fb354471c6e6a420a4c4fc1a3b25312ac6ffa9654a9ca

See more details on using hashes here.

File details

Details for the file aiofs-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiofs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aiofs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 115902aaa90317d5210e739b0625ef106014b896b5b916ab792864aea362381d
MD5 5ccfee9f692624ead244c129c208a6d9
BLAKE2b-256 82aa6179a56f74b0a0e5272b76daf7109d0c7c58afbe38b76c4ed3d3621fc141

See more details on using hashes here.

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