Skip to main content

Parse and convert ancient Greek archon dates

Project description

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

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

eparkhontos-0.0.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

eparkhontos-0.0.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file eparkhontos-0.0.1.tar.gz.

File metadata

  • Download URL: eparkhontos-0.0.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for eparkhontos-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a2ee17e784f3affe15e97aba2ba88b78e858a82d912f2ede18cacc7a7456587b
MD5 46a42a0faca3de0f7309eeac963915b5
BLAKE2b-256 a84dde96454c7fc721ddf3b3729df536f5cf60a554fd88b7c50c8e0f38902863

See more details on using hashes here.

File details

Details for the file eparkhontos-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: eparkhontos-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for eparkhontos-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39f54eb919ffdc3019e1f52c1796c6e404d2d5c8a29f1c73183d9581b11cd37
MD5 c92d36cfb5460f2d4ad962f2c5dd8162
BLAKE2b-256 0d7a5398478e12255b029e0392cfd18be724ba18b5eba36be15ec725e46af7d2

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