Skip to main content

Extends the standard library pathlib.Path class.

Project description

pathier

Extends the standard library pathlib.Path class.

Installation

Install with:

pip install pathier

Usage

Functions the same as pathlib.Path, but with added functions and some altered default arguments.

Navigation

New paths can be obtained by naming the parent or subtracting a number of levels from the current path:

from pathier import Pathier
path = Pathier("C:\some\directory\some\subdirectory")
print(path.moveup("directory"))
"C:\some\directory"
print(path - 3)
"C:\some"

Manipulation

Can dump and load toml and json files without needed to explicityly import and call functions from the respective libraries:

from pathier import Pathier
path = Pathier("some_file.toml")
content = path.loads()
path.with_suffix(".json").dumps(content, indent=2)

Pathier().mkdir() creates parent directories and doesn't throw an error if the path already exists by default.

Pathier().write_text() and Pathier().write_bytes() will create parent directories by default if they won't exist.

Pathier().write_text() will also try to cast the data to be written to a string if a TypeError is thrown.

Pathier().delete() will delete a file or directory, event if that directory isn't empty.

Pathier().copy() will copy a file or a directory tree to a new destination and return a Pathier object for the new path
By default, files in the destination will not be overwritten.

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

pathier-0.2.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

pathier-0.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pathier-0.2.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pathier-0.2.0.tar.gz
Algorithm Hash digest
SHA256 67fd3c8d81c6573bba22bdd32e4609a05247a95fe1baa87a98d6314cb3d3d7db
MD5 99274bb2d97f151e3ccd3830ef4ad473
BLAKE2b-256 531b7db1d68b38d7538f4353d3284ee2dda090d0f716379a3d946c3df57627d4

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: pathier-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pathier-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b6c474e98046323fda3784c9c462183d150dbf1dff52736dc04a52215fddb73
MD5 11704db42481cf6f5cff38483bb932ae
BLAKE2b-256 276d95f25133e883a5b65bfe9786d01f8b870c6df2092cfacac8243852ae6f8a

See more details on using hashes here.

Provenance

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