dannyzed / julian

A simple Python library for converting between Julian dates and datetime objects.
MIT License
9 stars 5 forks source link

Add support to Python 2.7.x #1

Open lmar76 opened 6 years ago

lmar76 commented 6 years ago

Hi Daniel,

I have successfully used julian package with Python>=3.5. Now I would need to use it with Python 2.7 but unfortunately it is not possible to import it:

>>> import julian
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mmfi/.local/lib/python2.7/site-packages/julian/__init__.py", line 1, in <module>
    from julian.julian import to_jd, from_jd
  File "/home/mmfi/.local/lib/python2.7/site-packages/julian/julian.py", line 5
    def __to_format(jd: float, fmt: str) -> float:
                      ^
SyntaxError: invalid syntax

I guess this is due to the annotations. Could it be possible to update the code to support also Python>=2.7 ?

Thank you.

Regards,

Luca

vikingsraven commented 5 years ago

this would be handy on 2.7

forest-jiang commented 5 years ago

same need

Ericwonne commented 5 years ago

The same error from the import statement. Does it seem there is no solution till now?

Ericwonne commented 5 years ago

Well if there is urgent need of the Julian to the Gregorian date conversion, a gist could be possibly referred: https://gist.github.com/jiffyclub/1294443#file-jdutil-py.