Skip to main content

A python package to flexibly adapt start and end date(times) to your system background

Project description

Chronomeleon

🚧 Still Work In Progress!

License: MIT Python Versions (officially) supported Pypi status badge Unittests status badge Coverage status badge Linting status badge Black status badge

Chronomeleon is a Python package that converts date and time related objects in migration scenarios. It's meant to be used when migrate dates, datetimes or time slices/ranges from one system to another.

Rationale

While converting a datetime alone is possible with either Python builtin tools or libraries like pendulum and arrow, things become more complicated when you have to convert time slices or ranges or when the source and target system interpret dates and times differently.

Think your migrating e.g., contracts from system A to system B. In system A might have an API, a data dump or something else from where you can read, that a contract starts at 2024-01-01 and ends at 2024-06-30.

Now assume, the same contract in system B starts at 2023-12-31T23:00:00Z and ends at 2024-06-30T21:59:59Z.

For this little conversion, although simple, you have to consider a lot:

  • Are date and times implicitly "meant" in any certain time zone? Here, system A seems to implicitly assume, everything as German local time, whereas system B uses explicit UTC offsets.
  • What about the resolution? Although using dates only might be sufficient for the modeling the business logic, as soon as the resolution of system B is higher, you have to start interpreting stuff.
    • What if there was a system C, which supported microseconds but only stored the date and time in a single integer?
  • What about the end date (times)? It seems that system A uses the end date as inclusive (contract ends at the end of june), whereas system B uses it as exclusive (start of the followup contract == end of the previous contract).

Chronomeleon has two purposes:

  1. It forces you to make assumptions explicit.
  2. Once the assumptions are explicit, it helps you do the conversion.

The latter is no rocket science (and neither is any code in chronomeleon), but the former is crucial for a successful migration.

Chronomeleon makes your code more readable and makes your assumption clear. This allows you to spot errors in your or your team mates code and explain, why things are done the way they are.

How to use it?

Install it from pypi:

pip install chronomeleon

Then, in your code: Make assumptions about the source and target system explicit. To do so, chronomeleon provides you with so-called ChronoConfig objects.

Setup for Local Development

Follow the instructions from our template repository. tl;dr: tox.

Contribute

You are very welcome to contribute to this template repository by opening a pull request against the main branch.

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

chronomeleon-0.0.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

chronomeleon-0.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file chronomeleon-0.0.0.tar.gz.

File metadata

  • Download URL: chronomeleon-0.0.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for chronomeleon-0.0.0.tar.gz
Algorithm Hash digest
SHA256 10101b763a5f229b87df8d88100b7803275898b073746ef2876e863393c9322a
MD5 24ec800c9c2985de41e081371ab689d2
BLAKE2b-256 9256e8d6cec1b3b7816790d71c18c38a6e4df4e2b095af93f390a39e75c1e08c

See more details on using hashes here.

File details

Details for the file chronomeleon-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: chronomeleon-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for chronomeleon-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76a3fa842d12629fdd8d4a41b897f587e59929e477e44f965853f2ad09794c3b
MD5 d53a1c686317523382460226459b7995
BLAKE2b-256 816a30052d31a3a2789b7eb9572deac1ac3c9c10aec3bac7e95337810587e5bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page