Registry / data / pymeeus

pymeeus

JSON →
library0.5.12pypypi✓ verified 26d ago

PyMeeus is a Python library that implements astronomical algorithms described in the classical book 'Astronomical Algorithms, 2nd Edition' by Jean Meeus. It provides routines for celestial mechanics, ephemerides, and time conversions. The library is known for its simplicity, ease of use, minimal dependencies, and abundant documentation. The current version is 0.5.12, with an irregular release cadence focused on bug fixes and new functionality.

pip install pymeeus
INSTALL
IMPORT
SIG · PYMEEUS
P
pymeeus
datapythonv0.5.12
Install
3.2s avg
Import
10ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 23.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.2s · import 0.010s · 24MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Epoch
from pymeeus.Epoch import Epoch
import pymeeus; mydate = pymeeus.Epoch(year, month, day)
PyMeeus is a library composed of multiple modules (e.g., Angle, Epoch, Coordinates), not a single module. Directly importing `pymeeus` does not expose its sub-modules' classes/functions in the top-level namespace, leading to an AttributeError.
Angle
from pymeeus.Angle import Angle
import pymeeus; myangle = pymeeus.Angle.Angle(value)
Similar to Epoch, Angle and other sub-modules must be imported directly or from the `pymeeus.ModuleName` namespace to access their components.

This quickstart demonstrates how to correctly import classes like `Epoch` and `Sun` and use them to calculate fundamental astronomical values such as the Julian Ephemeris Day (JDE) and the Sun's geocentric apparent longitude for a given date.

from pymeeus.Epoch import Epoch from pymeeus.Sun import Sun # Create an Epoch object for a specific date and time my_epoch = Epoch(1992, 10, 13, 0, 0, 0) # Get the Julian Ephemeris Day (JDE) jde = my_epoch.get_jde() print(f"Julian Ephemeris Day for 1992-10-13: {jde}") # Calculate the Sun's geocentric apparent longitude for this epoch sun = Sun(my_epoch) longitude = sun.geocentric_apparent_longitude().degrees print(f"Sun's Geocentric Apparent Longitude: {longitude:.4f} degrees")
Debug
Known issues
gotchaIncorrect Import Pattern: Importing `pymeeus` directly and expecting sub-modules or classes to be available in its top-level namespace (e.g., `pymeeus.Epoch`) will result in an `AttributeError`. Each specific class or module must be imported directly from its path within `pymeeus` (e.g., `from pymeeus.Epoch import Epoch`).
fix
Always use explicit imports like `from pymeeus.ModuleName import ClassName` or `import pymeeus.ModuleName`.
affects: All versions
gotchaOutdated Leap Seconds Table in `Epoch` Class: The `Epoch` class uses an internal table for leap seconds. As leap seconds are added irregularly, this table can become outdated. Using an outdated table when converting between UTC and TT can lead to inaccuracies.
fix
Regularly update the `pymeeus` package to get the latest leap seconds table. For critical applications, consider providing the `leap_seconds` argument manually to the `Epoch` constructor or `set` method if an updated package is not available.
affects: All versions
gotchaTime Resolution Limitations: The `Epoch` class stores time as Julian Ephemeris Day (JDE). For computers with 15-digit accuracy, the final time resolution is approximately 10 milliseconds. This level of precision might be insufficient for extremely high-precision astronomical calculations.
fix
Evaluate if a 10-millisecond resolution meets your application's precision requirements. For higher precision, consider libraries designed for such demands, possibly involving arbitrary-precision arithmetic, though PyMeeus focuses on simplicity.
affects: All versions
gotchaAlternative Library `PyPlanets`: While PyMeeus is active, a refactored version called `pyplanets` exists, which aims for a more object-oriented design and improved maintainability. Users starting new projects might consider `pyplanets` if these design principles are preferred, although `pymeeus` remains functional and well-documented.
fix
Review `pyplanets` (available on PyPI) to see if its design aligns better with new project requirements. Existing `pymeeus` projects are not directly affected.
affects: All versions
Errors
Common errors & fixes
AttributeError: module 'pymeeus' has no attribute 'Epoch'
The user attempted to access a class (like `Epoch`) directly through the top-level `pymeeus` package after `import pymeeus`, instead of importing it from its specific submodule (e.g., `pymeeus.Epoch`).
fix
Import the specific module containing the desired class, then access the class through that module, for example: `from pymeeus.Epoch import Epoch` then `mydate = Epoch(1992, 10, 13.0)`. Alternatively, `import pymeeus.Epoch` then `mydate = pymeeus.Epoch.Epoch(1992, 10, 13.0)`.
ModuleNotFoundError: No module named 'pymeeus'
The `pymeeus` library has not been installed in the current Python environment or the Python interpreter cannot find it in its search path.
fix
Install the library using pip: `pip install pymeeus`. If using Python 3 specifically, `pip3 install pymeeus`.
AttributeError: module 'pymeeus.Epoch' has no attribute 'Epoch'
After importing a submodule (e.g., `import pymeeus.Epoch`), the user attempted to directly instantiate `pymeeus.Epoch()` instead of accessing the class named `Epoch` *within* the `pymeeus.Epoch` module, which should be `pymeeus.Epoch.Epoch()`. This occurs when the class and its containing module share the same name.
fix
Access the class using its full path: `import pymeeus.Epoch` then `mydate = pymeeus.Epoch.Epoch(1992, 10, 13.0)`. A cleaner approach is to use `from pymeeus.Epoch import Epoch` and then `mydate = Epoch(1992, 10, 13.0)`.
Upgrade
Version history
0.5.12latest on PyPI · released Dec 11, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
Resources
pymeeus — pip install pymeeus · libregistry