Skip to main content

Malcolm's Path Tools

PyPI PyPI - Python Version PyPI - License Coookiecutter - Malcolm


Documentation: https://malcolm3davis.github.io/path-tools-med

Source Code: https://github.com/malcolm3davis/path-tools-med

PyPI: https://pypi.org/project/path-tools-med/


A few path related functions I wish pathlib supported.

Usage

  • make_versioned_backup(path: Path|str) -> Path
    • Renames the specified path adding a .~#~ style version number that is higher than any existing version number.
  • backup_path(paht: Path|str, backup_extension=".bak") -> Path
    • Renames the specified file adding the backup_extension. If that backup file already exists it renamed with make_versioned_backup.
  • get_highest_backup_version(path: Path|str) -> int
    • Utility function to see what the current highest backup version number exists.

It also provides the PathRerooter class that can be used to update path objects to have a new initial root path.

r = PathRerooter("/old/root/path", "/new/root/path/is/here")
assert r.fix("/old/root/path/some/file.txt") == "/new/root/path/is/here/some/file.txt"

Installation

pip install path-tools-med

Development

  • Clone this repository
  • Requirements:
  • Create a virtual environment and install the dependencies
poetry install
  • Activate the virtual environment
poetry shell

Testing

pytest

Documentation

The documentation is automatically generated from the content of the docs directory and from the docstrings of the public signatures of the source code. The documentation is updated and published as a Github Pages page automatically as part each release.

Releasing

Trigger the Draft release workflow (press Run workflow). This will update the changelog & version and create a GitHub release which is in Draft state.

Find the draft release from the GitHub releases and publish it. When a release is published, it'll trigger release workflow which creates PyPI release and deploys updated documentation.

Pre-commit

Pre-commit hooks run all the auto-formatting (ruff format), linters (e.g. ruff and mypy), and other quality checks to make sure the changeset is in good shape before a commit/push happens.

You can install the hooks with (runs for each commit):

pre-commit install

Or if you want them to run only for each push:

pre-commit install -t pre-push

Or if you want e.g. want to run all checks manually for all files:

pre-commit run --all-files

This project was generated using the wolt-python-package-cookiecutter template.

Metadata

Release files for path-tools-med 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for path-tools-med 0.1.0
File Size Uploaded Provenance Actions
path_tools_med-0.1.0.tar.gz 5.7 kB Without provenance Details for path_tools_med-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for path-tools-med 0.1.0
File Interpreter ABI Platform Actions
path_tools_med-0.1.0-py3-none-any.whl Python 3 none any Details for path_tools_med-0.1.0-py3-none-any.whl

Total release size: 11.4 kB

Release files / path_tools_med-0.1.0.tar.gz

Download URL path_tools_med-0.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8ded949cb44beb461318cef74d38cac1ee7dc1d3ff5b0b0599be802fda35e897
BLAKE2b-256 checksum
How to use checksums
b00d77010be3168355f6c74e76f2e4eb4ec21d05225291942205a7651744c4a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

Release files / path_tools_med-0.1.0-py3-none-any.whl

Download URL path_tools_med-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1159aa9a7d02a4480a3db392ab00f350440c26875059cc174cb2770acde70dc9
BLAKE2b-256 checksum
How to use checksums
c656294a39cf2d43c548e8834c59eea8d1f18385b0373b50e49a032e276905e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1020-azure

Security for path-tools-med 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page