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

Examples and tests for async support in SQLModel #471

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

auphofBSF
Copy link

@auphofBSF auphofBSF commented Oct 18, 2022

  • (2✅ of 15⏹️ ) asyncio Tutorials matching sync Tutorials.
  • (2✅ of 15⏹️ ) pytest asyncio tutorial tests
  • ✅above tests and tutorials passing mypy static analysis (see note below)

mypy static test dependencies

The work done in #58 resolves the mypy static type analysis issues "AsyncSession" has incompatible type "SelectOfScalar[Hero]"
with mypy docs_src\tutorial_async before: #58
image
after #58
image

Note the PR #435

This PR subclasses outstanding sqlalchemy dependencies and also provides some additional tutorial and pytest tests. I have not assessed those tutorials or tests, I have marked in each tutorial that this PR provides the TODO's to change on PR #435 or equivalent being merged, removing the requirement for sqlalchemy imports

Note on python < 3.9

Python 3.6 support should be retired even 3.7 is EOL 2021/12, have got a clean lint and test running for 3.7 but 3.6 required major dependency surgery on pyproject.toml that looked like it was getting there until I ran into
image

The dependency management for 3.6.15 that was working
image

Summary

I believe there is great value in the existing sync tutorials and so have proceeded with converting those to async tutorials as this provides a simple base for adding, extending and checking coverage

SLLau added 9 commits October 18, 2022 11:52
squashed wip commits

based on `docs_src/tutorial`
Goals ---------
convert to async as working examples
ensure static typing with mypy passes
refactor: mypy issues with annotations
refactor: simplify async session using SQLmodel

to pass mypy use typdef Annotation see
https://pydantic-docs.helpmanual.io/usage/schema/#typingannotated-fields
doc: TODO depend on PR435
refactor: simply session start
only addresses async tests, does not try to fix
other tests
use: `mypy docs_src\tutorial_async` and
`mypy tests\test_async_tutorial`
pytest.asyncio dropped support for python 3.6 with version 0.17.0 (22-01-13)  as Python 3.6 EOL (23 Dec 2021)
also references tests and major PR dependencies
@github-actions
Copy link

📝 Docs preview for commit 1151d85 at: https://634df5df2d0196544d59a3e1--sqlmodel.netlify.app

current pydantic 1.10.2
see pydantic/pydantic#4358
Fix imports indirectly from pydantic typing #4358
@github-actions
Copy link

📝 Docs preview for commit 94527a6 at: https://634e048b16d79567f08bfacd--sqlmodel.netlify.app

@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Base: 97.76% // Head: 98.89% // Increases project coverage by +1.12% 🎉

Coverage data is based on head (6d00e2c) compared to base (75ce455).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #471      +/-   ##
==========================================
+ Coverage   97.76%   98.89%   +1.12%     
==========================================
  Files         187      208      +21     
  Lines        6268     6680     +412     
==========================================
+ Hits         6128     6606     +478     
+ Misses        140       74      -66     
Impacted Files Coverage Δ
...ect_async/create_tables_async/tutorial001_async.py 100.00% <100.00%> (ø)
...nc/connect_async/delete_async/tutorial001_async.py 100.00% <100.00%> (ø)
...nc/connect_async/insert_async/tutorial001_async.py 100.00% <100.00%> (ø)
...nc/connect_async/select_async/tutorial001_async.py 100.00% <100.00%> (ø)
...nc/connect_async/select_async/tutorial002_async.py 100.00% <100.00%> (ø)
...nc/connect_async/select_async/tutorial003_async.py 100.00% <100.00%> (ø)
...nc/connect_async/select_async/tutorial004_async.py 100.00% <100.00%> (ø)
...nc/connect_async/select_async/tutorial005_async.py 100.00% <100.00%> (ø)
...nc/connect_async/update_async/tutorial001_async.py 100.00% <100.00%> (ø)
...c/tutorial_async/select_async/tutorial001_async.py 100.00% <100.00%> (ø)
... and 17 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

📝 Docs preview for commit 1846878 at: https://634e5720ac7f9d1fde6279d9--sqlmodel.netlify.app

async tutorials not supported  with mypy static type checking
if python version before 3.9
@github-actions
Copy link

📝 Docs preview for commit 5aed51e at: https://634e81e23c20c3463fe7cccb--sqlmodel.netlify.app

flake8 not compatible with 22Oct1 release of  importlib_metadata v5
see PyCQA/flake8#1701
set importlib_metadata to 4.13.0
@github-actions
Copy link

📝 Docs preview for commit 6d00e2c at: https://634f09db47ba242e98b80f08--sqlmodel.netlify.app

@auphofBSF
Copy link
Author

see comments regarding python < 3.9. I believe support for 3.6 should be retired.

@LulzLoL231
Copy link

Great addition, any progress?

@tiangolo tiangolo added the docs Improvements or additions to documentation label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation investigate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants