Skip to main content

Safe, predictable filesystem operations for Python.

Project description

Pathxio

Safe, predictable filesystem operations for Python.

Pathxio is a small, safety-first wrapper around common file operations like copy, move, and delete. It helps you avoid destructive mistakes by making safe behavior the default.


Why Pathx?

Python’s built-in filesystem tools (os, shutil) are powerful but easy to misuse:

  • Overwrites happen silently
  • Deletes are irreversible
  • APIs are inconsistent
  • Safety checks are manual

Pathxio flips that around. If an operation looks dangerous, it fails loudly.


Installation

pip install pathxio

Quick Start

Safe Copy

from pathxio import copy

copy("src/", "dst/")
  • Copies files or directories
  • Fails if destination already exists
  • Raises clear, readable errors

Safe Move

from pathxio import move

move("old/", "new/")
  • No overwrite by default
  • Uses atomic moves when possible
  • Explicit failure on unsafe operations

Guarded Delete

from pathxio import remove

remove("build/")

By default, Pathx refuses to delete:

  • root directories
  • home directories
  • non-empty directories

To force deletion:

remove("build/", force=True)

Dry Run Mode

Preview what would happen without touching the filesystem:

copy("src/", "dst/", dry_run=True)

Returns a list of planned operations instead of executing them.


API (MVP)

copy(src, dst, *, dry_run=False)
move(src, dst, *, dry_run=False)
remove(path, *, force=False, dry_run=False)

Design Principles

  • Safety over convenience
  • Fail fast and loudly
  • No surprising defaults
  • Readable exceptions over clever magic

Note

  • Please give me new ideas to maintain this project

Important Notice: Remove Operations and Undo Limitations

Undo functionality is NOT available for remove operations.

Why This Limitation Exists:

  • Irreversible Nature: File deletion cannot be properly reversed without maintaining permanent backups
  • Storage Requirements: Full file restoration would require significant storage space
  • Data Integrity: Removing the original file makes recovery impossible without external backup systems

Recommended Practice:

Always maintain backups of important files before performing removal operations. For critical data, implement your own backup strategy using tools like rsync, cp, or cloud storage solutions.

Workaround for Critical Operations:

For critical files, implement your own backup strategy that creates copies before deletion, ensuring you can restore files if needed.


License

MIT

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

pathxio-0.2.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

pathxio-0.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pathxio-0.2.0.tar.gz.

File metadata

  • Download URL: pathxio-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pathxio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4582ebf7818e82f48e7e4734359bfd913736f875ede90ab8e23591756d26bf3e
MD5 0423ee712f678c58014007c881089176
BLAKE2b-256 32762ec558de5776934735fe3d42fe843c705f7bafbdcc5a7bcfa78326bcf7cf

See more details on using hashes here.

File details

Details for the file pathxio-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pathxio-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pathxio-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19a144e3640bae8ab3d1b4479d2a043fc35891630f5233e72c7de2d2918fd8ff
MD5 36c198ba369653af064739d612f235c0
BLAKE2b-256 f3db1f6820a34c1186260c0c5aaa8bf9ff2db77cbe78aa41d349bd1425ab6972

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