suntimes
For a given place (longitude, latitude and altitude) and a given day, returns the time of sunrise and the time of sunset (in UTC and in local time). Create and save a json or csv file with the timetables for a whole year. Calculations valid beyond the polar circles; returns Polar Day or Polar Night if needed.
Decision gist · record as of 2026-08-14
Yes, if you need straightforward sunrise/sunset calculations and can accept that the package is no longer maintained. The code is stable, has no known vulnerabilities, and the three dependencies are well-established. Install it for one-off scripts or prototypes; for production systems where you may need bug fixes or Python version updates, consider whether an actively maintained alternative is available or whether you can fork and maintain it yourself.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with three stable runtime dependencies (pytz, tzlocal, jdcal).
- However, the package is abandoned—last commit was 2023-02-08 and no updates since July 2022.
- No active maintenance means bug fixes or compatibility updates are unlikely.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal restrictions. You may use this package freely in commercial and private projects, provided you retain the copyright notice and license text.
last release 2022-07-01 (1505 days) · last repo commit 2023-02-08 · 7 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 227,889 downloads/mo, #9,163 on PyPI
Alternatives
Verify before relying
from datetime import datetime
from suntimes import SunTimes
day = datetime(2021, 1, 6)
sun = SunTimes(2.349902, 48.852968, 35) # longitude, latitude, altitude
rise = sun.riseutc(day) # datetime(2021, 1, 6, 7, 43)
set_time = sun.setutc(day) # datetime(2021, 1, 6, 16, 12)- Accuracy degradation near polar regions—fact sheet notes 'the closer you get to the poles, the lower the accuracy' but does not quantify the error margin.
- Whether calculations remain valid for dates far in the past or future, or only near the present era.
- Compatibility with Python versions beyond 3.6 in practice, given the package is abandoned.
What it is and what it does
SunTimes is a Python library that computes sunrise and sunset times for a given geographic location and date. You provide longitude, latitude, and optional altitude, then call methods to retrieve times in UTC, local computer time, or any specified timezone. The library handles edge cases like polar day and polar night, returning special indicators when the sun does not rise or set. It also offers convenience methods to extract just the hour and minute, calculate day length, and generate annual timetables as JSON or CSV files.
The package relies on astronomical calculations based on the sunrise equation (from Wikipedia) and uses pytz, tzlocal, and jdcal for timezone and calendar math. Calculations are accurate to within one to several minutes. The library is straightforward to use for applications like solar energy planning, outdoor activity scheduling, or astronomy tools, but it is no longer maintained—the last commit was in February 2023 and no updates have been released since July 2022.
Use it for
- Schedule outdoor activities or events by retrieving sunrise/sunset times for a specific location and date.
- Generate annual solar timetables for a location in JSON or CSV format for reporting or spreadsheet analysis.
- Calculate day length (duration of daylight) for a location to inform energy consumption or agricultural planning.
- Detect and handle polar day/polar night conditions in high-latitude applications.
- Build solar energy or astronomy tools that need accurate sun position times across multiple timezones.
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 and can accept that the package is no longer maintained.
The code is stable, has no known vulnerabilities, and the three dependencies are well-established. Install it for one-off scripts or prototypes; for production systems where you may need bug fixes or Python version updates, consider whether an actively maintained alternative is available or whether you can fork and maintain it yourself.
Install
suntimes on PyPI
Before you install
Low install friction with three stable runtime dependencies (pytz, tzlocal, jdcal). However, the package is abandoned—last commit was 2023-02-08 and no updates since July 2022. No active maintenance means bug fixes or compatibility updates are unlikely.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions. You may use this package freely in commercial and private projects, provided you retain the copyright notice and license text.
Quickstart
from datetime import datetime
from suntimes import SunTimes
day = datetime(2021, 1, 6)
sun = SunTimes(2.349902, 48.852968, 35) # longitude, latitude, altitude
rise = sun.riseutc(day) # datetime(2021, 1, 6, 7, 43)
set_time = sun.setutc(day) # datetime(2021, 1, 6, 16, 12)
Verify before relying
- Accuracy degradation near polar regions—fact sheet notes 'the closer you get to the poles, the lower the accuracy' but does not quantify the error margin.
- Whether calculations remain valid for dates far in the past or future, or only near the present era.
- Compatibility with Python versions beyond 3.6 in practice, given the package is abandoned.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagespytztzlocaljdcal |
| Maintenance | Abandoned 1,505 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 227,889 / month, #9,163 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: suntimes-1.1.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 › “solar time by location”
- suntimesCalculates sunrise and sunset times for any geographic location…
- suntimeCalculates sunrise and sunset times for any geographic location and…
- PyMeeusPyMeeus implements astronomical algorithms from Jean Meeus's…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also suntime · pytz · business-duration · kerykeion · lat-lon-parser · tzfpy · pendulum · pygeodesy · backports.zoneinfo · businesstimedelta