Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytz.utc vs datetime.timezone.utc #76

Open
dajose opened this issue Apr 12, 2018 · 6 comments
Open

pytz.utc vs datetime.timezone.utc #76

dajose opened this issue Apr 12, 2018 · 6 comments

Comments

@dajose
Copy link

dajose commented Apr 12, 2018

I want to integrate bson in a custom yocto image and I'm having troubles installing pytz dependency. I searched the repo and I found it is used here

I'm wondering if we could replace it with datetime.timezone.utc.

@Parkayun
Copy link
Member

I know that python2 doen't have datetime.timezone.
Do you have any idea about python2 and 3 complexity without pytz?

@dajose
Copy link
Author

dajose commented Apr 12, 2018

ok, for python2 pytz is irreplaceable

I don't understand the question of complexity, what do you mean by that?

@Parkayun
Copy link
Member

Parkayun commented Apr 13, 2018

Ah, It means any idea to remove pytz.
I agree with removing pytz dependency if we can.

@dajose
Copy link
Author

dajose commented Apr 13, 2018

oh, I found you guys use it in 2 places only and both times you use it to get utc... As far as I've found on the web it is the same to use pytz.utc to datetime.timezone.utc, but I am not really sure about that.

Where I see the difficulty is supporting python2, because as you'd said there is no datetime.timezone there :(

@Parkayun
Copy link
Member

Parkayun commented Apr 14, 2018

if we use datetime.timezone.
then we can see error when use python2. python3 ok.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'timezone'

so we use pytz for python2.

@amcgregor
Copy link

I like the idea of dependency elimination, esp. if it's only included for the use of a single constant. Official PyMongo rolls its own utc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants