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


๐Ÿš€ TL;DR

from eones import Eones
# 1.3M ops/sec - The fastest semantic datetime in Python
now = Eones() 
next_month = now.add(months=1)
print(next_month.format("%Y-%m-%d"))

โœจ 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

Timezone support (Optional)

If you're working on Windows or in environments without native zoneinfo data, install the timezone extra:

pip install "eones[tz]"

๐Ÿงช 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 (>1.3M 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.5.0.tar.gz (78.9 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.5.0-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for eones-1.5.0.tar.gz
Algorithm Hash digest
SHA256 157d90109f0b57a148f16edc7826cf7590004cf3be7e3842ecdc2c04e4b670be
MD5 70b166bf56ec1c93dbe6d9f26fd9af9a
BLAKE2b-256 58b639eceeb869b0fc1e3cd6185e762652696252bdaa472ba1047a4304c72f3c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eones-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 37.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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbf842f5a1fb19cb6a2d770fdd9b372124e7fae65367b25eb32e92a1e300a0a8
MD5 70a6d944d1a937e542a97680b0126d9a
BLAKE2b-256 1da491e16ff8051a0989370758c70232f16805376811e7ea060f47ed789e8e4b

See more details on using hashes here.

Provenance

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