Skip to main content

Dependencies

starward is designed with minimal dependencies to remain lightweight and easy to install. All astronomical calculations are implemented from first principles without external astronomy libraries.

Runtime Dependencies

These packages are required to run starward:

PackageVersionPurpose
Python≥3.9Runtime environment
click≥8.0CLI framework
rich≥13.0Terminal formatting and tables

Why These Dependencies?

click

Click provides a clean, composable CLI framework:

  • Automatic help generation
  • Type conversion and validation
  • Nested command groups
  • Shell completion support
@click.command()
@click.option('--date', type=click.DateTime(), help='Target date')
def sun(date):
"""Calculate sun position."""
pass

rich

Rich enables beautiful terminal output:

  • Tables with Unicode box-drawing
  • Syntax highlighting
  • Progress bars
  • Markdown rendering
from rich.console import Console
from rich.table import Table

console = Console()
table = Table(title="Sun Position")
table.add_column("Property", style="cyan")
table.add_column("Value", style="green")
table.add_row("RA", "18h 45m 23s")
console.print(table)

Development Dependencies

Install with: pip install -e ".[dev]"

PackageVersionPurpose
pytest≥7.0Test framework
pytest-cov≥4.0Coverage reporting
hypothesis≥6.0Property-based testing
mypy≥1.0Static type checking
ruff≥0.1Linting and formatting
allure-pytest≥2.13.0Test reporting

Testing Stack

pytest

The de facto standard Python test framework:

def test_julian_date():
jd = JulianDate(2451545.0)
assert jd.jd == 2451545.0

pytest-cov

Integrates coverage.py with pytest:

pytest --cov=starward --cov-report=html

hypothesis

Property-based testing for edge cases:

from hypothesis import given, strategies as st

@given(st.floats(min_value=-90, max_value=90))
def test_latitude_bounds(lat):
angle = Angle(degrees=lat)
assert -90 <= angle.degrees <= 90

allure-pytest

Rich HTML test reports with step-by-step breakdowns:

import allure

@allure.title("Sun position calculation")
def test_sun_position():
with allure.step("Calculate position"):
pos = sun_position(jd)
with allure.step("Verify coordinates"):
assert pos.ra.degrees > 0

Code Quality

mypy

Static type checking catches errors before runtime:

mypy src/starward/

Configuration in pyproject.toml:

[tool.mypy]
python_version = "3.9"
strict = true
warn_return_any = true

ruff

Fast linting and formatting (replaces flake8, isort, black):

ruff check src/        # Lint
ruff check --fix src/ # Auto-fix
ruff format src/ # Format

Documentation Dependencies

The documentation site uses:

PackagePurpose
DocusaurusStatic site generator
TypeScriptConfiguration typing
SassCustom styling
KaTeXMath rendering
PrismSyntax highlighting

Install documentation dependencies:

cd website
npm install

Why No Astronomy Dependencies?

starward intentionally avoids external astronomy libraries like Astropy, Skyfield, or PyEphem. This is a deliberate design choice:

  1. Educational Value — Implementing algorithms from scratch teaches computational astronomy
  2. Transparency — Every calculation can be traced and understood
  3. Lightweight — Minimal install size and startup time
  4. Control — Full control over precision and algorithm choices

Trade-offs

AspectWith DependenciesWithout (starward)
AccuracyHigher (SPICE kernels)Good (analytical)
Install sizeLarge (~100MB+)Small (~200KB)
Startup timeSlow (data loading)Fast
LearningBlack boxTransparent
MaintenanceExternal updatesSelf-contained

For applications requiring arcsecond precision, consider Astropy or Skyfield. For learning, CLI usage, and moderate precision, starward provides an excellent balance.

Updating Dependencies

# Check for updates
pip list --outdated

# Update specific package
pip install --upgrade click

# Update all dev dependencies
pip install --upgrade -e ".[dev]"

Security

Dependencies are monitored for vulnerabilities:

# Check for known vulnerabilities
pip audit

Report security issues privately via GitHub.