Remove unnecessary dependency pytz
Is your feature request related to a problem? Please describe.
pytz is a somewhat complex dependency in some ways (it dumps hundreds of tzinfo files on the filesystem), yet it looks like it's not really needed since it's only used to set the UTC timezone for some timezone-aware datetimes.
See this search for usages: https://github.com/python-restx/flask-restx/search?q=pytz
Describe the solution you'd like
Removal of pytz as a dependency, and replace all references to pytz.UTC with datetime.timezone.utc.
Additional context
Since datetime.timezone is not available in Python 2.7, we might need to construct a tzinfo object by hand (should be trivial though, since it's just UTC). However, since there's https://github.com/python-restx/flask-restx/pull/113 I assume keeping Python 2.7 support might not be of interest anymore.
I volunteer to contribute a PR making this change, if there's interest.
flask-restx imports pytz, and pytz seems to be deprecated, so the import fails. Removing it is a very good idea. I can't try out flask-restx unless it loads, so I don't even know if I want to use it yet.
File "c:\tools\miniconda3\envs\flask\lib\site-packages\flask_restx\inputs.py", line 29, in
Been a while since I created this issue.
Is this of interest to maintainers? My offer to make a PR still stands.
Dear maintainers,
I did a fork of the project and fixed it this morning, it's so easy even I could do it. Removing an unneeded dependency seems like a good idea to me.
Please give Erik the go-ahead on this. It affects these 4 files.
modified: examples/zoo_app/requirements.txt
modified: flask_restx/inputs.py
modified: requirements/install.pip
modified: tests/test_inputs.py
pytz is now embedded in last python versions: Projects using Python 3.9 or later should be using the support now included as part of the standard library
What could be done: flask-restx could add the dependency to pytz only for python version older than 3.9.