Title: Add `sys.abi_info` to make information about the interpreter ABI more accessible · Issue #133143 · python/cpython · GitHub
Open Graph Title: Add `sys.abi_info` to make information about the interpreter ABI more accessible · Issue #133143 · python/cpython
X Title: Add `sys.abi_info` to make information about the interpreter ABI more accessible · Issue #133143 · python/cpython
Description: Feature or enhancement Proposal: Early on in the discussion of PEP 780: ABI features as environment markers a certain shortcoming of ABI information availability was identified and discussed. One suggestion was to adopt a new mechanism f...
Open Graph Description: Feature or enhancement Proposal: Early on in the discussion of PEP 780: ABI features as environment markers a certain shortcoming of ABI information availability was identified and discussed. One s...
X Description: Feature or enhancement Proposal: Early on in the discussion of PEP 780: ABI features as environment markers a certain shortcoming of ABI information availability was identified and discussed. One s...
Opengraph URL: https://github.com/python/cpython/issues/133143
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add `sys.abi_info` to make information about the interpreter ABI more accessible","articleBody":"# Feature or enhancement\n\n### Proposal:\n\n[Early on](https://discuss.python.org/t/environment-marker-for-free-threading/60007/8) in the discussion of [PEP 780: ABI features as environment markers](https://peps.python.org/pep-0780/) a certain shortcoming of ABI information availability was identified and discussed.\nOne suggestion was to adopt a new mechanism for making this kind of information available, which initially was included as a proposal in PEP 780 itself. However, that PEP is aimed at improving the packaging situation and to improve that focus, the addition to the standard library is no longer part of it.\n\nHere, we propose to add ABI information to the standard library in the form of a new attribute to the `sys` module.\n\nIn PEP 780 three ABI features are identified, namely\n\n- `free-threading` or `gil-enabled` (only CPython)\n If the Python interpreter is free-threaded, the `free-threading` feature MUST be present and the `gil-enabled` feature MUST NOT be present. Otherwise, the `gil-enabled` feature MUST be present and the `free-threading` feature MUST NOT be present.\n\n- `debug` (only CPython, optional)\n This ABI feature is reserved for the `--with-pydebug` build of CPython. If the interpreter is a CPython interpreter with `Py_DEBUG` capabilities, the `debug` feature MUST be present. On POSIX systems, this corresponds to the Python expression `\"d\" in sys.abiflags`.\n\n- `32-bit` or `64-bit` (optional)\n The bitness of the interpreter, that is, whether it is a 32-bit or 64-bit build. If the bitness is unknown or neither 32-bit nor 64-bit, this feature MUST NOT be present.\n \nA reference implementation of this feature [is available](https://github.com/zklaus/cpython/pull/1), which adds these features as a frozen set of identifying strings to `sys.abi_features`. \n\nFor purposes of the environment markers defined in PEP 780, only the presence or absence of the features is relevant. However, in the discussion of the reference implementation @FFY00 suggested that a more comprehensive implementation might be useful, for example providing additional information about the ABI features, such as their representation in `sys.abiflags` (which directly impacts their possible representation in the ABI tags used for wheels and extension modules), or their default state.\n\nThis addition to the standard library will make crucial ABI information much easier to access.\n\nWe think this fully backwards compatible addition can be made with a simple pull request.\n\nIt would be great to hear from the CPython team.\n\nDo you agree that this is a useful feature?\n\nDo you think detailed information beyond simple presence or absence of ABI features should be included?\n\nDo you have suggestions for the exact API?\n\n### Has this already been discussed elsewhere?\n\nI have already discussed this feature proposal on Discourse\n\n### Links to previous discussion of this feature:\n\n[Initial thoughts](https://discuss.python.org/t/environment-marker-for-free-threading/60007/8) on this feature, have surfaced in the discussions leading to PEP 780.\nDuring the discussion of the PEP, [further comments](https://github.com/python/peps/pull/4315#discussion_r2007997314) were [made](https://discuss.python.org/t/pep-780-abi-features-as-environment-markers/86013/7), leading to the separation from the PEP with further review comments [available](https://github.com/zklaus/cpython/pull/1).\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-137476\n* gh-138672\n* gh-138698\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/zklaus","@type":"Person","name":"zklaus"},"datePublished":"2025-04-29T10:21:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/133143/cpython/issues/133143"}
| 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:01520be6-d1fc-594a-0d24-ac6bbe1c91ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB2A:30A1AE:5378A0C:74AB00A:6A551144 |
| html-safe-nonce | b7ef97a4990f9d4f2da5187013c74ecea46cccc3f7b550a15cc4e7c32b04b67a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjJBOjMwQTFBRTo1Mzc4QTBDOjc0QUIwMEE6NkE1NTExNDQiLCJ2aXNpdG9yX2lkIjoiOTU5MjM2MDgyMTE3MTg1ODYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0a6c1d1f9d0a2157bbb4acb7d0d6315d15f90055e2bbaefe2cc27f70adddd59c |
| hovercard-subject-tag | issue:3027808019 |
| 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/133143/issue_layout |
| twitter:image | https://opengraph.githubassets.com/766edaac9984739b4368f391df91c8396ac375b0de4e1b7cf9093aaf7967158e/python/cpython/issues/133143 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/766edaac9984739b4368f391df91c8396ac375b0de4e1b7cf9093aaf7967158e/python/cpython/issues/133143 |
| og:image:alt | Feature or enhancement Proposal: Early on in the discussion of PEP 780: ABI features as environment markers a certain shortcoming of ABI information availability was identified and discussed. One s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zklaus |
| hostname | github.com |
| expected-hostname | github.com |
| None | 682d273eacb2ac51680c6eb9c0b270f029f7ce74c32090f319083c34497e28a5 |
| 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 | 0f2adbaa4b43ea302b02981f637a782ae92ed6dc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width