Your gateway to cosmos β Query astronomical data from command line
Astro CLI (working title: suggestions welcome!) is a modern command-line tool that provides quick access to multiple astronomical data services through the Astroquery library. It's designed for astronomers, researchers, and anyone who needs to query astronomical databases efficiently from the terminal.
17 data sources. One command. Beautiful output. Multi-language support. Extensible for future services.
Query data from 17 different astronomical databases and services:
| Service | Description | Command | Alias |
|---|---|---|---|
| SIMBAD | Basic astronomical data & object identification | astrocli simbad |
astrocli sim |
| VizieR | Catalog database search | astrocli vizier |
astrocli viz |
| ALMA | ALMA radio telescope observations | astrocli alma |
- |
| ESASky | Sky region visualization | astrocli esasky |
- |
| Gaia | ESA Gaia mission data | astrocli gaia |
- |
| IRSA | Infrared Science Archive | astrocli irsa |
- |
| HEASARC | X-ray and Gamma-ray data | astrocli heasarc |
astrocli hea |
| JPL Horizons | Solar System ephemerides | astrocli jpl |
- |
| MAST | Space Telescope Archive (HST, JWST, etc.) | astrocli mast |
- |
| ADS | Astrophysics literature search | astrocli ads |
- |
| NED | Extragalactic Database | astrocli ned |
- |
| NIST | Atomic spectra database | astrocli nist |
- |
| NASA Exoplanet | Exoplanet catalog | astrocli exoplanet |
astrocli exo |
| SDSS | Sloan Digital Sky Survey | astrocli sdss |
- |
| ESO | European Southern Observatory | astrocli eso |
- |
| Splatalogue | Molecular line database | astrocli splatalogue |
astrocli spl |
| AAVSO VSX | Variable Star Index | astrocli aavso |
- |
| Fermi-LAT | Gamma-ray telescope data | astrocli fermi |
- |
- π¦ Multi-Source Access: Query 17+ astronomical databases from a single interface
- π Internationalized UI: Built-in support for English, Chinese (Simplified), and Japanese
- π Rich Output: Beautifully formatted tables with support for exporting to CSV, ECSV, FITS, and more
- β‘ Smart Defaults: Sensible defaults with extensive customization options
- π Service Health: Built-in connectivity testing (
--ping) and field validation (--field) - π§βπ» Shell Completion: Auto-completion support for Bash, Zsh, and Fish
- π Extensible: Easy to add new astronomical data services
Requires: Node.js β₯18 and Python 3.11+
# Using pnpm (recommended)
pnpm astrocli --help
# Using npx
npx astrocli --help
# Example: Query SIMBAD for M31
pnpm astrocli simbad object "M31"AC_PYTHON- Specify Python interpreter pathAC_VENV_DIR- Custom virtual environment cache directory (default:~/.cache/astrocli)AC_FORCE_INSTALL=1- Force reinstall/upgrade Python dependenciesAC_DEBUG- Enable debug modeAC_LANG- Set default language (en/zh/ja)
git clone https://github.com/yourusername/astrocli.git
cd astrocli
pip install -e .# Show all available modules and commands
astrocli --help
# Show help for a specific module
astrocli <module> --helpastrocli simbad object "M31"
astrocli simbad object "Crab Nebula" --show-all-cols# Find catalogs by keywords
astrocli vizier find-catalogs --keyword photometry --keyword galaxy
# Query a specific catalog
astrocli vizier object "M31" --radius 0.1 --catalog "I/261/gaiadr3"# Query a variable star by name
astrocli aavso object "SS Cyg"
# Search variable stars in a sky region
astrocli aavso region 196.421 18.018 --radius 0.5
# Get results in JSON format
astrocli aavso object "T CrB" --format json# Query Fermi data for a target
astrocli fermi object "Crab Nebula" --energy "1000,100000" --dates "2020-01-01 00:00:00, 2020-01-02 00:00:00"
# Clear Fermi cache
astrocli fermi clear-cacheastrocli ads search --title "exoplanet detection"
astrocli ads bibcode "2023A&A...555..959W"Change output language on-the-fly:
astrocli --lang zh simbad object "M31" # Chinese
astrocli --lang ja simbad object "M31" # Japanese
astrocli --lang en simbad object "M31" # English| Option | Description |
|---|---|
-l, --lang |
Set output language (en/zh/ja) |
-p, --ping |
Test connectivity to all services (top-level only) |
-f, --field |
Check available fields for a module (top-level only) |
-d, --debug |
Enable debug mode with verbose output |
-v, --verbose |
Enable verbose output |
Install completion for your shell:
astrocli --install-completion bash # Bash
astrocli --install-completion zsh # Zsh
astrocli --install-completion fish # FishAdd this to your shell config (e.g., ~/.zshrc):
# For zsh
eval "$(astrocli --install-completion zsh)"
# For bash
eval "$(astrocli --install-completion bash)"Save query results to file:
astrocli simbad object "M31" --output-file results.csv
# Specify format explicitly
astrocli simbad object "M31" --output-file data.ecsv --output-format ecsvSupported formats: csv, ecsv, fits, votable, html, latex, ascii
Check if all data services are accessible:
astrocli --pingastrocli/
βββ astrocli/
β βββ modules/ # Service-specific modules
β β βββ simbad_cli.py
β β βββ vizier_cli.py
β β βββ aavso_cli.py # NEW: AAVSO VSX
β β βββ fermi_cli.py # NEW: Fermi-LAT
β β βββ ...
β βββ utils.py # Common utilities
β βββ common_options.py # Shared CLI options
β βββ i18n.py # Internationalization
β βββ main.py # CLI entry point
βββ locales/ # Translation files
β βββ zh/LC_MESSAGES/
β βββ ja/LC_MESSAGES/
β βββ en/LC_MESSAGES/
βββ package.json # pnpm/npx configuration
βββ pyproject.toml # Python package config
βββ README.md
- Create
modules/<service>_cli.pyfollowing existing patterns - Import in
main.py'ssetup_subcommands() - Add to README module list
- Add translations to
locales/directories
BSD 3-Clause License
This project uses Astroquery, which is licensed under the BSD 3-Clause License.
- Astroquery - Core library for astronomical data access
- Typer - Modern CLI framework
- Rich - Beautiful terminal output
- AAVSO - American Association of Variable Star Observers
- Fermi Team - Fermi Gamma-ray Space Telescope
If you were previously using astroquery-cli, simply change your command:
# Old command
aqc simbad object "M31"
# New command
astrocli simbad object "M31"All aliases remain the same: sim for simbad, viz for vizier, spl for splatalogue, etc.
Common Questions
Yes! Install from source: pip install -e . or use Python directly after installing dependencies.
See the Development section above. Most services in Astroquery can be wrapped with similar patterns.
Some advanced features or edge cases may not have full CLI coverage yet. Core query functionality works, but special parameters might need direct access to the underlying astroquery library.
Astro CLI is a command-line interface for Astroquery. Think of it as a user-friendly wrapper that makes common tasks easier. It doesn't replace Astroquery β it enhances it!