Title: Typing support for capsules · Issue #109562 · python/cpython · GitHub
Open Graph Title: Typing support for capsules · Issue #109562 · python/cpython
X Title: Typing support for capsules · Issue #109562 · python/cpython
Description: Feature or enhancement Proposal: While not common, capsule objects can appear in APIs. For example the Python DLPack protocol specifies a __dlpack__ method returning a capsule object. It would therefore be nice to add typing support for ...
Open Graph Description: Feature or enhancement Proposal: While not common, capsule objects can appear in APIs. For example the Python DLPack protocol specifies a __dlpack__ method returning a capsule object. It would ther...
X Description: Feature or enhancement Proposal: While not common, capsule objects can appear in APIs. For example the Python DLPack protocol specifies a __dlpack__ method returning a capsule object. It would ther...
Opengraph URL: https://github.com/python/cpython/issues/109562
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Typing support for capsules","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nWhile not common, capsule objects can appear in APIs. For example the [Python DLPack protocol](https://dmlc.github.io/dlpack/latest/python_spec.html#implementation) specifies a `__dlpack__` method returning a capsule object.\n\nIt would therefore be nice to add typing support for capsules. Ideally it should be parameterable by the capsule name, because it often serves as a discriminator for the actual C type under the capsule.\n\n```python\nfrom typing import Capsule, Protocol\n\nclass DLPackExportable(Protocol):\n def __dlpack__(self) -\u003e Capsule[\"dltensor\"]:\n```\n\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_","author":{"url":"https://github.com/pitrou","@type":"Person","name":"pitrou"},"datePublished":"2023-09-19T07:08:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/109562/cpython/issues/109562"}
| 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:bb940a93-8d72-b89d-db0a-6cfe4577d0a8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED42:378C0F:44388E:5F1CDB:696A6B9B |
| html-safe-nonce | 422fd0df6c6f497582977417a45045289de39666f8cf1e6b906d0705feb06d59 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDQyOjM3OEMwRjo0NDM4OEU6NUYxQ0RCOjY5NkE2QjlCIiwidmlzaXRvcl9pZCI6IjQzMzgxNDc5MjgyOTk5NTcxNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 55efb7743809889ade4d433f846bb2fb6581dae65eb56e9c456b6eefe5b877a7 |
| hovercard-subject-tag | issue:1902347229 |
| 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/cpython/109562/issue_layout |
| twitter:image | https://opengraph.githubassets.com/342e1b54c070ca1b406fb1fa134e5667f655d4b8bc82cad99b35001785b1ad7e/python/cpython/issues/109562 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/342e1b54c070ca1b406fb1fa134e5667f655d4b8bc82cad99b35001785b1ad7e/python/cpython/issues/109562 |
| og:image:alt | Feature or enhancement Proposal: While not common, capsule objects can appear in APIs. For example the Python DLPack protocol specifies a __dlpack__ method returning a capsule object. It would ther... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pitrou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fea32d5b7276b841b7a803796d9715bc6cfb31ed549fdf9de2948ac25d12ba6 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | f2d9f6432a5a115ec709295ae70623f33bb80aee |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width