click_extra.sphinx.announcement module

Count the years an announcement banner claims, like “maintained for 5+ years”.

A figure written by hand in conf.py goes stale on the next anniversary. years_since() computes it again on each build, so the banner of a site published from CI stays current.

click_extra.sphinx.announcement.years_since(start, *, today=None)[source]

Return the whole years from start to today.

The count goes up on each anniversary of start, never before it. A count of days divided by 365 would run a day ahead for each leap day in between. A start on 29 February has its anniversary on 1 March of a common year.

Parameters:
  • start (date) – the day the count starts from.

  • today (date | None) – the day the count ends on. Defaults to the current day in UTC, which is the day of the build.

Return type:

int

Returns:

the whole years from start to today, rounded down: negative when today comes before start.