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

Support SqlAlchemy 1.4 and Python 3.9 #81

Merged

Conversation

tomviner
Copy link
Collaborator

@tomviner tomviner commented Apr 6, 2023

This PR builds on the good work in #69 and expands Github Actions for new versions.

Changes:

  • sqlalchemy 1.4 compatibility from Support for SQLAlchemy 1.4 #69
    • note, although there are pragma: nocover labels, this is because any one test run with particular versions isn't comprehensive, but overall, all branches are covered
  • Github Actions
    • latest Github Action Ubuntu (22.04) doesn't support some Python versions, so use 20.04
    • start testing against Python 3.9
    • start testing against sqlalchemy1.4 specifically
    • sqlalchemylatest is now 2.x, which is currently failing tests, and not yet supported
    • pin tox to v3 as v4 drops support for Python 3.6 and earlier

Further changes after review:

  • use coverage-conditional-plugin (requires Python>3.7) to ensure we have overall 100% coverage
    • add a test for a line that wasn't covered
  • only support in-life Python versions, see https://endoflife.date/python
    • so drop support for Pythons 2.7, 3.5, 3.6
    • set python_requires='>=3.7' which means this release is still backwards compatible, as old Pythons can't install it by mistake
  • only test against supported versions, which enables Tests

setup.py Outdated
Comment on lines 28 to 29
# for sqlalchemy1.4 >= 0.37 is required
'sqlalchemy-utils>=0.36.3',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>= 3.7 != >-0.36.3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was intended. py27 wasn't compatible with 0.36.3, so that customisation was done in tox.ini. Anyway, I've removed py27 support now.

models.extend(mapper.class_ for mapper in query._join_entities)

# account joined entities
if sqlalchemy_version_lt('1.4'): # pragma: nocover

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth using this https://github.com/wemake-services/coverage-conditional-plugin instead of just pragma: nocover.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@tomviner tomviner marked this pull request as ready for review April 13, 2023 10:23
Copy link

@heindsight heindsight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tomviner tomviner merged commit e182378 into juliotrigo:master Apr 13, 2023
@tomviner tomviner deleted the sqla14-with-improved-github-actions branch April 13, 2023 11:09
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

Successfully merging this pull request may close these issues.

3 participants