Skip to main content

eparkhontos

Conversion between calendar years (mostly BCE but also CE), astronomical dates, and the convention used for most ancient Greek dates, a span of two Julian years (for example, “431/430”).

The name comes from the ancient Greek formula for refering to years as ep' arkhontos ... (ἐπ᾽ ἄρχοντος ...) “when so-and-so was arkhon.”

Installation

pip install eparkhontos

Usage

Parsing Arkhon Years

eparkhontos can parse strings like “431/430”, “431/30”, “431/30 BCE”, “431-430 b.c.”, all of which will return an “astronomical year”—an integer which, for years BCE is negative and offset by 1 because 1 BCE is numbered as 0. The astronomical year is assigned to the year in the ancient Greek year begins, so "431/430" becomes -430 (meaning 431 BCE):

>>> import eparkhontos as epi
>>> epi.parse_arkhon("431/430")
-430
>>> epi.parse_arkhon("431/430 B.C.")
-430
>>> epi.parse_arkhon("431/430 BCE")
-430
>>> epi.parse_arkhon("431-30")
-430

If the string contains any form of “CE” or “AD” the year will be treated accordingly:

>>> epi.parse_arkhon("100/101 CE")
100

Formatting Astronomical Years

You can get a formatted arkhon year from an astronomical year, including BCE/CE appended if you want, or prepended if you want:

>>> epi.to_arkhon(-430)
'431/430'
>>> epi.to_arkhon(-430, with_era=True)
'431/430 BCE'
>>> epi.to_arkhon(-430, with_era=True, prefix_era=True)
'BCE 431/430'
>>> epi.to_arkhon(-430, True)
'431/430 BCE'
>>> epi.to_arkhon(-430, True, True)
'BCE 431/430'
>>> epi.to_arkhon(430, True)
'430/431  CE'

Note that “CE” is padded with leading space to align with “BCE.”

Getting an Astronomical Year

So you don’t have to remember how to correctly offset for an astronomical year, you can convert an int or str. For instance, if you want “431” to be interpreted as “431 BCE”:

>>> epi.to_astronomical(431)
-430
>>> epi.to_astronomical("431")
-430

If it is, in fact, a year CE:

>>> epi.to_astronomical("431", is_bce=False)
431
>>> epi.to_astronomical("431", False)
431

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/seanredmond/eparkhontos

Metadata

Release files for eparkhontos 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eparkhontos 0.0.1
File Size Uploaded
eparkhontos-0.0.1.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eparkhontos 0.0.1
File Interpreter ABI Platform
eparkhontos-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / eparkhontos-0.0.1.tar.gz

Download URL eparkhontos-0.0.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a2ee17e784f3affe15e97aba2ba88b78e858a82d912f2ede18cacc7a7456587b
BLAKE2b-256 checksum
How to use checksums
a84dde96454c7fc721ddf3b3729df536f5cf60a554fd88b7c50c8e0f38902863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / eparkhontos-0.0.1-py3-none-any.whl

Download URL eparkhontos-0.0.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f39f54eb919ffdc3019e1f52c1796c6e404d2d5c8a29f1c73183d9581b11cd37
BLAKE2b-256 checksum
How to use checksums
0d7a5398478e12255b029e0392cfd18be724ba18b5eba36be15ec725e46af7d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page