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:
FileLike, which is an object with basic file methods:- Binary
readmethod to access to data bytes of the file. - Asyncronous binary
writemethod for writing bytes to the file. - Context management:
readandwriteshall be ran within a context for assuring the proper closing and handling of file inside filesystem.
- Binary
FileLikeSystem, which is a file system for the files. They have the following methods:openis the main method because it is the way to create and access toFileLikeobject. It is very important to have clear the future handling of the file:- If the file will be used to only read, the
modeshould ber. This the default mode. - If the file exist and will be written, the
modeshould ber+if you will have a reading + writing process orwif it only will be written.
- If the file will be used to only read, the
rmto remove one or some fileslsto list the filenames accesibles in the file system.
There are the following possible exception:
BlockingIOErrorif two clients are writing at the same timeFileNotFoundif the file does not exist in the file system
Installation
Depending of what data source will be used, it is necessary to define extras:
- If you are using a Operating File System it is not necessary any extras
- If you are using Redis Data System, you'll need to add
redisextra. The directory structure will be stored within the name of the variable. Ex.directory/path/filename.binwill be mapped asdirectory:path:filename.bin. - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiofs-0.3.0.tar.gz.
File metadata
- Download URL: aiofs-0.3.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.14.6-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
646cc0baace662e7293f5f786931a8a9610d980cc5bfc0a1ac1f3f2cd4067089
|
|
| MD5 |
61ee0f6ef49d2406e7558433b0cf49b4
|
|
| BLAKE2b-256 |
5ac273b18752be822d99aca03d09557de06f148c640a1208d7fead64cc366bda
|
File details
Details for the file aiofs-0.3.0-py3-none-any.whl.
File metadata
- Download URL: aiofs-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.14.6-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2142cc586122e5a17702cbe0df31929fd8c6e06f3e5da40d9ca9907b2b33adbd
|
|
| MD5 |
2f7b29a85c32b109279214ba587a330a
|
|
| BLAKE2b-256 |
cf9ab3a60e0b7775ac78732d0f215cdd8d01e15c0323403a2b5a219cb135137e
|