suntime
Simple sunset and sunrise time calculation python library
Decision gist · record as of 2026-08-14
Yes, if you need straightforward sunrise/sunset calculations. The library is simple, has low install friction, no known vulnerabilities, and a stable API. However, maintenance is dormant—no updates since March 2024—so if you need active support or frequent bug fixes, consider whether this is acceptable for your use case. The LGPLv3 license is permissive for most projects but requires attention if you're building proprietary software.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with a single runtime dependency on python-dateutil.
- Last release was in March 2024; the repository is dormant but not archived, with no recent activity to suggest active maintenance.
License · maintenance · safety
LGPLv3 (copyleft) — Licensed under LGPLv3 (copyleft). You may use and modify the library freely, but any derivative work must also be distributed under LGPLv3 or a compatible license.
last release 2024-03-10 (887 days) · last repo commit 2024-07-11 · 120 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 212,778 downloads/mo, #9,451 on PyPI
Alternatives
Verify before relying
pip install suntime
from suntime import Sun
import datetime
sun = Sun(51.21, 21.01) # Warsaw coordinates
today_sr = sun.get_sunrise_time()
today_ss = sun.get_sunset_time()
print(f'Sunrise: {today_sr}, Sunset: {today_ss}')- Accuracy of calculations and whether they match standard astronomical references
- Whether polar-region edge cases (midnight sun, polar night) are handled correctly in all scenarios
- Current maintenance status and likelihood of bug fixes or updates
What it is and what it does
SunTime is a lightweight Python library that computes sunrise and sunset times for any geographic location and date. It takes latitude and longitude as input and returns datetime objects representing when the sun rises and sets, either in UTC or in a specified local timezone. The library handles the mathematical complexity of solar position calculations internally, so you don't need to implement the astronomy yourself.
The main use case is applications that need to know daylight hours—weather apps, scheduling systems, outdoor activity planners, or any tool that must adapt behavior based on solar events. It includes error handling for edge cases like polar regions where the sun may not rise or set on certain dates, raising SunTimeException when these conditions occur. The library depends only on python-dateutil for timezone handling.
Use it for
- Determine daylight hours for a given location and date in a weather or outdoor activity app
- Schedule tasks or alerts to trigger at sunrise or sunset in a user's local timezone
- Calculate solar noon or twilight times for photography, astronomy, or solar energy applications
- Validate whether a location experiences midnight sun or polar night on a specific date
- Build a calendar or scheduling UI that highlights daylight and darkness periods
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need straightforward sunrise/sunset calculations.
The library is simple, has low install friction, no known vulnerabilities, and a stable API. However, maintenance is dormant—no updates since March 2024—so if you need active support or frequent bug fixes, consider whether this is acceptable for your use case. The LGPLv3 license is permissive for most projects but requires attention if you're building proprietary software.
Install
suntime on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency on python-dateutil. Last release was in March 2024; the repository is dormant but not archived, with no recent activity to suggest active maintenance.
License in practice
Licensed under LGPLv3 (copyleft). You may use and modify the library freely, but any derivative work must also be distributed under LGPLv3 or a compatible license.
Quickstart
pip install suntime
from suntime import Sun
import datetime
sun = Sun(51.21, 21.01) # Warsaw coordinates
today_sr = sun.get_sunrise_time()
today_ss = sun.get_sunset_time()
print(f'Sunrise: {today_sr}, Sunset: {today_ss}')
Verify before relying
- Accuracy of calculations and whether they match standard astronomical references
- Whether polar-region edge cases (midnight sun, polar night) are handled correctly in all scenarios
- Current maintenance status and likelihood of bug fixes or updates
Package facts
| License | LGPLv3 copyleft |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepython-dateutil |
| Maintenance | Dormant 887 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 212,778 / month, #9,451 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: suntime-1.3.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sunrise sunset time calculation”
- suntimeCalculates sunrise and sunset times for any geographic location and…
- suntimesCalculates sunrise and sunset times for any geographic location…
- PyMeeusPyMeeus implements astronomical algorithms from Jean Meeus's…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also suntimes · pytz · tzfpy · sunpy · backports.zoneinfo · arrow · lunardate · moment · tzwhere · airporttime