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

Uploaded Python 3

File details

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

File metadata

  • Download URL: eones-1.4.0.tar.gz
  • Upload date:
  • Size: 70.6 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.0.tar.gz
Algorithm Hash digest
SHA256 48cfd90d869cef3b46d3af6454ce631ddbd7c403c8a0cac268f9be37410d68fa
MD5 fe7e0b264d2c66718260287b890e1044
BLAKE2b-256 6fc295a9d9b83df4a056218f09edc861a6dd4cd255aa25c642bc40a30d10240f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eones-1.4.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83598b3c03f3ba9e6757aa9f923519f07f85235f75058ddd155c3e8b6a79bb6e
MD5 a37c9787b5b311c8cd2ba63bf0969327
BLAKE2b-256 0b0e5d715803b188000a20feefd661233b834a53d5590afeb81d61e313ab00d6

See more details on using hashes here.

Provenance

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