Skip to main content

Join various stringifiable objects and quote them for the shell

Project description

pshlex - join various stringifiable objects and quote them for the shell

[Home | GitLab | PyPI | Download | ReadTheDocs]

Overview

This library was written mainly to provide a function that can stringify a list of path-like objects: the [join()][pshlex.join] function is very similar to shlex.join(), but it will accept pathlib.Path objects as well as strings.

The [join_any()][pshlex.join_any] function started off as an implementation detail, but it may turn out to be useful in its own right; it is also similar to shlex.join(), but it will convert any Python object into its string representation.

Examples

Use the [join()][pshlex.join] function as a type-safe version when dealing with path-like objects:

def run(cmd: list[str | pathlib.Path]) -> None:
"""Run a command."""
    cmdstr: Final = pshlex.join(cmd)
    ...
        sys.exit(f"Could not run `{cmdstr}`: {err}")

Contact

The pshlex library was written by Peter Pentchev. It is developed in a GitLab repository. This documentation is hosted at Ringlet with a copy at ReadTheDocs.

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

pshlex-0.1.1.tar.gz (72.6 kB view details)

Uploaded Source

Built Distribution

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

pshlex-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pshlex-0.1.1.tar.gz.

File metadata

  • Download URL: pshlex-0.1.1.tar.gz
  • Upload date:
  • Size: 72.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pshlex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 980e9db476e9189e2b3c7943ec896fa2951985ad724d34d5a07860da0b60b2e0
MD5 fea5c0f167b447abd145eaf2cc734bc4
BLAKE2b-256 4dcae0565ec810a61a773e3bff7d05561481b87ec5db554ad7bdf19ac8cf8421

See more details on using hashes here.

File details

Details for the file pshlex-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pshlex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pshlex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd8906c37d57cbadf6bc1f8a429c3eec8c03565ed76fcc3314e46b5f8f9cb01e
MD5 0fe011c72c98111eb5cde222f8b2ce0f
BLAKE2b-256 6bc2811c28ec25fc28d72cd92ee462cd258590451863842672a3a54bfa9ac626

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