Add mypy type-checking with SQLAlchemy 2.0 Mapped/mapped_column#25
Draft
Copilot wants to merge 7 commits into
Draft
Add mypy type-checking with SQLAlchemy 2.0 Mapped/mapped_column#25Copilot wants to merge 7 commits into
Copilot wants to merge 7 commits into
Conversation
…ped_column Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
…iles Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add type-checking using mypy with strict typing for SQLAlchemy
Add mypy type-checking with SQLAlchemy 2.0 Mapped/mapped_column
Jan 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements strict type-checking using mypy and migrates all SQLAlchemy models to use SQLAlchemy 2.0's
Mappedandmapped_columnhelpers, eliminating the need for the mypy plugin.Changes
SQLAlchemy Model Migration
Mapped[T]andmapped_column()instead ofColumn()TeamStateType(types.TypeDecorator[TeamState]))scoped_session[Session]as_uuid=Truetypes-sqlalchemyandtypes-Flask-SQLAlchemystubsType Annotations
Configuration
Example
Before:
After:
Notes
updatedfield)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
astral.sh/usr/bin/curl curl -LsSf REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Start implementation
[Chronological Review: The conversation began with the user requesting to add type-checking using mypy, ensuring integration with VS-Code and strict typing for SQLAlchemy 2.x types. The user specified that the project uses 'uv' as the package manager. They noted that the 'sqlalchemy2-stubs' project is inappropriate for their needs and emphasized using the new "Mapped" and "mapped_column" helpers when updating SQLAlchemy models. The user also requested compatibility with Python 3.14 and strict type-checks across the project, including routes, with plans to add checks to the CI pipeline once all checks pass. They indicated that using "Mapped" and "mapped_column" would render the mypy plugin obsolete, leading to a decision to remove it. The user requested to enforce strict checks immediately, leaving out other linters like flake8 and black for now. The conversation culminated in a request to start implementation, followed by commands to commit changes and delegate tasks to a cloud agent.][Intent Mapping:
[Technical Inventory:
[Code Archaeology:
[Progress Assessment:
[Context Validation: All critical information for continuation is captured, including user requests for type-checking, package management, and SQLAlchemy model updates.]
[Recent Commands Analysis:
1. Conversation Overview: - Primary Objectives: The user requested to implement type-checking with mypy, ensure compatibility with VS-Code, and strictly type SQLAlchemy 2.x types. They emphasized using the 'uv' package manager and the new "Mapped" and "mapped_column" helpers for SQLAlchemy models. The user also wanted to ensure compatibility with Python 3.14 and enforce strict type-checks across the project. - Session Context: The conversation progressed from outlining requirements for type-checking to initiating implementation and delegating tasks to a cloud agent. - User Intent Evolution: The user's needs evolved from specifying requirements to actively starting the implementation phase.- Technical Foundation:
- Core Technology: mypy for type-checking.
- Framework: SQLAlchemy 2.x, focusing on "Mapped" and "mapped_column" for model updates.
- Package Manager: uv.
- Python Version: 3.14.
- Type-Checking Strategy: Strict type-checking across the project, including routes.
- Codebase Status:
- No specific files were discussed, but the focus is on updating SQLAlchemy models and implementing type-checking.
- Problem Resolution:
- Issues Encountered: The user identified that the 'sqlalchemy2-stubs' project is not suitable for their needs.
- Solutions Implemented: The decision to use "Mapped" and "mapped_column" and to enforce strict type-checking.
- Debugging Context: No ongoing troubleshooting was mentioned.
- Lessons Learned: The importance of using appropriate stubs and helpers for SQLAlchemy 2.x.
- Progress Tracking:
- Completed Tasks: User has outlined requirements for t...
Created from VS Code.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.