Skip to main content

'A Python click type which is similar to click.Path but returns a pathlib Path'

Project description

Build Status codecov Requirements Status PyPI

Click Pathlib

A Python click type which is similar to click.Path but returns a Pathlib.Path.

Installation

$ pip install click-pathlib

This supports Python 3.8+.

Usage

Use the click_pathlib.Path just like a click.Path type and your function will receive a pathlib.Path.

import click
import click_pathlib

@click.command('delete')
@click.argument(
    'existing_file',
    type=click_pathlib.Path(exists=True),
)
def delete(existing_file):
    existing_file.unlink()

Credits

Thanks to @jeremyh for describing this solution on GitHub at https://github.com/pallets/click/issues/405#issuecomment-470812067.

Contributing

See CONTRIBUTING.rst.

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

click-pathlib-2019.12.28.5.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

click_pathlib-2019.12.28.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file click-pathlib-2019.12.28.5.tar.gz.

File metadata

  • Download URL: click-pathlib-2019.12.28.5.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for click-pathlib-2019.12.28.5.tar.gz
Algorithm Hash digest
SHA256 f795506dc9e77901347e17bc68dd79a180f692a973a27e1c026f87082308f2b7
MD5 6a95094856e97e5a5aeec755c0529770
BLAKE2b-256 7abdc18f9dbf22081c3039e2b82d748f0f8c3a11fa14d2758a7df699aefb08f6

See more details on using hashes here.

File details

Details for the file click_pathlib-2019.12.28.5-py3-none-any.whl.

File metadata

  • Download URL: click_pathlib-2019.12.28.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for click_pathlib-2019.12.28.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ae7d452ea7af2ca8e439558bd2bc721981c9679fde0d1879b9eb071919083721
MD5 caaa6af24a2201b500450b8f76121300
BLAKE2b-256 482de3fb7b87a2accda99d2a4577873cb68b0d48c9e220e43cea5ec16321fdfa

See more details on using hashes here.

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