social-examples icon indicating copy to clipboard operation
social-examples copied to clipboard

Binding DB sessions based on SQLAlchemy 1, changing how to declare Base Model classes, and other code modernization

Open search5 opened this issue 4 months ago • 1 comments

  • DB session binding based on SQLAlchemy 2, Base Model class declaration method change
  • Reflected select, delete code based on SQLAlchemy 2
  • Changed how to declare Model class based on SQLAlchemy 2
  • Fixed social login not connecting issue found while testing example program code (for example-pyramid)
  • Fixed issue with social connection termination (for example-cherrypy, example-tornado, example-webpy)
  • Added local_settings.py.template file to some example folders to make it easier to create local_settings.py files
  • Fixed import errors found in several examples

Proposed changes

With the introduction of PEP 517/518, the Python package build process has changed to allow the use of multiple build backends. We've improved the build process accordingly. In addition, we improved the program to ensure that several previously developed libraries work properly with the newly updated SQLAlchemy 2 in January 2023.

Please consider this PR and look forward to the new version release. I took the time to fix the program and submit the patch because I'm planning to include it in a Korean Flask-based programming book I'm writing.

Types of changes

Please check the type of change your PR introduces:

  • [X] Release (new release request)
  • [X] Bugfix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Code style update (PEP8, lint, formatting, renaming, etc)
  • [X] Refactoring (no functional changes, no api changes)
  • [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [X] Build related changes (build process, tests runner, etc)
  • [ ] Other (please describe):

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [ ] Lint and unit tests pass locally with my changes
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added documentation to https://github.com/python-social-auth/social-docs
  • [X] I created a running environment for the program and carefully verified that my modifications worked.

Summary by CodeRabbit

  • Bug Fixes

    • Addressed import issues across several examples (CherryPy, WebPy, Flask).
    • Fixed DB session handling and model creation for SQLAlchemy 2 compatibility.
  • New Features

    • Introduced templates for easier configuration in Tornado and WebPy examples.
  • Refactor

    • Removed flask-script dependency, transitioning to Flask's built-in CLI.
    • Updated session management from db_session.remove() to db_session.close().
    • Refactored command line management in Flask, Flask-MongoEngine, and Flask-Peewee examples to use click and FlaskGroup.
    • Enhanced readability and structure in filters.py, pipeline.py, and utils.py across examples.
    • Modified SQLAlchemy column declarations using Mapped and mapped_column for improved type hinting.
  • Chores

    • Added # noqa: F401 comments to suppress unused import warnings in Django and Django-MongoEngine examples.
  • Documentation

    • Improved error message clarity in CherryPy example.

search5 avatar Feb 24 '24 05:02 search5