Cosmicly
Cosmicly is a Python package that answers the important questions in life:
- How much would I weigh on Jupiter?
- How old would I be on Mercury?
- What time is it on Mars right now?
- How long would it take to drive to Neptune?
It uses real orbital periods, gravity, and solar day lengths for the eight planets and Earth's Moon, so the numbers are (mostly) real, even if the questions are strange.
Install from source
You need Python 3.11 or newer and Pipenv. Run these commands in a terminal:
git clone https://github.com/software-students-fall2026/python-package-exercise-LCDJ.git
cd python-package-exercise-LCDJ
pipenv install --dev
pipenv run python -m pip install -e .
The editable install lets Python import cosmicly from src and pick up your changes immediately. The package includes its planetary data and needs no environment variables or database.
The distribution is named cosmicly. Use the source installation above until a release is available. PyPI project page
Use cosmicly
Save these examples in a Python file and run it with pipenv run python your_script.py. For an interactive tour of the package, run the included example program:
pipenv run python example.py
Age and weight
age_on_planet converts Earth years to years on the destination using its orbital period. earth_age calculates your age in Earth years from a birthdate. weight_on_planet scales an Earth weight in "w" mode and calculates weight in newtons from a mass in kilograms in "m" mode.
from cosmicly import age_on_planet, earth_age
from cosmicly.planetary_weight import weight_on_planet
print(age_on_planet(20, "mercury")) # 83.0 Mercury years
print(earth_age("2000-01-01")) # Age in Earth years as of today
print(weight_on_planet("w", 70, "mars")) # 26.43 in the input weight unit
print(weight_on_planet("m", 70, "moon")) # 112.0 newtons
Planetary clocks and comparisons
relative_time returns an HH:MM:SS reading on a simulated planetary clock. It starts the Earth and destination clocks together at midnight and uses the destination's solar day length. Pass a datetime for a fixed reference reading or omit it to use the current local time. compare_planets returns your age and weight on two different destinations as a dictionary.
from datetime import datetime
from cosmicly import compare_planets, relative_time
print(relative_time("mars")) # Simulated time now
print(relative_time("mars", datetime(2026, 1, 1, 12))) # 11:40:44
comparison = compare_planets("mars", "jupiter", "2000-01-01", 70)
print(comparison["mars"]["age"])
print(comparison["jupiter"]["weight"])
Travel from Earth
distance_from_earth gives the distance to a planet in km. Without a date it uses the closest approach; with a date ("YYYY-MM-DD" or a date) it uses the real distance on that day, since planets move. travel_at_speed gives the travel time at any speed in km/h, and drive_to, fly_to, and light_speed_to use car, plane, and light speed. arrival_age tells you how old you'll be when you arrive. format_duration turns seconds into readable text.
from cosmicly.planetary_travel import (
arrival_age,
distance_from_earth,
drive_to,
fly_to,
format_duration,
light_speed_to,
travel_at_speed,
)
print(distance_from_earth("moon")) # 384400 km
print(travel_at_speed("mars", 40_000)) # Travel time at 40,000 km/h
print(drive_to("mars")) # 89 years at 100 km/h
print(drive_to("mars", "2026-11-10")) # 232 years, real distance that day
print(fly_to("moon")) # 18 days at 900 km/h
print(light_speed_to("mars")) # 4 minutes
print(arrival_age("mars", 100, 20)) # 109.44, your age when you arrive
print(format_duration(3600)) # 1 hour
Build and test
Run these commands from the repository root after installing the development dependencies:
pipenv run python -m build
pipenv run python -m pytest
pipenv run python -m pytest --cov=cosmicly --cov-report=term-missing
The build writes a wheel and a source archive to dist/. The tests live in tests/. GitHub Actions builds the package and runs the tests on pull requests targeting main. Tests workflow
Team
Data sources
The package stores orbital periods, gravity, distances from the Sun, and solar day lengths in data.py. NASA Planetary Fact Sheet · NASA Mars24
Metadata
Release files for cosmicly 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cosmicly-0.1.0.tar.gz | 27.7 kB | Without provenance | Details for cosmicly-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cosmicly-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cosmicly-0.1.0-py3-none-any.whl |
Total release size: 49.5 kB
Release files / cosmicly-0.1.0.tar.gz
| Download URL | cosmicly-0.1.0.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e67033bd6bbb47b12d301fb251c1e3e8b69223889d81752927b612401abd5e57
|
|
BLAKE2b-256 checksum How to use checksums |
acb04e9dfbc109344ce0ccafe168b73a91f36196aae26b0a93d34ac50bcc8766
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Release files / cosmicly-0.1.0-py3-none-any.whl
| Download URL | cosmicly-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7930bfb7bd332120774590c96c9fb157e5848ce142bc062e9b3307bb7760ffb
|
|
BLAKE2b-256 checksum How to use checksums |
84899040d998ae7e4134e0d17a0c5cbd6c1171e99b7007f6e92e57aa327bb17d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Security for cosmicly 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.