Skip to main content

Click Pendulum

Click support for Pendulum date, time, interval and duration types to allow developers to easily parse strings as parameters to Python click CLIs.

Example: pendulum.DateTime

You can accept a Pendulum DateTime as a parameter to your click CLI

import click, pendulum
from click_pendulum import DateTime

@click.option(
    "--date",
    type=DateTime(),
    default=pendulum.now(),
    help="An example parsing and printing a datetime.",
)
@click.command()
def cli(date: pendulum.DateTime):
    click.echo("The date : {0}".format(date))

if __name__ == "__main__":
    cli()  # type: ignore
$ python examples/datetime_with_custom_format.py --date=2016-01-01
The date : 2016-01-01 00:00:00+00:00

Example: pendulum.Duration

You can accept a Pendulum Duration as a parameter to your click CLI

import click, pendulum
from click_pendulum import Duration

@click.option(
    "--duration",
    type=Duration(),
    help="Parse a duration string.",
)
@click.command()
def cli(duration: pendulum.Duration):
    click.echo(f"Duration: {duration}")

if __name__ == "__main__":
    cli()  # type: ignore
$ python examples/duration_parser.py --duration="2d5h"
Duration: 2 days 5 hours
pip install click-pendulum

Development

Building and packaging

poetry build

Testing the compiled wheel

# Create a virtual environment for testing
python -m .venv/test
source .venv/test/bin/activate

# Confirm importing and exporting is correct
python -c 'import click_pendulum as cd; print(dir(cd))'

Authors

  • Dawson Reid (@ddaws)

Metadata

Release files for click-pendulum 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for click-pendulum 0.2.1
File Size Uploaded Provenance Actions
click_pendulum-0.2.1.tar.gz 2.5 kB Without provenance Details for click_pendulum-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for click-pendulum 0.2.1
File Interpreter ABI Platform Actions
click_pendulum-0.2.1-py3-none-any.whl Python 3 none any Details for click_pendulum-0.2.1-py3-none-any.whl

Total release size: 5.8 kB

Release files / click_pendulum-0.2.1.tar.gz

Download URL click_pendulum-0.2.1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
18ae6b6d99e7f6c86128d07e7659997cd7a361495e5165861cb58dc688b557b0
BLAKE2b-256 checksum
How to use checksums
48281b77617656b1d09d2702ecfafadc034ecf0b1e6458e8594ec57f6d220e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.6.44-1-MANJARO

Release files / click_pendulum-0.2.1-py3-none-any.whl

Download URL click_pendulum-0.2.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12055375d93280efebe7837ec85bcb0f6f7b33232eecefb4886011f3f383af0e
BLAKE2b-256 checksum
How to use checksums
28b0386103cd8094da0189b9dda0364ef34830a2b46e74fece965117067f119f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.4 Linux/6.6.44-1-MANJARO

Security for click-pendulum 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page