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

e = Eones("2025-06-15")

print(e.add(months=1, days=3))                       # → Eones(date=2025-07-18T00:00:00+00:00, tz='UTC')
print(e.format("%Y-%m-%d"))                          # → 2025-07-18
print(e.diff_for_humans("2025-06-10"))               # → in 1 month
print(e.diff_for_humans("2025-06-20", locale="es"))  # → en 4 semanas

🔍 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.2.tar.gz (71.5 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.2-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eones-1.4.2.tar.gz
  • Upload date:
  • Size: 71.5 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.2.tar.gz
Algorithm Hash digest
SHA256 f8bda396b37eccf50032cf5f924b4eb2571a879539c881b7b3187a910f844d75
MD5 5bad0fac35ce0a42b6466de0050b6677
BLAKE2b-256 0fdd1ba1e39634b1a370b7745be630d92f9a568261c0737e5039aa8be2393457

See more details on using hashes here.

Provenance

The following attestation bundles were made for eones-1.4.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: eones-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 34.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f89405a786759ce970be1e2c1458c8f6ee7d835cec07132484e630b532145e06
MD5 bfbe75ed34fc4157ee5fed017444b338
BLAKE2b-256 a2d26276f185ece53486299050fe4fb0ceac8e08da3c5c1c1b8b290a2ddd2e7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for eones-1.4.2-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