Skip to main content

Provides a filesystem abstraction based on shell commands

Project description

shellfs

shellfs is a simple, in-performant filesystem that uses shell commands to implement filesystem operations. shellfs is based on fsspec that provides the core functionality for different filesystems.

shellfs provides:

  • a filesystem abstraction if a shell is provided to run commands
  • the shell protocol provides a stable interface to run commands in any shell
  • a ShellProtocol as extension-point for different kind of shells (to execute filesystem operation commands).
  • a FileSystemProtocol as extension-point to execute filesystem operations via shell commands,
  • a FSOperationCommand as low-level profile that acts as adapter. between different shell command dialects and supports the shell command execution.
  • the shell protocol is implemented for the local shell (on Unix platforms).

EXAMPLE:

# -- FILE: example_use_shellfs.py
# SHELL PROVIDES:
#   * run(command, ...) method to execute commands (filesystem operations)
#   * FSOPS_COMMAND_CLASS: Provides low-level functionality for FileSystemProtocol

from shellfs import ShellFileSystem
from shellfs.shell.unix import UnixShell
from pathlib import Path

this_shell = UnixShell()
shellfs = ShellFileSystem(this_shell)
some_dir_path = "/tmp/some_dir"
some_file_path = Path(some_dir_path)/"some_file.txt"
shellfs.touch(some_file_path)
assert shellfs.exists(some_file_path) is True
assert shellfs.isfile(some_file_path) is True
assert shellfs.isdir(some_file_path) is False
assert shellfs.isdir(some_dir_path) is True

NOTES:

  • The shellfs is not very performant.
  • The shellfs is intended to be used if no better filesystem exists and only if a command shell is provided that allows to access the internal filesystem.

RELATED:

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

shellfs-0.2.0.tar.gz (24.0 kB view hashes)

Uploaded Source

Built Distribution

shellfs-0.2.0-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page