fs
Python's filesystem abstraction layer
What it is and what it does
PyFilesystem2 is a filesystem abstraction layer that treats entire filesystems the way Python's file objects treat individual files. Instead of writing code that works only with the OS filesystem using os.walk and open, you write code against an FS object that can transparently work with local directories, zip archives, FTP servers, or other storage backends without any changes to your logic.
The package provides a consistent API across all backends—you open an FS object with a URI-like string (e.g., 'zip://archive.zip' or 'ftp://server/path'), then use methods like walk.files(), open(), and listdir() the same way regardless of where the files actually live. This decouples your application code from storage implementation details and makes it easy to swap backends or test with mock filesystems.
Use it for:
- Write file-processing code once and run it against local directories, zip files, or remote FTP servers without rewriting the logic.
- Build tools that need to work with multiple storage backends (e.g., a deployment tool that can read from local, S3, or SFTP).
- Simplify testing by using in-memory or temporary filesystems instead of touching disk during unit tests.
- Recursively walk and process files across different storage types using a single walk API.
- Create filesystem-agnostic libraries or plugins that users can point at any backend they support.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a unified filesystem abstraction layer that lets you work with local directories, zip files, FTP servers, and other storage backends through a single consistent API.
Yes, if you need to write storage-agnostic code or work with multiple filesystem backends. The API is well-established and the package is stable (Production/Stable classifier). However, note that maintenance is aging—the last release was 2022-05-02—so if you rely on active development or rapid bug fixes, evaluate whether that matters for your use case. No known vulnerabilities.
Install
fs on PyPI
pip
pip install fsuv
uv add fspoetry
poetry add fsInstalling fs
Before you install
Low install friction with a pure-Python wheel. Maintenance is aging—last release was 2022-05-02 and the repository has not been updated since 2025-05-17, though it remains unarchived and carries 2105 stars.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, including in commercial projects.
Quickstart
from fs import open_fs
# Open a local directory
local_fs = open_fs('~/projects')
# Or open a zip file with the same API
zip_fs = open_fs('zip://archive.zip')
# List files
for path in local_fs.walk.files():
print(path)
Verify before relying
- Whether the aging maintenance status (last release May 2022) affects stability or compatibility with current Python versions.
- Whether the six and enum34 backport dependencies are still necessary or if they can be dropped for modern Python targets.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — appdirs, setuptools, six, backports.os, enum34, typing |
| Maintenance | aging — 1,565 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,815,225/month — #2,491 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fs-2.4.16-py2.py3-none-any.whl
Tags
More Filesystems packages
Watches file system changes and triggers…
permissive · top 1,000 on PyPI
watchdogWatchdog monitors file system events across…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
filetypeInfers file type and MIME type by examining…
permissive · top 1,000 on PyPI
pathvalidateSanitize and validate filenames and file paths…
permissive · top 5,000 on PyPI
pathlibProvides object-oriented filesystem path…
permissive · top 5,000 on PyPI
fs.sshfsfs.sshfs provides a PyFilesystem2 interface to…
copyleft · top 15,000 on PyPI
iopathiopath provides a unified interface for reading…
permissive · top 5,000 on PyPI
littlefs-pythonlittlefs-python provides a Python interface to…
unclear · top 5,000 on PyPI
python-fsutilProvides a high-level API for common…
permissive · top 5,000 on PyPI
fs-s3fsS3FS provides a PyFilesystem interface to…
permissive · top 15,000 on PyPI
morefsmorefs provides fsspec-based filesystem…
permissive · top 15,000 on PyPI
universal-pathlibUniversal Pathlib provides a pathlib.Path-like…
permissive · top 1,000 on PyPI
gdrive-fsspecProvides a fsspec-compatible filesystem…
permissive · top 15,000 on PyPI
sshfsProvides an fsspec-compatible filesystem…
permissive · top 5,000 on PyPI
fusepyfusepy provides Python bindings to FUSE…
permissive · top 15,000 on PyPI