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.5+.

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.4.30.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

click_pathlib-2019.4.30.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-pathlib-2019.4.30.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for click-pathlib-2019.4.30.0.tar.gz
Algorithm Hash digest
SHA256 f47aee8a8cccbc11e8486f0375ab647b74c127208c6b7c29bb1c654d7d8bb9c7
MD5 4c3e61b4936a38b5aaae6d691a056aef
BLAKE2b-256 047e14727abfbe95463fb74d0aff1ae97777340add68faad4310de8c10ce49ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click_pathlib-2019.4.30.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for click_pathlib-2019.4.30.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b834e20dcb261c82448555a6eb2ccfe6f0a08aba8a828a6254e0ace02f39ea7
MD5 795732b81586bd500430bdcc087f249e
BLAKE2b-256 6efc0d4ae18f6614b5cbd8214e91456208c1d8392de2730452d89b2c37dbd1bb

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