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, including ISO 8601 with timezone offsets
  • 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
High Performance (~1M ops/sec) ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
Memory Optimized (__slots__) ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
Zero-dep Localization (No Babel) ✅ Yes ❌ No ❌ No ❌ No ❌ No ❌ No
Dedicated Range/Period API ✅ Yes ✅ Yes ⚠️ Basic ⚠️ Basic ❌ 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 ⚠️

See the numbers yourself: For detailed performance metrics (Speed, Memory, Profiling), check out our Benchmark Suite.


📚 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.4.1.tar.gz (70.8 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.4.1-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eones-1.4.1.tar.gz
  • Upload date:
  • Size: 70.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eones-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5debf58425aeb11b5c18a4b48cd36d30ee07db9112345d807f9578120a849753
MD5 d950edac387be8035802c6cb2ea99cac
BLAKE2b-256 cadc60145a9c97710e7e3e4c31db695be8002f8461e8a9db597005be2284dff8

See more details on using hashes here.

Provenance

The following attestation bundles were made for eones-1.4.1.tar.gz:

Publisher: release.yml on roldriel/eones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: eones-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eones-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ccb54bd83cb267f22f23dd7ef37580a99a5e14df974f5702b536c2f5a1788ad
MD5 26672fe91a590f27efff8ce09bf305e5
BLAKE2b-256 a5b004101821ba0e044cc6efacfbdb22c7891eefe4e1b34992cd520480953de0

See more details on using hashes here.

Provenance

The following attestation bundles were made for eones-1.4.1-py3-none-any.whl:

Publisher: release.yml on roldriel/eones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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