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

Python 3.6 EOL #174

Closed
martinburchell opened this issue May 21, 2021 · 2 comments
Closed

Python 3.6 EOL #174

martinburchell opened this issue May 21, 2021 · 2 comments

Comments

@martinburchell
Copy link
Collaborator

Python 3.6 reaches end-of-life on 23rd December 2021.
https://www.python.org/downloads/

We should standardise on a later version (Travis CI refers to 3.6, anything else?) and make sure all our server instances are updated.

@RudolfCardinal
Copy link
Collaborator

Python 3.9 works fine with the self-tests (as does 3.6 still), after some fixes.

  1. Bumping pendulum from 2.1.0 to 2.1.2 to avoid this installation bug: Could not build wheels for pendulum which use PEP 517 python-pendulum/pendulum#454
  • ... which required a test change in SqlaColtypesTest._assert_duration_equal from assert a == b to assert a.total_seconds() == b.total_seconds(), relating to Fix the computation of total seconds with years and months python-pendulum/pendulum#482 -- without this change there were discrepancies on the days/weeks fields, even if the total duration was identical. I'm not convinced that Pendulum has done the right thing entirely here, but I've gone with it, and updated cardinal_pythonlib accordingly.

The failure was:

_______________________________________ SqlaColtypesTest.test_iso_duration_field _______________________________________
cc_modules/tests/cc_sqla_coltypes_tests.py:197: in test_iso_duration_field
    self._assert_duration_equal(rows[0][duration_col], d1)
cc_modules/tests/cc_sqla_coltypes_tests.py:147: in _assert_duration_equal
    assert a.total_seconds() == b.total_seconds(), f"{a!r} != {b!r}"
E   AssertionError: Duration(years=1, months=3, weeks=65, days=0, seconds=3, microseconds=4) != Duration(years=1, months=3, seconds=3, microseconds=4)
E   assert 78624003.000004 == 39312003.000004
E     +78624003.000004
E     -39312003.000004
-------------------------------------------------- Captured log call ---------------------------------------------------
INFO     sqlalchemy.engine.base.Engine:log.py:110 SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
INFO     sqlalchemy.engine.base.Engine:log.py:110 ()
INFO     sqlalchemy.engine.base.Engine:log.py:110 SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
INFO     sqlalchemy.engine.base.Engine:log.py:110 ()
INFO     sqlalchemy.engine.base.Engine:log.py:110 
CREATE TABLE testtable (
    id INTEGER NOT NULL, 
    duration_iso VARCHAR(29), 
    PRIMARY KEY (id)
)


INFO     sqlalchemy.engine.base.Engine:log.py:110 ()
INFO     sqlalchemy.engine.base.Engine:log.py:110 COMMIT
INFO     sqlalchemy.engine.base.Engine:log.py:110 INSERT INTO testtable (id, duration_iso) VALUES (?, ?), (?, ?), (?, ?)
INFO     sqlalchemy.engine.base.Engine:log.py:110 (1, 'P1Y3MT39312003.000004S', 2, 'P0Y0MT987.654321S', 3, '-P0Y0MT432000.0S')
INFO     sqlalchemy.engine.base.Engine:log.py:110 COMMIT
INFO     sqlalchemy.engine.base.Engine:log.py:110 SELECT testtable.id, testtable.duration_iso 
FROM testtable ORDER BY testtable.id
INFO     sqlalchemy.engine.base.Engine:log.py:110 ()

The problem is that in pendulum 2.1.0, you get this:

d1 = Duration(years=1, months=3, seconds=3, microseconds=4)
d1  # Duration(years=1, months=3, days=0, seconds=3, microseconds=4)
d1.total_seconds()  # 3.000004

and in pendulum 2.1.2, you get this:

d1 = Duration(years=1, months=3, seconds=3, microseconds=4)
d1  # Duration(years=1, months=3, seconds=3, microseconds=4)
d1.total_seconds()  # 39312003.000004

Because cardinal_pythonlib worked with the older version of pendulum, with the newer version you got an ISO-8601 duration like:

P1Y3MT39312003.000004S

whereas it should be

P1Y3MT3.000004S
  1. Fixing an internal import from the enum standard library, by copying its code, in cardinal_pythonlib==1.1.5

Ubuntu prerequites are sudo apt-get install python3.9 python3.9-venv python3.9-dev.

I guess we don't have to increase MINIMUM_PYTHON_VERSION yet. However, should we move to Docker generally for our servers so we have a standard image?

I've not changed .travis.yml yet.

There are deprecation warnings made apparent by ``export

Changes are in #175

@RudolfCardinal
Copy link
Collaborator

Minimum Python version bumped to 3.7 as of CamCOPS v2.4.12 (per cc_pythonversion.py).

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

2 participants