PyFilesystem 2.1.0 adds concurrent uploads / downloads and support for globbing

I've released PyFilesystem 2.1.0.

This version is the accumulation of many minor revisions, with multiple fixes, enhancements and some interesting new features. We also have nicer doc strings and Mypy compatible typing information, thanks to Martin Larralde.

If you aren't familiar with PyFilesystem, it is a common Python API to filesystems, whether its your hard-drive, archives, memory, FTP servers, or cloud services. The API is easier to use than the standard library, but works just about everywhere. See the Pyfilesystem Wiki for more information.

Concurrent Uploads / Downloads

The copy, move, and mirror functionality has been extended with a workers argument, which will enable multi-threaded copies if it is set to something greater than 0. This is hugely beneficial for uploading and downloading over a network as it allows you to saturate your available bandwidth.

For instance, the following will use 4 threads to upload your projects directory to a bucket on Amazon S3.

from fs.copy import copy_fs copy_fs('~/projects', 's3://mybucket', workers=4)

Technically this will use 5 threads to do the upload; the main threads handles the directory scanning, while 4 thread are busy uploading or downloading data.

Globbing

PyFilesystem has always had good support for walking a directory tree, but in many cases this can now be replaced with globbing. Essentially globbing is like a wildcard that can match multiple components of a path.

Here's an example which uses the glob feature to recursively remove all the .pyc files from your projects directory.

© 2018 Will McGugan I have perfectly decent syntax highlighting in my blog, but it doesn't generate flashy thumbnails.

Here is a slightly less trivial example, that counts the number of bytes stored in .git directories in your projects folder: