{"id":44575,"library":"click-pathlib","title":"click-pathlib","description":"A Click parameter type that behaves like click.Path but returns a pathlib.Path object instead of a string. Version 2020.3.13.0 is the latest released in March 2020. Low activity; no releases since 2020.","status":"maintenance","version":"2020.3.13.0","language":"python","source_language":"en","source_url":"https://github.com/adamtheturtle/click-pathlib","tags":["click","pathlib","cli"],"install":[{"cmd":"pip install click-pathlib","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for Click types","package":"click","optional":false}],"imports":[{"note":"Common mistake: wrong casing or using 'pathlib' suffix instead of 'Path'.","wrong":"from click_pathlib import Pathlib","symbol":"Path","correct":"from click_pathlib import Path"}],"quickstart":{"code":"import click\nfrom click_pathlib import Path\n\n@click.command()\n@click.option('--output', type=Path(exists=False), help='Output file path')\ndef main(output):\n    click.echo(f'Output path: {output}')\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"Defines a Click command with a pathlib.Path option that does not require the path to exist."},"warnings":[{"fix":"Check Click version compatibility. Use click.Path with path_type=pathlib.Path for simpler cases.","message":"Does not support the 'dir_okay', 'file_okay', or 'path_type' parameters from click.Path; only supports 'exists', 'file_okay', 'dir_okay', 'writable', 'readable', 'resolve_path'. In Click 8.x, click.Path behavior changed; this library may not be compatible.","severity":"breaking","affected_versions":"all"},{"fix":"Consider using click.Path(path_type=pathlib.Path) instead, which is built into Click.","message":"Library is not actively maintained. Since Click 7.0, click.Path supports a 'path_type' argument that can return pathlib.Path directly, making this library less necessary.","severity":"deprecated","affected_versions":"all"},{"fix":"Understand that validation happens at click parsing time; the function receives a valid Path.","message":"If the file does not exist and exists=True, the parameter still returns a Path object even though the path doesn't exist at runtime; the exception is raised before the function body.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2020':29,35 '2020.3.13.0':22 'activ':31 'behav':9 'cli':38 'click':2,5,36 'click-pathlib':1 'click.path':11 'instead':17 'latest':25 'like':10 'low':30 'march':28 'object':16 'paramet':6 'pathlib':3,37 'pathlib.path':15 'releas':26,33 'return':13 'sinc':34 'string':20 'type':7 'version':21","created_at":"2026-06-07T12:50:48.123722+00:00","updated_at":"2026-06-07T12:50:48.123722+00:00","problems":[{"fix":"Use 'from click_pathlib import Path'.","cause":"Incorrect import statement; sometimes people try import click_pathlib and then click_pathlib.Path() but the class is named 'Path' exactly.","error":"AttributeError: module 'click_pathlib' has no attribute 'Path'"},{"fix":"Use the parameter decorator correctly: @click.option('--path', type=Path(exists=False)).","cause":"Attempting to call the Path class without arguments incorrectly, or naming conflict with pathlib.Path.","error":"TypeError: 'Path' object is not callable"},{"fix":"Set exists=False if the file may not pre-exist, or create the file before invoking.","cause":"Set exists=True and the file does not exist at the time of command invocation.","error":"click.exceptions.BadParameter: Invalid value for '--path': Path '...' does not exist."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/adamtheturtle/click-pathlib","github":"https://github.com/adamtheturtle/click-pathlib","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}