Skip to main content

Pathlib support for asyncio

Project description

aiopathlib: Pathlib support for asyncio

image image image image image

aiopathlib is written in Python, for handling local disk files in asyncio applications.

Base on aiofiles and just like pathlib, but use await.

with open('filename', 'w') as f:
    f.write('My file contents')

text = await aiopathlib.AsyncPath('filename').read_text()
print(text)
'My file contents'

content = await aiopathlib.AsyncPath(Path('filename')).read_bytes()
print(content)
b'My file contents'

Asynchronous interface to create folder.

apath = AsyncPath('dirname/subpath')
if not await apath.exists():
    await apath.mkdir(parents=True)

Features

  • a file API very similar to Python's standard package pathlib, blocking API
  • support for buffered and unbuffered binary files, and buffered text files
  • support for async/await (:PEP:492) constructs

Installation

To install aiofiles, simply:

$ pip install aiopathlib

Usage

  • read_text
  • read_bytes
  • read_json
  • write_text
  • write_bytes
  • write_json
  • mkdir
  • exists
  • rename
  • remove

History

0.1.3 (2021-08-28)

  • Add makefile.
  • Test all functions.
  • Fix rename method error.
  • Support sync pathlib methods.

0.1.0 (2021-06-14)

  • Introduced a changelog.
  • Publish at gitee.

Contributing

Contributions are very welcome.

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

aiopathlib-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

aiopathlib-0.1.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file aiopathlib-0.1.3.tar.gz.

File metadata

  • Download URL: aiopathlib-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.1

File hashes

Hashes for aiopathlib-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d4a1bda69095a786d63a62bc2bde52dee680977b8f334e1bacf48f68e7da3374
MD5 31e8969efb0996dfea9dd7829cee20a5
BLAKE2b-256 d031f30fe34b308c0dce0b189cf05948c7cfc400943f869085f2992ee20fe681

See more details on using hashes here.

File details

Details for the file aiopathlib-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: aiopathlib-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.1

File hashes

Hashes for aiopathlib-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19a321bbdea5c3085df815957475a9c87d9315eb374494c21d2b6b39c4cca83f
MD5 48ff1485575b9594d45106f42fbe7532
BLAKE2b-256 7681f8c5009d79eed10f6fb8ee73e8a53170de31679e9d963ee7f192ab646214

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