Skip to main content

Python port (in progress) of the Turbo Pascal Pohualli calendrical utility

Project description

Pohualli (Python Port)

CI Coverage Docs PyPI Changelog

Python reimplementation of the original Turbo Pascal Pohualli calendrical utility.

Highlights

  • Maya & Aztec core calculations (Tzolk'in, Haab, Long Count, Year Bearer)
  • 819‑day cycle, planetary synodic helpers, zodiac & moon heuristics
  • Correlation ("New Era") presets + on-the-fly overrides
  • Auto-derivation of correction offsets from partial constraints
  • Unified composite API & high-coverage test suite (≥90% per file)
  • FastAPI web UI + CLI + JSON output

Install

pip install pohualli

PyPI page: https://pypi.org/project/pohualli/

Structure

.
├── CHANGELOG.md                 # Project changelog / release notes
├── LICENSE                      # GPL-3.0-only license text
├── README.md                    # Overview & usage (this file)
├── docker-compose.yml           # Convenience orchestration for web app
├── Dockerfile                   # Multi-arch container build definition
├── mkdocs.yml                   # MkDocs Material documentation config
├── pyproject.toml               # Packaging & dependency metadata
├── docs/                        # Documentation markdown sources (MkDocs)
│   ├── index.md                 # Landing page
│   ├── dev.md                   # Development & contributing notes
│   ├── license.md               # License blurb for docs site
│   ├── concepts/                # Conceptual explanations
│   │   ├── calendars.md         # Calendar systems overview
│   │   └── configuration.md     # Correlations & correction parameters
│   └── usage/                   # How-to guides
│       ├── quickstart.md        # Quick installation & first run
│       ├── cli.md               # CLI usage details
│       └── python-api.md        # Python API examples
├── pohualli/
│   ├── __init__.py              # Public API exports (compute_composite, etc.)
│   ├── autocorr.py              # Derive correction offsets from constraints
│   ├── aztec.py                 # Aztec (Tonalpohualli) name tables & helpers
│   ├── calendar_dates.py        # Gregorian/Julian conversions & weekday calc
│   ├── cli.py                   # Command line interface entry point
│   ├── composite.py             # High-level composite computation orchestrator
│   ├── correlations.py          # Correlation (New Era) preset definitions
│   ├── cycle819.py              # 819‑day cycle station & direction colors
│   ├── maya.py                  # Core Maya calendar math (Tzolk'in / Haab / LC)
│   ├── moon.py                  # Moon phase / anomaly heuristics
│   ├── planets.py               # Planetary synodic value helpers
│   ├── templates/
│   │   └── index.html           # Web UI Jinja2 template
│   ├── types.py                 # Dataclasses & global correction state types
│   ├── webapp.py                # FastAPI application factory / routes
│   ├── yearbear.py              # Year Bearer packing/unpacking utilities
│   └── zodiac.py                # Star & earth zodiac angle computations
└── tests/                       # Pytest suite (≥90% per-file coverage)
  ├── test_autocorr*.py        # Auto-correction derivation tests
  ├── test_calendar*.py        # Calendar date conversion edge cases
  ├── test_cli*.py             # CLI command & JSON output coverage
  ├── test_cycle_planets.py    # 819-cycle & planetary helpers
  ├── test_extra_cycles_yearbear_moon.py  # Mixed composite cycle branches
  ├── test_maya*.py            # Maya calendar arithmetic & validation
  ├── test_moon_zodiac.py      # Moon + zodiac computations
  ├── test_web*.py             # FastAPI endpoint & template rendering
  ├── test_yearbear_cli.py     # Year bearer & related CLI paths
  └── test_zodiac_extra.py     # Additional zodiac heuristic coverage

Python Usage

from pohualli import compute_composite
result = compute_composite(2451545)
print(result.tzolkin_name, result.long_count, result.star_zodiac_name)

CLI Examples

# Basic human-readable conversion
pohualli from-jdn 2451545

# Year Bearer reference override
pohualli from-jdn 2451545 --year-bearer-ref 0 0

# JSON output (pretty with jq)
pohualli from-jdn 2451545 --json | jq .long_count

# Override New Era just for this invocation
pohualli from-jdn 2451545 --new-era 584283 --json

# Apply a named correlation preset globally
pohualli apply-correlation gmt-584283

# List available correlations
pohualli list-correlations

# Derive corrections from partial constraint (tzolkin only)
pohualli derive-autocorr 2451545 --tzolkin "4 Ahau"

# Derive with multiple constraints (tzolkin + haab + g)
pohualli derive-autocorr 2451545 --tzolkin "4 Ahau" --haab "3 Pop" --g 5

# Persist and restore configuration
pohualli save-config config.json
pohualli load-config config.json

# Full JSON composite into a file
pohualli from-jdn 2451545 --json > composite.json

Web App

uvicorn pohualli.webapp:app --reload

Open http://127.0.0.1:8000

Docker

docker build -t pohualli .
docker run --rm -p 8000:8000 pohualli

Or use the published image:

docker run --rm -p 8000:8000 ghcr.io/muscariello/pohualli-python:latest

Testing

pytest -q

License

GPL-3.0-only

Reference

Sołtysiak, A. & Lebeuf, A. (2011). Pohualli 1.01. A computer simulation of Mesoamerican calendar systems. 8(49), 165–168. ResearchGate

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

pohualli-0.2.3.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

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

pohualli-0.2.3-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file pohualli-0.2.3.tar.gz.

File metadata

  • Download URL: pohualli-0.2.3.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pohualli-0.2.3.tar.gz
Algorithm Hash digest
SHA256 ea0ea616d83aa2c008ad392f70eba91ae1d3c704b95d1647cd8eed4ba021681f
MD5 11690bfec13fae03db13262d0814f7ec
BLAKE2b-256 07c3e142476714c88d74b7e80cf6bd67976f09b89e4206ccb729f282b4874c6b

See more details on using hashes here.

File details

Details for the file pohualli-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pohualli-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pohualli-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6d7dc00bfe9b0faacc4bc35f3a1dbe7d4a0e1e96f771776ff1b34e8a593ebfdf
MD5 6e1c0b880bd56db0d3d96e9315438615
BLAKE2b-256 466b3fe5e105d60fbb56d89dec08e1d53c0fb011ced0d60dff303ae194e693ca

See more details on using hashes here.

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