1. pathvalidate

PyPI package version conda package version Supported Python versions Supported Python implementations CI status of Linux/macOS/Windows Test coverage: coveralls CodeQL

1.1. Summary

pathvalidate is a Python library to sanitize/validate a string such as filenames/file-paths/etc.


1.2. Features

  • Sanitize/Validate a string as a:
    • file name

    • file path

  • Sanitize will do:
    • Remove invalid characters for a target platform

    • Replace reserved names for a target platform

    • Normalize

    • Remove unprintable characters

  • Argument validator/sanitizer for argparse and click

  • Multi platform support:
    • Linux

    • Windows

    • macOS

    • POSIX

    • universal (platform independent)

  • Multibyte character support

1.3. CLI tool

You can find this package’s command line interface tool at the pathvalidate-cli repository.

2. Installation

2.1. Installation: pip

pip install pathvalidate

2.2. Installation: conda

conda install -c thombashi pathvalidate

2.3. Installation: apt

sudo add-apt-repository ppa:thombashi/ppa
sudo apt update
sudo apt install python3-pathvalidate

3. Dependencies

Python 3.7+ no external dependencies.