How ismailbenhallam/moroccan-prayer-times works
Project type and purpose
• This is an open-source, Python-based command-line application (CLI) that fetches Moroccan prayer times from the official Ministry of Habous and Islamic Affairs website.
• It provides commands to show today’s times, time until next prayer, and to configure city and language. It also caches responses and supports localization (AR/EN/FR).
File structure
• Top-level files and folders
– .github/workflows/pypi-publish.yml: CI/CD pipeline for publishing to PyPI
– setup.py, MANIFEST.in, requirements.txt: packaging and dependency configuration
– README.md, LICENSE: documentation and licensing
• Package folder moroccan_prayer_times/
– main.py: CLI entry point (defines commands: next, today, config, setup)
– __init__.py: package initializer
– translations/: YAML files (ar.yml, en.yml, fr.yml) for localization
• No frontend or database subdirectories: single-process CLI tool
Extract key architectural insights from README
• External dependency: Ministry website HTTP API
• Local caching mechanism for performance
• Configuration persisted locally (city, language)
• Localization layer to format UI in selected language
• Packaging for pip/pipx installation
• CI workflow for automated PyPI publishing
Main components and their interactions
a. User (terminal)
↳ invokes the CLI command (prayertime next, etc.)
b. CLI layer (main.py)
↳ parses arguments, dispatches to core functions
c. Configuration module (persistent file, e.g., JSON/YAML)
↳ reads/writes user preferences (city, language)
d. Cache module (local file or in-memory)
↳ stores last-fetched prayer times with timestamp
e. HTTP client module
↳ issues GET request to Ministry website, handles errors
f. Parser module
↳ extracts prayer time data from HTTP response (HTML or JSON)
g. Localization module
↳ loads correct translations/*.yml file and formats labels
h. Output module
↳ renders data to terminal (with appropriate encoding/font for Arabic)
i. CI/CD pipeline (GitHub Actions)
↳ runs tests (if any), builds package, publishes to PyPI
Architectural patterns and design principles
• Modular separation of concerns: CLI vs. config vs. HTTP vs. parsing vs. localization vs. output
• Single-process, synchronous flow (could evolve to async HTTP calls)
• Pluggable translations (YAML-backed)
• Local caching for resiliency and reduced HTTP traffic
• Clean package boundary for easy pip installation
Additional notes
• Python runtime / environment boundary (user’s machine)
• How pipx installs a shim that invokes the package’s entry point