arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

Python 2.7 & 3.5 Deprecation #800

Closed krisfremen closed 3 years ago

krisfremen commented 4 years ago

Pull Request Checklist

Thank you for taking the time to improve Arrow! Before submitting your pull request, please check all appropriate boxes:

If you have any questions about your code changes or any of the points above, please submit your questions along with the pull request and we will try our best to help!

Description of Changes

Retry of WIP of Python 2.7 and 3.5 deprecation as outlined in #739.

jadchaar commented 4 years ago

Hey @krisfremen, amazing changes so far. I edited the list in our deprecation thread:

Turns out there is a PY36+ command that will auto-convert F-strings hah. Also, we need to remove things from the Makefile.

krisfremen commented 4 years ago

@jadchaar I noticed --py36-plus as well, which is what I ended up using, but some of the more complicated ones weren't converted and had to be done manually anyway.

krisfremen commented 4 years ago

Hello!

It's a big chunk of work indeed.

I guess it's time for someone else to go over it and let me know if something needs fixing up.

codecov[bot] commented 4 years ago

Codecov Report

Merging #800 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #800   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1797      1824   +27     
  Branches       308       309    +1     
=========================================
+ Hits          1797      1824   +27     
Impacted Files Coverage Δ
arrow/api.py 100.00% <100.00%> (ø)
arrow/arrow.py 100.00% <100.00%> (ø)
arrow/constants.py 100.00% <100.00%> (ø)
arrow/factory.py 100.00% <100.00%> (ø)
arrow/formatter.py 100.00% <100.00%> (ø)
arrow/locales.py 100.00% <100.00%> (ø)
arrow/parser.py 100.00% <100.00%> (ø)
arrow/util.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e22c531...f31192b. Read the comment docs.

systemcatch commented 4 years ago

Hey @krisfremen I've been checking out this test which always fails on Windows.

================================== FAILURES ===================================
________ TestDateTimeParserParse.test_parse_tz_name_zzz[America/Nuuk] _________

self = <tests.test_parser.TestDateTimeParserParse object at 0x000001BDD76FC5E0>
full_tz_name = 'America/Nuuk'

    @pytest.mark.parametrize("full_tz_name", make_full_tz_list())
    def test_parse_tz_name_zzz(self, full_tz_name):

        self.expected = datetime(2013, 1, 1, tzinfo=tz.gettz(full_tz_name))
>       assert (
            self.parser.parse(f"2013-01-01 {full_tz_name}", "YYYY-MM-DD ZZZ")
            == self.expected
        )

tests\test_parser.py:335: 

The only thing I could find about this zone is this;

The America/Godthab zone has been renamed to America/Nuuk to reflect current English usage

Maybe the tz database for the Windows runners are out of date (release 2020a or newer needed).

edit: However that would mean current tests should be failing as well :thinking:

jadchaar commented 4 years ago

Hey @krisfremen I've been checking out this test which always fails on Windows.

================================== FAILURES ===================================
________ TestDateTimeParserParse.test_parse_tz_name_zzz[America/Nuuk] _________

self = <tests.test_parser.TestDateTimeParserParse object at 0x000001BDD76FC5E0>
full_tz_name = 'America/Nuuk'

    @pytest.mark.parametrize("full_tz_name", make_full_tz_list())
    def test_parse_tz_name_zzz(self, full_tz_name):

        self.expected = datetime(2013, 1, 1, tzinfo=tz.gettz(full_tz_name))
>       assert (
            self.parser.parse(f"2013-01-01 {full_tz_name}", "YYYY-MM-DD ZZZ")
            == self.expected
        )

tests\test_parser.py:335: 

The only thing I could find about this zone is this;

The America/Godthab zone has been renamed to America/Nuuk to reflect current English usage

Maybe the tz database for the Windows runners are out of date (release 2020a or newer needed).

edit: However that would mean current tests should be failing as well 🤔

So this error occurs because Pytz has been upgraded to 2020.*, but dateutil has not been upgraded to match the TZ DB additions. That is why I have been holding off on upgrading pytz until dateutil updates.

krisfremen commented 4 years ago

Hey @krisfremen I've been checking out this test which always fails on Windows.

================================== FAILURES ===================================
________ TestDateTimeParserParse.test_parse_tz_name_zzz[America/Nuuk] _________

self = <tests.test_parser.TestDateTimeParserParse object at 0x000001BDD76FC5E0>
full_tz_name = 'America/Nuuk'

    @pytest.mark.parametrize("full_tz_name", make_full_tz_list())
    def test_parse_tz_name_zzz(self, full_tz_name):

        self.expected = datetime(2013, 1, 1, tzinfo=tz.gettz(full_tz_name))
>       assert (
            self.parser.parse(f"2013-01-01 {full_tz_name}", "YYYY-MM-DD ZZZ")
            == self.expected
        )

tests\test_parser.py:335: 

The only thing I could find about this zone is this;

The America/Godthab zone has been renamed to America/Nuuk to reflect current English usage

Maybe the tz database for the Windows runners are out of date (release 2020a or newer needed).

edit: However that would mean current tests should be failing as well thinking

Hey @krisfremen I've been checking out this test which always fails on Windows.

================================== FAILURES ===================================
________ TestDateTimeParserParse.test_parse_tz_name_zzz[America/Nuuk] _________

self = <tests.test_parser.TestDateTimeParserParse object at 0x000001BDD76FC5E0>
full_tz_name = 'America/Nuuk'

    @pytest.mark.parametrize("full_tz_name", make_full_tz_list())
    def test_parse_tz_name_zzz(self, full_tz_name):

        self.expected = datetime(2013, 1, 1, tzinfo=tz.gettz(full_tz_name))
>       assert (
            self.parser.parse(f"2013-01-01 {full_tz_name}", "YYYY-MM-DD ZZZ")
            == self.expected
        )

tests\test_parser.py:335: 

The only thing I could find about this zone is this;

The America/Godthab zone has been renamed to America/Nuuk to reflect current English usage

Maybe the tz database for the Windows runners are out of date (release 2020a or newer needed). edit: However that would mean current tests should be failing as well thinking

So this error occurs because Pytz has been upgraded to 2020.*, but dateutil has not been upgraded to match the TZ DB additions. That is why I have been holding off on upgrading pytz until dateutil updates.

Yep I'm going to revert it back to the older pytz.

jadchaar commented 3 years ago

Closing this mega PR in favor of https://github.com/arrow-py/arrow/pull/877