json-logging-python
json-logging-python copied to clipboard
fix: update utcnow for python 3.12 deprecation
In python3.12 we get deprecation errors due to the use of 'naive' timestamps from utcnow. (see https://github.com/python/cpython/issues/103857)
Replace with timezone.utc
See https://github.com/python/cpython/issues/81669
See https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated
I don't quite get why the .replace(tzinfo=None) is there? It would seem that timezone aware date times should be just as well to compute the total seconds. Other than that, this looks like it should solve the issue.
@bobbui Is there anything I can do to make this more mergeable? Sadly the last run here is so long ago that the logs are not accessible anymore, so I'm not sure what the problem is.
But this is slowly becoming pressing as we want to update to python 3.14 soon.
i can remove the replace(tzinfo=None). The only failure is for py3.7, which IMHO you would remove as it was EOL in 2023.
i have made a few minor changes to the test environment in this PR:
- remove python3.7
- pin sanic
- update flake8 issues (flake8 is not pinned, neither is pytest)
now all the tests pass at this instance in time.
@bobbui , please give us some guidance on how we can assist. Do you need another maintainer to help? I think it would be best for the community to keep this alive on the same name/path.
Another option is to hard fork it and merge #107 , #108 , #109 . I'm willing to do that if someone else is willing to be a co-maintainer.
I'm using it enough so I wouldn't mind to be a co maintainer, but I would mostly provide review and feedback, as I am very much focused on nix and nixos in my open source time right now.
Friendly ping to @bobbui Could you please take a look at this issue and help us get this merged?
Another friendly ping to @bobbui - this issue is getting more and more pressing as the package is incompatible with python 3.12, while python 3.14 is getting released any day now.
Friendly Ping to @bobbui - could you please take a look at this - as far as I can see the fix is included.
We would really like to use your library on newer python versions.
Friendly ping at @bobbui Can you give a timeframe when you will be able to look at this?
sorry, been really busy with family. change looks good, merged
@dwt if you have time to review #109 it would be great, I really don't have to verify this large change
@bobbui, I had a Quick Look, and was a bit confused, I'll write something to the developer
@bobbui Do you already have a release schedule for this fix? We would like to upgrade our deployments and are running into this problem.