pathliberty

pathlib extensions


License
MIT
Install
pip install pathliberty==0.6.1

Documentation

pathliberty

Extended object-oriented filesystem paths library.
pathliberty is the Python package that allows you to subclass a pathlib.PosixPath in a proper way. To define your own custom path subclass, declare subclasses AbstractPathAccessor and AbstractPath.

Features

Support SSH remote path via Paramiko:

from pathliberty import SSHPath
from pathliberty.ssh import SSHSession
from getpass import getuser

host = 'localhost'
ssh_session = SSHSession(
    host,
    password=******,
)
ssh_path = SSHPath(f'/home/{getuser()}', ssh=ssh_session)
assert ssh_path.parent == SSHPath('/home', host=host)

Installation

pip install pathliberty