--- id: suntimes version: "1.1.2" license: MIT License Copyright (c) [2022] [Paul MATHIS] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) license_treatment: permissive maintenance: abandoned --- # 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. License: permissive · Maintenance: abandoned · Downloads: 227.9K/mo ## 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 above — verify before relying. Calculates sunrise and sunset times for any geographic location (longitude, latitude, altitude) on a given date, handling polar regions where day/night calculations differ. 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 pip install suntimes uv add suntimes poetry add suntimes ## Installing suntimes 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: MIT License Copyright (c) [2022] [Paul MATHIS] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 227.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sunrise sunset time calculation, solar time by location, dawn dusk times coordinates, polar day polar night detection, sun position astronomy python, daylight duration calculator, solar ephemeris library, astronomy, solar-time, geolocation [View on SkillFed](https://skillfed.io/packages/suntimes) · [View on PyPI](https://pypi.org/project/suntimes/)