Skip to main content

Elegant time manipulation and reasoning library

Project description

Eones

Python PyPI Pylint Coverage Build Tox


Compatible with Python 3.9+ · No external dependencies · Portable and lightweight


✨ What is Eones?

Eones is a minimalist, dependency-free library for expressive, clear, and powerful date/time manipulation. Inspired by natural language semantics, it allows you to manipulate, compare, and transform dates as if they were living entities.

"That is not dead which can eternal lie, and with strange aeons even death may die."
Abdul Alhazred, Necronomicon

Philosophy

Eones is not a datetime replacement. It's a temporal reasoning layer.

Eones exists to fill the gap between Python's low-level datetime and the need for semantic, calendar-aware date manipulation:

  • Using only the standard library (Python 3.9+)
  • Providing a semantically rich and consistent API
  • Supporting modern timezone-aware design with zoneinfo
  • Maintaining modular and composable architecture through clear separation of responsibilities (Date, Delta, Range)

Eones is for:

  • Developers who want to reason about time semantically, not just manipulate timestamps
  • Teams that want zero external dependencies for maximum portability
  • Projects where timezones, truncation, deltas and ranges are central domain logic

📦 Installation

pip install "eones"

If you're working with timezones on Windows or containers:
⚠️ Also install tzdata:

pip install tzdata

🧪 Basic Example

from eones import Eones

z = Eones("2025-06-15")
z.add(months=1, days=3)  # -> add 3 days and 1 month

print(z.format("%Y-%m-%d"))  # → 2025-07-18
print(z.diff_for_humans("2025-06-10"))  # → in 5 days
print(z.diff_for_humans("2025-06-20", locale="es"))  # → hace 5 días

🔍 Key Features

  • Zero external dependencies: Pure Python (Python 3.9+)
  • Intuitive interface: Simple, semantically rich and easy-to-use API
  • Modern timezone support: Robust handling with zoneinfo (not pytz)
  • Flexible parsing: Accepts multiple date formats automatically
  • Advanced temporal operations: Deltas, ranges and semantic comparisons
  • Modular architecture: Clear separation between Date, Delta, Range and utilities
  • Localization: Support for multiple languages
  • Humanization: Converts time differences to readable text
  • Complete type hinting: Fully typed following PEP 561
  • Interoperability: Compatible with Python's standard datetime

Localization & Error Handling

You can add more languages by creating a new file in eones/locales/ with the translations for your locale. For example, fr.py for French.

Eones surfaces clear exceptions derived from EonesError. Invalid timezones raise InvalidTimezoneError, while unparsable strings raise InvalidFormatError.


🧾 Comparison with other libraries

Why not Pendulum or Arrow?

Feature Eones Pendulum Arrow Delorean dateutil pytz
Modern timezone support ✅ (zoneinfo) ❌ (pytz) ❌ (pytz) ⚠️
External dependencies ✅ None ❌ Yes ❌ Yes ❌ Yes ❌ Yes ❌ Yes
Semantically rich API ✅ Rich ✅ Medium ✅ Medium ⚠️
Modular/facade architecture ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
Complete type hinting & PEP 561 ✅ Yes ❌ Limited ❌ Limited ❌ No ❌ No ❌ No
Date arithmetic (add/subtract)
Flexible parsing (string, dict, dt) ⚠️
Coverage tested ≥ 97%
Can replace native datetime directly
Permissive license (MIT / BSD)
Actively maintained ⚠️

📚 Documentation & Examples

Comprehensive examples and documentation are available:

📖 Core Examples

🔗 Integration Examples

  • Django: Custom model fields
  • SQLAlchemy: Specialized column types
  • REST APIs: Serialization utilities

🔧 Tests & Coverage

tox
coverage html && open htmlcov/index.html

📖 Requirements

  • Python 3.9 or higher
  • (Optional) tzdata if using timezones in systems without a local zoneinfo database

📝 License

MIT © 2025 — Rodrigo Ezequiel Roldán
View full 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

eones-1.3.2.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

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

eones-1.3.2-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file eones-1.3.2.tar.gz.

File metadata

  • Download URL: eones-1.3.2.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for eones-1.3.2.tar.gz
Algorithm Hash digest
SHA256 7f05fac28cf983f1ae832b969b69213cdfc156068caf307359a915d9aea24574
MD5 6e06ac6ec1bd76ff2d0fbe43facec9e2
BLAKE2b-256 d19c63e6079de65d4fa27acb07174214fe66bfd768f178745ac6121a0ee51b13

See more details on using hashes here.

File details

Details for the file eones-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: eones-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for eones-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e4af006cf1b7892ec06b80c9449e18f6b8158eb790910e2ad43223f517118c
MD5 0005ca3c41ee731694fc64508547905c
BLAKE2b-256 3dbc39b6e2e071cc3b6f64d6af6c72c9de05c8e458fa20f35060b2784f8a8e55

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