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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-pathlib-2019.4.30.2.tar.gz
  • Upload date:
  • Size: 19.9 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.2.tar.gz
Algorithm Hash digest
SHA256 a7e82cee61d103f46f588fc9c0421617fe760dc081c2a62f6f8822b1e4a9d8b9
MD5 097a501bd42df2d41240dda060075991
BLAKE2b-256 c88ccafb4eef88aee325a9e12f9f51be3a203629cc907ab27ac283a52f9eab44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click_pathlib-2019.4.30.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8fde39a07f755572009c432db717b4b77f7bb89f441073cedd31be0d64a760b
MD5 ede90c68afdd4b519c5763c14be11ef3
BLAKE2b-256 abcee74fc349b6b11ceb2a68ec81d8d18014336aaa67875ecb039c89921c1b59

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