click-datetime
Datetime type support for click.
What it is and what it does
Click-datetime is a small extension that teaches Click how to parse datetime values from command-line arguments. It wraps Python's datetime type as a Click parameter type, letting you define a format string and automatically convert user input into datetime objects. The package sits between Click's parameter system and Python's datetime module, handling the string-to-object conversion so your CLI code receives properly typed datetime values instead of raw strings.
The package is straightforward: you instantiate a Datetime type with a format string, attach it to a Click option or argument, and the conversion happens automatically. It has no external dependencies beyond Click itself. However, the package is dormant—the last release was 704 days ago—so it receives no active maintenance. If you need datetime parsing in a Click CLI and the format is simple, this package works; if you encounter bugs or need support for complex datetime scenarios, you may need to patch it yourself or implement the conversion inline.
Use it for:
- Accept a date parameter in a CLI tool and receive a datetime object directly without manual string parsing.
- Build a backup or log-analysis CLI that takes date ranges as command-line arguments with automatic validation.
- Create a scheduling CLI where users specify dates in a consistent format and your code validates them automatically.
- Develop a data-processing script that accepts date filters from the command line with format validation built in.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds datetime type support to Click, allowing CLI developers to parse and validate date strings as command-line parameters with custom format specifications.
Yes, if you are building a Click CLI that needs datetime parameters and you are comfortable with a dormant package. The code is simple and the dependency footprint is minimal. No security vulnerabilities are known. The main trade-off is that you receive no active maintenance—if a bug appears or Click changes its internals, you will need to maintain a patch yourself or implement datetime parsing inline. For straightforward date-parameter use cases, the convenience outweighs the risk.
Install
click-datetime on PyPI
pip
pip install click-datetimeuv
uv add click-datetimepoetry
poetry add click-datetimeInstalling click-datetime
Before you install
Low friction installation with only two runtime dependencies (click and wheel). Package is dormant—last release was 704 days ago—so expect no active maintenance or bug fixes.
License in practice
MIT license is permissive; you can use this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install click-datetime
from datetime import datetime
import click
from click_datetime import Datetime
@click.command()
@click.option('--date', type=Datetime(format='%Y-%m-%d'))
def cli(date):
click.echo(f'Date: {date}')
if __name__ == '__main__':
cli()
Requires Python 3.12 or later (package specifies >=3.12,<4.0).
Verify before relying
- Whether the package works correctly with recent versions of Click (no changelog provided to confirm compatibility).
- Whether datetime parsing handles edge cases like timezone-aware datetimes or invalid format strings gracefully.
- Real-world stability and bug-fix responsiveness given dormant maintenance status.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — click, wheel |
| Maintenance | dormant — 704 days since the last release |
| First released | |
| Downloads | 75,483/month — #14,708 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: click_datetime-0.4.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
clickClick is a Python toolkit for building…
permissive · top 100 on PyPI
click-config-fileAdds configuration file support to Click…
permissive · top 15,000 on PyPI
more-clickProvides pre-built Click decorators and…
permissive · top 15,000 on PyPI
cligjProvides reusable Click command-line argument…
permissive · top 5,000 on PyPI
click-configfileExtends click with configuration file support,…
permissive · top 15,000 on PyPI
click-promptclick-prompt adds interactive prompts to Click…
permissive · top 15,000 on PyPI
click-help-colorsAdds color customization to Click command-line…
permissive · top 5,000 on PyPI
click-composeProvides composable callback utilities for…
permissive · top 15,000 on PyPI
click-option-groupAdds option groups to Click CLI applications,…
permissive · top 1,000 on PyPI
rich-clickRenders Click command-line interfaces with rich…
permissive · top 1,000 on PyPI