Skip to main content

justnow

justnow is a systemd.timer inspired event parser in pure Python. The library consists of a lark grammar definition and some code to parse and generate datetimes.

Usage

Below is a snippet of the basic usage.

import datetime

from justnow.parser import EventParser

reference_date = datetime.datetime(2020, 1, 1)

# "sat *-*-* 14:00:00" => Generate all Saturdays at 14:00:00
parser = EventParser("sat *-*-* 14:00:00", reference_date=reference_date)

next(parser)  # datetime.datetime(2020, 1, 4, 14, 0)

# "sat *-02-29" => Generate all Saturdays which occur on a leap year
parser = EventParser("sat *-02-29", reference_date=reference_date)

list(parser.get_next_n(limit=2))  # [datetime.datetime(2020, 2, 29, 0, 0), datetime.datetime(2048, 2, 29, 0, 0)]

The justnow grammar defines a time event and is made of up 3 sections:

Weekday section

This section allows for a comma separated list of weekday names and weekday ranges.

Weekday names

The following are valid tokens for the weekday section:

  • mon
  • tue
  • wed
  • thu
  • fri
  • Mon
  • Tue
  • Wed
  • Thu
  • Fri
  • monday
  • tuesday
  • wednesday
  • thursday
  • friday

Weekday ranges

A weekday range consists of two day names separated by two full stops.

For example mon..wed will evaluate into mon, tue and wed.

Date section

The date section is made up of 3 sub sections, namely:

  • A year section
  • A month section
  • A day section

Each of the above sub sections can be either:

  • One of more fixed length strings made up of integers separated by a comma. The length is 4 for years and 2 for months and days.
  • A wildcard *

Time section

The time section is made up of 3 sub sections, namely:

  • A hour section
  • A minute section
  • A second section

Each of the above sub sections can be either:

  • One of more strings made up of 2 integers separated by a comma.
  • A wildcard *

Named Events

justnow also supports a set of built in named events including:

  • @minutely
  • @hourly
  • @daily
  • @monthly
  • @weekly
  • @yearly
  • @quarterly
  • @semiannually
  • @annually

Metadata

Release files for justnow 0.1.4

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

Source distribution (sdist)

Source distribution for justnow 0.1.4
File Size Uploaded Provenance Actions
justnow-0.1.4.tar.gz 6.8 kB Without provenance Details for justnow-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for justnow 0.1.4
File Interpreter ABI Platform Actions
justnow-0.1.4-py3-none-any.whl Python 3 none any Details for justnow-0.1.4-py3-none-any.whl

Total release size: 14.1 kB

Release files / justnow-0.1.4.tar.gz

Download URL justnow-0.1.4.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
004b6e91ca56a16dbf43577d0820877e62ae3e99300f6f4d3ef40c428e674e02
BLAKE2b-256 checksum
How to use checksums
6fb88d684edb76af3ed258214a865ee11c2bf72e555d7f92b337a2aca809d9e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.5 Linux/5.8.3-arch1-1

Release files / justnow-0.1.4-py3-none-any.whl

Download URL justnow-0.1.4-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
985aceba11f1f5061dba16b5b0023c3c91a46b7136e3cf888363d2e30b5b5556
BLAKE2b-256 checksum
How to use checksums
5781ee33d1f4db1bd4070219af844e41c2e6c3590087935dce09ba4f75248104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.5 Linux/5.8.3-arch1-1

Security for justnow 0.1.4

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