--- id: suntime version: "1.3.2" license: LGPLv3 license_treatment: copyleft maintenance: dormant --- # suntime — Simple sunset and sunrise time calculation python library License: copyleft · Maintenance: dormant · Downloads: 212.8K/mo ## 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 above — verify before relying. Calculates sunrise and sunset times for any geographic location and date, handling edge cases like polar regions where the sun may not rise or set. 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 pip install suntime uv add suntime poetry add suntime ## Installing suntime 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 212.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sunrise sunset time calculation, solar times by latitude longitude, sun position astronomy, daylight hours calculator, solar event times, geographic sunrise sunset, astronomy, solar-calculations, geolocation [View on SkillFed](https://skillfed.io/packages/suntime) · [View on PyPI](https://pypi.org/project/suntime/)