Skip to main content

Universal filesystem interface with pluggable backends (local, S3, SFTP, ...).

Project description

pyxfs Path Utilities

PyPI version License: MIT

pyxfs is a Python library that provides a URI-aware path abstraction similar to pathlib, but designed for distributed and cloud storage systems.

It supports Hadoop-style path components (scheme, authority, path) and provides concrete path classes for:

  • Local files (LocalPath, scheme: os://)
  • S3 paths (S3Path, scheme: s3:// — in pyxfs.s3.path)

It normalizes paths to POSIX style (/ separators), works with URIs, and provides high-level path manipulation utilities.


Features

  • Parse local and S3 URIs (os:///tmp/file, s3://bucket/path/file).
  • Normalize paths (/a/b/../c/a/c).
  • Join, split, and modify paths without losing scheme/authority.
  • Build paths from absolute paths or URIs.
  • Generate safe URIs with percent-encoding for spaces and special characters.

Installation

Install directly from PyPI:

pip install pyxfs

Quickstart

from pyxfs.path import Path, LocalPath

# Build from absolute local path
p = Path.from_uri("/tmp/data/file.txt")
print(p)              # os:///tmp/data/file.txt
print(p.scheme)       # os
print(p.parts)        # ['tmp', 'data', 'file.txt']
print(p.name)         # file.txt
print(p.suffix)       # .txt

# Build from os:// URI
p2 = Path.from_uri("os:///var/log/syslog")
print(p2.as_uri())    # os:///var/log/syslog

# Path operations
p3 = p2 / "archive" / "old.log"
print(p3)             # os:///var/log/archive/old.log

p4 = p3.with_name("latest.log")
print(p4)             # os:///var/log/archive/latest.log

p5 = p4.with_suffix(".gz")
print(p5)             # os:///var/log/archive/latest.gz

print(p5.parent)      # os:///var/log/archive

S3 Path Example

from pyxfs.path import Path

p = Path.from_uri("s3://my-bucket/data/file.csv")
print(p.scheme)     # s3
print(p.authority)  # my-bucket
print(p.parts)      # ['data', 'file.csv']
print(p.name)       # file.csv
print(p.as_uri())   # s3://my-bucket/data/file.csv
print(p.with_suffix(".json"))  # s3://my-bucket/data/file.json

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

pyxfs-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

pyxfs-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pyxfs-0.1.0.tar.gz.

File metadata

  • Download URL: pyxfs-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyxfs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eccff2fbb5acdd2b9d447c94610afcc061c022419ddbc24fec5b28751f90e65e
MD5 6fbb89eae76d0ce8a73808c9c9a245cc
BLAKE2b-256 d50b4ff4c5f199f1ea63804361fca4114f259da3b00c25bdd0d0e395a8b9cd27

See more details on using hashes here.

File details

Details for the file pyxfs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyxfs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyxfs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1edf7df367eba82ee0efb58fb4fe3c0a78104ad177d3bfc068d7548a326fce8f
MD5 6167d8daf750f46eb4e0525588b569ca
BLAKE2b-256 a4f8b3cd99a996d6f9384220ad4c4f2917d4acb6a7deccbd615a7063a5a53d31

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