gmggroup / omf-python

Python library for working with OMF files
MIT License
79 stars 20 forks source link

Depcrated use of datetime.datetime.utcnow() #131

Open sean-maptek opened 8 months ago

sean-maptek commented 8 months ago

In Python 3.12, the function datetime.datetime.utcnow() was deprecated.

The replacement is using datetime.now() with datetime.timezone.utc. There is datetime.UTC which was introduced in 3.11 but to support older versions datetime.timezone.utc can be used.

I was made aware of this in omf 1.0.1, as I have deprecated warnings turned on to try to get a head start on fixing up issues in my code for future versions of Python. The problem is bad for 1.0.1 because the usage is in omf.base.UidModel which makes it widespread and hard to disable.

Looking at the current state in dev branch (7b349ec43f643aa83b47c669991dcd06c356e135 at the time of writing) for the 2.0.0 dev work, the situation is not as bad as it only effects the omf.fileio.save().

Is there any interest in a pull request for 1.0.1 with this change for a potential 1.0.2 release? Specially, given the current delays in omf 2.0.