Skip to main content

Blackskirt

Relative weekday/date utilities useful for finding public holidays

Installation

pip install blackskirt

After installation is complete, try the following import statements to make sure it’s working.

from blackskirt import (WEEKDAY_MON, WEEKDAY_TUE, WEEKDAY_WED,
                        WEEKDAY_THU, WEEKDAY_FRI, WEEKDAY_SAT,
                        WEEKDAY_SUN,)
from blackskirt.ops import (mondayise, next_weekday, prev_weekday,
                            nearest_weekday, nth_weekday, last_weekday,
                            next_date, prev_date, nearest_date,)

Examples

mondayise

  1. New Year’s Day: 1 January (or the following Monday if it falls on a Saturday or Sunday)

# 2011-01-01 is Saturday
assert mondayise(year=2011, month=1, day=1,
                 cases=((WEEKDAY_SAT, WEEKDAY_MON),
                        (WEEKDAY_SUN, WEEKDAY_MON),)) == "2011-01-03"
  1. Day after New Year’s Day: 2 January (or the following Monday if it falls on a Saturday, or the following Tuesday if it falls on a Sunday)

# 2011-01-02 is Sunday
assert mondayise(year=2011, month=1, day=2,
                 cases=((WEEKDAY_SAT, WEEKDAY_MON),
                        (WEEKDAY_SUN, WEEKDAY_TUE),)) == "2011-01-04"

nth_weekday

Labour Day: The fourth Monday in October

assert nth_weekday(year=2014, month=10, n=4, weekday=WEEKDAY_MON) == "2014-10-27"

next_weekday

Marlborough provincial anniversary day: First Monday after Labour Day

assert next_weekday(year=2014, month=10, day=27, weekday=WEEKDAY_MON) == "2014-11-03"

nearest_weekday

Wellington provincial anniversary day: 22 January (Monday nearest to the actual day)

# 2014-01-22 is Wednesday
assert nearest_weekday(year=2014, month=1, day=22, weekday=WEEKDAY_MON) == "2014-01-20"

last_weekday

Memorial Day: Last Monday in May

assert last_weekday(year=2014, month=5, weekday=WEEKDAY_MON) == "2014-05-26"

next_date

Inauguration Day: First January 20 following a Presidential election

# 2012-11-06 was the previous presidential election day in US
assert next_date(month=1, day=20, offset=(2012, 11, 6)) == "2013-01-20"

License

All the code is licensed under the GNU Lesser General Public License (v3+).

Metadata

Release files for Blackskirt 0.1.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 Blackskirt 0.1.1
File Size Uploaded Provenance
Blackskirt-0.1.1.tar.gz 4.0 kB Without provenance Details

Release files / Blackskirt-0.1.1.tar.gz

Download URL Blackskirt-0.1.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1009c445f62b614b5dcc552fcba83c29d2db8ee2985e4484d154cac453360277
BLAKE2b-256 checksum
How to use checksums
7f2b29673bb7b417504a7a55d3e8ab148244adb16819b0d671b4925126956b78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Blackskirt 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

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