Skip to main content

A tool for asteroid observation scheduling and analysis

Project description

AsteroidPy

GitHub Contributor Covenant contributions welcome

AsteroidPy is a command-line tool for astronomers to schedule and manage asteroid observations. It integrates with the Minor Planet Center and other astronomical data sources to provide ephemerides, NEO confirmation candidates, weather forecasts, and observing aids—all from an interactive terminal UI built with Textual.


Table of Contents


Features

Feature Description
Weather forecast Astronomical weather (cloud cover, seeing, transparency) up to 72 hours via 7Timer
Observation scheduling Plan sessions with target lists and visibility windows
NEOcp candidates List and filter Near-Earth Object candidates from the MPC Confirmation Page
Object ephemeris Retrieve detailed ephemeris data for any minor body
Twilight & Sun/Moon Civil, nautical, and astronomical twilight; rise/set times
Virtual horizon Simulate horizon obstructions for visibility calculations

Requirements

  • Python 3.9 or later
  • pip (or another Python package manager)

AsteroidPy runs on Linux, macOS, and Windows.


Installation

From source

  1. Clone the repository:

    git clone https://github.com/ziriuz84/asteroidpy.git
    cd asteroidpy
    
  2. (Recommended) Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate   # On Windows: .venv\Scripts\activate
    
  3. Install in editable mode:

    pip install -e .
    

    Or in normal mode:

    pip install .
    

Quick Start

Run the application:

asteroidpy

On first launch, AsteroidPy creates a config directory at ~/.asteroidpy with default settings. Use the Configuration menu to set:

  • Observatory: coordinates, altitude, MPC code
  • Virtual horizon: minimum altitude per cardinal direction
  • General: interface language

Configuration

Configuration is stored in ~/.asteroidpy. Use the in-app Configuration → General menu to change:

Option Description
Observatory Latitude, longitude, altitude, MPC observatory code
Virtual horizon Minimum altitude (in degrees) per cardinal direction for visibility
Language Interface language (English, Italiano, Deutsch, Français, Español, Português)

FAQ

Where do I find my MPC observatory code?
The Minor Planet Center publishes the list of observatory codes. If your site is not listed, use XXX or another temporary code until you register it with the MPC.

Why do ephemerides differ from Stellarium or other tools?
Small differences can arise from different orbital elements, epoch dates, or time handling. AsteroidPy uses MPC data directly; ensure your observatory coordinates and time (UTC vs local) match across tools.

The application fails to start or shows errors.
Check that all dependencies are installed (pip install .), that ~/.asteroidpy is writable, and that you have internet access (required for weather and ephemeris queries). If the config file is corrupted, you can remove ~/.asteroidpy and let the app recreate it on next run.

Which languages are supported?
English (default), Italiano, Deutsch, Français, Español, Português. Change the language in Configuration → GeneralLanguage. Only locales with compiled .mo files are listed as selectable; if a folder under locales/ has only a base.po, the UI may show a notice when opening the language screen—compile with msgfmt so the locale appears as a proper option.


Data Sources

AsteroidPy relies on:


For Contributors

Thank you for considering contributing to AsteroidPy. Please read the Code of Conduct before participating.

Types of contributions we welcome

  • Code: bug fixes, new features, refactoring
  • QA: bug reports with repro steps and environment details
  • Documentation: improvements to this README, docstrings, or Sphinx docs
  • Community: presenting the project, organizing local meetups

Development setup

  1. Clone the repository and install in editable mode (see Installation).

  2. Install development dependencies (optional, for tests and linting):

    pip install pytest ruff mypy black isort
    
  3. Run the test suite:

    pytest -q
    

    Run a single test:

    pytest tests/test_scheduling.py::test_name -q
    
  4. Lint and type-check:

    ruff check .
    mypy .
    
  5. Build the package:

    python -m build
    

Code style

  • Imports: standard library → third-party → local; explicit imports only
  • Formatting: Black for style; isort for import order
  • Types: type hints on public APIs; snake_case for functions/variables; CamelCase for classes
  • Errors: avoid bare except; raise or propagate clear exceptions; validate inputs early
  • Tests: small, isolated tests; prefer parameterized tests where sensible

Getting involved

  • Browse open issues and comment or pick one to work on
  • Open issues for bugs or feature ideas—the more detail, the better
  • Pull requests are welcome; please ensure tests pass and style is consistent

Project architecture

asteroidpy/
├── __init__.py       # Entry point; loads config, launches interface
├── interface/        # Textual TUI, gettext setup (legacy menu helpers retained)
├── scheduling.py     # Ephemerides, weather, NEOcp, twilight
├── configuration.py  # Observatory config, horizon, language
└── locales/          # gettext translations (en, it, de, fr, es, pt)
  • interface — Main entry for the interactive UI (Textual screens). Loads config, sets up gettext, and delegates to scheduling for ephemeris/weather/NEOcp and to configuration for settings.
  • scheduling — Astronomy logic: MPC queries, 7Timer weather, twilight, Sun/Moon ephemeris. Uses configuration.load_config() to read observatory data.
  • configuration — Persists and loads settings in ~/.asteroidpy; handles observatory coordinates, virtual horizon, and language. Used by both interface and scheduling.

How to add a translation

AsteroidPy uses GNU gettext with a single catalog base. Translations live under locales/<lang>/LC_MESSAGES/.

  1. Create a new locale directory:

    mkdir -p locales/nl/LC_MESSAGES
    
  2. Copy and adapt an existing .po file, or create one from the template:

    cp locales/it/LC_MESSAGES/base.po locales/nl/LC_MESSAGES/base.po
    

    Edit locales/nl/LC_MESSAGES/base.po, set Language: nl, and translate all msgstr entries.

  3. Compile the .po file into a .mo file (required for the language to appear in the menu):

    msgfmt -o locales/nl/LC_MESSAGES/base.mo locales/nl/LC_MESSAGES/base.po
    

    The msgfmt command comes with the gettext package (gettext on most Linux distros). Until the .mo exists, text from that .po is not used by gettext; the interactive UI may notify you once per incomplete locale under GeneralLanguage.

  4. The new language will appear in Configuration → General after restart.

To add or update translatable strings for all locales, update locales/base.pot (e.g. with xgettext or pybabel), then merge into each .po with msgmerge, translate, and recompile with msgfmt.

Release process

  1. Update asteroidpy/version.py (__version__, used by setuptools and the UI); keep setup.py in sync if you still rely on it.
  2. Add the corresponding entry to CHANGELOG.md under a new [X.Y.Z] heading with date and link to the tag.
  3. Run tests and build:
    pytest -q
    python -m build
    
  4. Commit the version bump and changelog, then create and push a tag:
    git tag vX.Y.Z -m "Release vX.Y.Z"
    git push origin main --tags
    
    (Use git tag -s for a signed tag if you have GPG configured.)
  5. Create a release on GitHub from the new tag and attach the built artifacts (e.g. from dist/).

Release History

See CHANGELOG.md.


TODO

  • NEOcp alert integration
  • Observation registration

License

AsteroidPy is licensed under the GPL-3.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asteroidpy-1.2.0.tar.gz (59.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asteroidpy-1.2.0-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file asteroidpy-1.2.0.tar.gz.

File metadata

  • Download URL: asteroidpy-1.2.0.tar.gz
  • Upload date:
  • Size: 59.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asteroidpy-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1c2ff4d49fed9f3e6261537cbf42f1021a7079119409fbe212665a0d2f01b3f9
MD5 8479eb099ff1527274fab0cfb675b4c9
BLAKE2b-256 8b657aacb542af48f9defdc46cfaba4bcebc02b671bd0f4b8077cd1d17ced8e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for asteroidpy-1.2.0.tar.gz:

Publisher: python-publish.yml on ziriuz84/asteroidpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asteroidpy-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: asteroidpy-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asteroidpy-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23cafe590c73c40b8ff39e41f5ae45cce9bd99367498a1f9cb239d3d518a6fd9
MD5 c8b8240c1347a1784618526b1ddd1d64
BLAKE2b-256 a8796bc63bd92eaa3cc092dc4ace760bab49c63f465b0cacf94863edd71eceef

See more details on using hashes here.

Provenance

The following attestation bundles were made for asteroidpy-1.2.0-py3-none-any.whl:

Publisher: python-publish.yml on ziriuz84/asteroidpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page