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.0.tar.gz (6.0 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.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pshlex-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pshlex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70bf82f89f797655883d1f029d6cfd8fe976610a91555c2c536d5897f87885af
MD5 14f529a9dc36c309a9b9e9b19c34b602
BLAKE2b-256 70db45000e379fade41ee65840b87760cc62487530669ba0ebddc85d3be48f48

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pshlex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2697e784fd301d9c64b97ec65f98b67539163c9a9917227292f36bb40ff439f
MD5 06743eb4c6bdd7e7ad364f409209f69e
BLAKE2b-256 c758624b18c31994fca1294df97ff905d6d72522a1fef2d34a26b9fba7447951

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