Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🎨 Fix types for lifespan, upgrade Starlette to 0.26.1#9245

Merged
tiangolo merged 3 commits intomasterfrom
starlette-lifespan-types
Mar 14, 2023
Merged

🎨 Fix types for lifespan, upgrade Starlette to 0.26.1#9245
tiangolo merged 3 commits intomasterfrom
starlette-lifespan-types

Conversation

@tiangolo
Copy link
Member

🎨 Fix types for lifespan, depends onKludex/starlette#2077

@tiangolotiangolo added the bugSomething isn't working labelMar 12, 2023
@github-actions
Copy link
Contributor

github-actionsbot commentedMar 12, 2023
edited
Loading

@github-actionsgithub-actionsbot temporarily deployed to pull requestMarch 12, 2023 11:59 Inactive
@github-actions
Copy link
Contributor

📝 Docs preview for commit2e373fa at:https://640dbed4fbc9f768d2b35cd4--fastapi.netlify.app

@adriangb
Copy link
Contributor

You also need to addself: AppType

Kludex and tiangolo reacted with thumbs up emoji

@tiangolo
Copy link
MemberAuthor

Good point, thanks@adriangb! Trying it locally I realized I had to redefineAppType to be bound toFastAPI as well.

@adriangb
Copy link
Contributor

Hmm I’m surprised thebound=Starlette should work and the fact that you haveself: AppType should make the AppType always matchself which is going to be a FastAPI instance.

@github-actionsgithub-actionsbot temporarily deployed to pull requestMarch 14, 2023 01:48 Inactive
@github-actions
Copy link
Contributor

📝 Docs preview for commit4578cfb at:https://640fd2b293def71708f521d2--fastapi.netlify.app

@tiangolo
Copy link
MemberAuthor

I'm trying with this example:

fromcollections.abcimportAsyncGeneratorfromcontextlibimportasynccontextmanagerfromfastapiimportFastAPI@asynccontextmanagerasyncdeflifespan(_:FastAPI)->AsyncGenerator[None,None]:    ...yield    ...app=FastAPI(lifespan=lifespan)

And I get this error:

mypy sand.pyfastapi/applications.py:112: error: "AppType" has no attribute "openapi_schema"fastapi/applications.py:113: error: "AppType" has no attribute "openapi_url"fastapi/applications.py:114: error: "AppType" has no attribute "title"fastapi/applications.py:115: error: "AppType" has no attribute "version"fastapi/applications.py:126: error: "AppType" has no attribute "dependency_overrides"fastapi/applications.py:153: error: "AppType" has no attribute "setup"Found 6 errors in 1 file (checked 1 source file)

...I guess it would be fine for external things to haveAppType be bound toStarlette, but for the internals ofFastAPI it seems to be a problem. But I guess it would be fine then to have the customAppType here.

@tiangolotiangolo changed the title🎨 Fix types for lifespan, depends on https://github.com/encode/starlette/pull/2077🎨 Fix types for lifespan, upgrade Starlette to 0.26.1Mar 14, 2023
@tiangolotiangolo merged commit25aabe0 intomasterMar 14, 2023
@tiangolotiangolo deleted the starlette-lifespan-types branchMarch 14, 2023 02:19
@adriangb
Copy link
Contributor

@tiangolo
Copy link
MemberAuthor

Ah, yeah, the error is not in the lifespan, but that the class doesn't have the custom attributesFastAPI defines.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

bugSomething isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@tiangolo@adriangb

Comments


[8]ページ先頭

©2009-2026 Movatter.jp