Title: Flask app Protocol · Issue #2789 · python/typeshed · GitHub
Open Graph Title: Flask app Protocol · Issue #2789 · python/typeshed
X Title: Flask app Protocol · Issue #2789 · python/typeshed
Description: First off, big thanks to @pcorpet for adding Flask stubs in #2740. I was updating one of my packages with to new type information and noticed something that stuck out to me. One of the patterns that my team and I like to use is to create...
Open Graph Description: First off, big thanks to @pcorpet for adding Flask stubs in #2740. I was updating one of my packages with to new type information and noticed something that stuck out to me. One of the patterns tha...
X Description: First off, big thanks to @pcorpet for adding Flask stubs in #2740. I was updating one of my packages with to new type information and noticed something that stuck out to me. One of the patterns tha...
Opengraph URL: https://github.com/python/typeshed/issues/2789
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Flask app Protocol","articleBody":"First off, big thanks to @pcorpet for adding Flask stubs in #2740. I was updating one of my packages with to new type information and noticed something that stuck out to me.\r\n\r\nOne of the patterns that my team and I like to use is to create a set of endpoints that are bound to a `Flask` duck-type; basically this factory can take a `flask.Flask` instance or a `flask.Blueprint` instance since both support `add_url_rule`.\r\n\r\nhttps://github.com/python/typeshed/blob/75581cf7da13dcea9ab5080e930530ecb5bc5ef3/third_party/2and3/flask/blueprints.pyi#L41\r\nhttps://github.com/python/typeshed/blob/ca62cecd1422c4f68c051f326cc9bc4b28c781e2/third_party/2and3/flask/app.pyi#L98\r\n\r\nI am not super familiar with typeshed practices or Flask internals but the solution I am using right now locally is to define `FlaskBlueprintType = Union[flask.Flask, flask.Blueprint]` and use that. A potentially more useful solution would be to define an ABC which Flask and Blueprint either explicitly implement or simply through https://docs.python.org/3/library/abc.html#abc.ABCMeta.register. Another option is to use https://www.python.org/dev/peps/pep-0544/ but Protocols are not fully finalized yet.\r\n\r\nDoes this make sense as type information to add or am I approaching this problem the wrong way?","author":{"url":"https://github.com/chrisphilip322","@type":"Person","name":"chrisphilip322"},"datePublished":"2019-02-11T19:54:41Z","url":"https://github.com/python/typeshed/issues/2789"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ff687cd3-fb7e-0d32-320b-f37780a094bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B588:3CE430:745D7:A2F71:6B005115 |
| html-safe-nonce | 40c3bfebd065db81d21460a4504ac31215fe09bbe26bc476291d336495483847 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTg4OjNDRTQzMDo3NDVENzpBMkY3MTo2QjAwNTExNSIsInZpc2l0b3JfaWQiOiI2Mjk5MjkxMTA4NzY5ODEyNzU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d4a5afe56be617ef348a7451e7dd657c889bd0e6e77f96df1b282db43cf43344 |
| hovercard-subject-tag | issue:408949178 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/2789/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77bdd0281f7cc295b64724c25eb2b44b853edef9c557c7157ab28b3b7a24442c/python/typeshed/issues/2789 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77bdd0281f7cc295b64724c25eb2b44b853edef9c557c7157ab28b3b7a24442c/python/typeshed/issues/2789 |
| og:image:alt | First off, big thanks to @pcorpet for adding Flask stubs in #2740. I was updating one of my packages with to new type information and noticed something that stuck out to me. One of the patterns tha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chrisphilip322 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width