Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

This package provides helper functions to compute recurrences of events in a environment using the Zope Component Architecture (ZCA).

Copyright (c) 2013-2019 Michael Howitz

This package is licensed under the MIT License, see LICENSE.txt inside the package.

https://travis-ci.com/icemac/icemac.recurrence.svg?branch=master https://coveralls.io/repos/github/icemac/icemac.recurrence/badge.svg Current version on PyPI Supported Python versions Supported Python implementations

Usage

  • Register the package at the ZCA via ZCML:

    <include package="icemac.recurrence" />
  • Compute recurrences. The example computes the 2nd Tuesday each month.:

    >>> from icemac.recurrence import get_recurrences
    >>> get_recurrences(
    ...     datetime=datetime(2015, 10, 13, 11, 15),
    ...     period='nth weekday of month',
    ...     interval_start=datetime(2015, 1, 1),
    ...     interval_end=datetime(2015, 12, 31))
    [datetime(2015, 10, 13, 11, 15),
     datetime(2015, 11, 10, 11, 15),
     datetime(2015, 12, 8, 11, 15)]
  • Supported recurrence periods:

    • daily

    • weekly

    • biweekly

    • nth weekday of month

    • nth weekday every other month

    • nth weekday from end of month

    • nth weekday from end of other month

    • yearly

Hacking

Source code

Get the source code:

$ git clone https://github.com/icemac/icemac.recurrence

or fork me on: https://github.com/icemac/icemac.recurrence

Running the tests

You have to install tox onto your machine.

To run the tests yourself call:

$ tox

Changelog

1.7 (2019-09-26)

  • Add support for Python 3.8.

1.6 (2018-08-10)

  • Add support for Python 3.6 and 3.7, PyPy and PyPy3.

  • The tests are now run using tox.

1.5 (2018-08-03)

  • Change license from ZPL to MIT.

1.4.2 (2018-03-16)

  • Fix the computation of monthly recurrences not to return a date before the given interval_start date.

1.4.1.post1 (2017-12-26)

  • Also release as wheel.

1.4.1 (2017-04-11)

  • Fix a corner case in the computation of monthly recurrences: If the beginning of the interval for which recurrences should be computed was outside DST but the recurrence date was inside DST - it was incorrectly returned with a time zone object which did not have DST switched on.

1.4 (2017-04-08)

  • No longer exclude tests from coverage report.

1.3.1 (2017-02-04)

  • Fix computation of biweekly recurrences: Previously the first recurrence with a matching weekday in the interval was used as the first result for the interval. This is only correct in half of the cases. Now the computation of the first recurrence in the interval takes into account that it has to be an even number of weeks after the recurrence start date and it handles DST differences correctly.

1.3 (2017-01-07)

  • Add Manifest and clean up coverage configuration.

1.2 (2016-04-16)

  • Fix handling for dates with a timezone which has a daylight saving time (DST): The local time of the recurrence does not change when switching DST though the UTC representation of the time will now change.

1.1 (2016-03-01)

  • Shorten the import path of get_recurrences() from icemac.recurrence.recurrence to just icemac.recurrence.

  • Refactor tests to use py.test fixtures.

  • Fix an off by one month error in the periods nth weekday every other month and nth weekday from end of other month.

  • Bring the test coverage to 100 % even in branch coverage.

1.0.1 (2015-10-22)

  • Fix broken 1.0.0 release.

1.0.0 (2015-10-13)

  • Extract package from icemac.ab.calendar for reuse in other projects.

Release files for icemac.recurrence 1.7

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

Source distribution (sdist)

Source distribution for icemac.recurrence 1.7
File Size Uploaded
icemac.recurrence-1.7.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for icemac.recurrence 1.7
File Interpreter ABI Platform
icemac.recurrence-1.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 31.8 kB

Release files / icemac.recurrence-1.7.tar.gz

Download URL icemac.recurrence-1.7.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
946bcd67ce11fd0df16e96db0463cbb87961173c0af6a81699e19bbe4ec40ba9
BLAKE2b-256 checksum
How to use checksums
db1b3210f4aa272ed986c99a40ca8095ef16b228ff7411a2fa7e6bf6ef5504d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/None requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Release files / icemac.recurrence-1.7-py2.py3-none-any.whl

Download URL icemac.recurrence-1.7-py2.py3-none-any.whl
Size 17.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e0abf52f4028665860190c38be25af44e20c41df5ef6569d12b8e87d1c40711c
BLAKE2b-256 checksum
How to use checksums
fcfca384bf63d33211ec864611df7b5befe677ce7e922ccfe261bcfdf144f25d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/None requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
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