René's URL Explorer Experiment


Title: cuda.core: Replace string literals with enums in public API · Issue #1995 · NVIDIA/cuda-python · GitHub

Open Graph Title: cuda.core: Replace string literals with enums in public API · Issue #1995 · NVIDIA/cuda-python

X Title: cuda.core: Replace string literals with enums in public API · Issue #1995 · NVIDIA/cuda-python

Description: This is just a result of a sweep for using strings where enums could be used. This is just to aid the discussion about whether they should be addressed. Several places in the cuda.core public API accept or return string values chosen fro...

Open Graph Description: This is just a result of a sweep for using strings where enums could be used. This is just to aid the discussion about whether they should be addressed. Several places in the cuda.core public API a...

X Description: This is just a result of a sweep for using strings where enums could be used. This is just to aid the discussion about whether they should be addressed. Several places in the cuda.core public API a...

Opengraph URL: https://github.com/NVIDIA/cuda-python/issues/1995

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"cuda.core: Replace string literals with enums in public API","articleBody":"> This is just a result of a sweep for using strings where enums could be used. This is just to aid the discussion about whether they should be addressed.\n\nSeveral places in the `cuda.core` public API accept or return string values chosen from a small, fixed vocabulary. These are candidates for replacement with proper Python `enum` types, which would improve discoverability, IDE autocompletion, `isinstance` checking, and catch typos at the call site rather than at runtime.\n\n---\n\n## Findings\n\n### Compilation / Linking pipeline\n\n| Location | Kind | Values |\n|---|---|---|\n| `Program.__init__(code_type)` | arg | `\"c++\"`, `\"ptx\"`, `\"nvvm\"` |\n| `Program.compile(target_type)` | arg | `\"ptx\"`, `\"cubin\"`, `\"ltoir\"` |\n| `Program.backend` | return | `\"NVRTC\"`, `\"NVVM\"`, `\"nvJitLink\"`, `\"driver\"` |\n| `Program.pch_status` | return | `\"created\"`, `\"not_attempted\"`, `\"failed\"` |\n| `Linker.link(target_type)` | arg | `\"cubin\"`, `\"ptx\"` |\n| `Linker.backend` | return | `\"nvJitLink\"`, `\"driver\"` |\n| `ObjectCode.code_type` | return | `\"cubin\"`, `\"ptx\"`, `\"ltoir\"`, `\"fatbin\"`, `\"object\"`, `\"library\"` |\n\n### Memory\n\n| Location | Kind | Values |\n|---|---|---|\n| `ManagedMemoryResourceOptions.preferred_location_type` | arg | `\"device\"`, `\"host\"`, `\"host_numa\"` |\n| `ManagedMemoryResource.preferred_location` | return (tuple[0]) | `\"device\"`, `\"host\"`, `\"host_numa\"` |\n| `VirtualMemoryResourceOptions.allocation_type` | arg | `\"pinned\"`, `\"managed\"` |\n| `VirtualMemoryResourceOptions.location_type` | arg | `\"device\"`, `\"host\"`, `\"host_numa\"`, `\"host_numa_current\"` |\n| `VirtualMemoryResourceOptions.handle_type` | arg | `\"posix_fd\"`, `\"generic\"`, `\"win32_kmt\"`, `\"fabric\"` |\n| `VirtualMemoryResourceOptions.granularity` | arg | `\"recommended\"`, `\"minimum\"` |\n| `VirtualMemoryResourceOptions.self_access` / `peer_access` | arg | `\"rw\"`, `\"r\"` |\n\nNote: the `VirtualMemoryResourceOptions` fields already use `Literal[...]` type hints, which partially addresses the issue, but proper enums would still improve iteration, `isinstance` checks, and user discoverability.\n\n### Graph API\n\n| Location | Kind | Values |\n|---|---|---|\n| `GraphAllocOptions.memory_type` | arg | `\"device\"`, `\"host\"`, `\"managed\"` |\n| `AllocNode.memory_type` | return | `\"device\"`, `\"host\"`, `\"managed\"` |\n| `ConditionalNode.cond_type` | return | `\"if\"`, `\"while\"`, `\"switch\"` |\n\n---\n\n## Proposed enum groupings\n\n| Enum name | Values | Consumers |\n|---|---|---|\n| `CodeType` | `cubin`, `ptx`, `ltoir`, `fatbin`, `object`, `library` | `ObjectCode.code_type`, `Linker.link`, `Program.compile` |\n| `SourceType` | `c++`, `ptx`, `nvvm` | `Program.__init__` |\n| `CompilerBackend` | `NVRTC`, `NVVM`, `nvJitLink`, `driver` | `Program.backend`, `Linker.backend` |\n| `PchStatus` | `created`, `not_attempted`, `failed` | `Program.pch_status` |\n| `MemoryType` | `device`, `host`, `managed` | `GraphAllocOptions`, `AllocNode`, `ManagedMemoryResource` |\n| `LocationType` | `device`, `host`, `host_numa`, `host_numa_current` | `VirtualMemoryResourceOptions`, `ManagedMemoryResourceOptions` |\n| `ConditionalType` | `if_`, `while_`, `switch_` | `ConditionalNode.cond_type` |\n| `HandleType` | `posix_fd`, `generic`, `win32_kmt`, `fabric` | `VirtualMemoryResourceOptions` |\n| `Granularity` | `recommended`, `minimum` | `VirtualMemoryResourceOptions` |\n| `AccessMode` | `rw`, `r` | `VirtualMemoryResourceOptions` |\n\n---\n\n## Discussion points\n\n- The compilation/linking pipeline (`Program`, `Linker`, `ObjectCode`) is the highest-impact area since string values flow across multiple API boundaries.\n- Switching from `str` to `enum` would be a breaking change for existing callers. One migration path is to accept both `str` and the enum type during a deprecation window.\n- Some values (`\"c++\"`, `\"if\"`, `\"while\"`) are not valid Python identifiers and would need renaming (e.g. `SourceType.CPP`, `ConditionalType.IF`).","author":{"url":"https://github.com/mdboom","@type":"Person","name":"mdboom"},"datePublished":"2026-04-30T14:09:56Z","url":"https://github.com/NVIDIA/cuda-python/issues/1995"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e0eb2a39-1681-feb3-9cf8-8b173db36122
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id83AA:1E4D9D:4F098C:6D4525:6AF8459B
html-safe-nonce58a0f3c6bf0beff8c754f2bc10791dd20f9e2397e06121a156499f8d7f861a6e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0FBOjFFNEQ5RDo0RjA5OEM6NkQ0NTI1OjZBRjg0NTlCIiwidmlzaXRvcl9pZCI6IjI5MzY1NzU2NzQ0Mzg2NjU2MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0a25c595180d0bae3ff82fa0c0647ef979ef2a4d6c6c4e80e21d4fb9506c1770
hovercard-subject-tagissue:4358762558
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NVIDIA/cuda-python/1995/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ef6cf87fdaaaae8507374d835018b5d9397bca133b58d2900a941f3f4905f07f/NVIDIA/cuda-python/issues/1995
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ef6cf87fdaaaae8507374d835018b5d9397bca133b58d2900a941f3f4905f07f/NVIDIA/cuda-python/issues/1995
og:image:altThis is just a result of a sweep for using strings where enums could be used. This is just to aid the discussion about whether they should be addressed. Several places in the cuda.core public API a...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemdboom
hostnamegithub.com
expected-hostnamegithub.com
None5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db
turbo-cache-controlno-preview
go-importgithub.com/NVIDIA/cuda-python git https://github.com/NVIDIA/cuda-python.git
octolytics-dimension-user_id1728152
octolytics-dimension-user_loginNVIDIA
octolytics-dimension-repository_id381173759
octolytics-dimension-repository_nwoNVIDIA/cuda-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id381173759
octolytics-dimension-repository_network_root_nwoNVIDIA/cuda-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release653be32ff5c755082a4db662491bfbbcfc9112c1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NVIDIA/cuda-python/issues/1995#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNVIDIA%2Fcuda-python%2Fissues%2F1995
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNVIDIA%2Fcuda-python%2Fissues%2F1995
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NVIDIA%2Fcuda-python
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1995
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1995
Reloadhttps://github.com/NVIDIA/cuda-python/issues/1995
NVIDIAhttps://github.com/NVIDIA
cuda-pythonhttps://github.com/NVIDIA/cuda-python
Codehttps://github.com/NVIDIA/cuda-python
Issues219 (219)https://github.com/NVIDIA/cuda-python/issues
Pull requests92 (92)https://github.com/NVIDIA/cuda-python/pulls
Discussionshttps://github.com/NVIDIA/cuda-python/discussions
Actionshttps://github.com/NVIDIA/cuda-python/actions
Projectshttps://github.com/NVIDIA/cuda-python/projects
Wikihttps://github.com/NVIDIA/cuda-python/wiki
Security and qualityhttps://github.com/NVIDIA/cuda-python/security
Insightshttps://github.com/NVIDIA/cuda-python/pulse
https://github.com/NVIDIA/cuda-python
New issuehttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1995
New issuehttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1995
cuda.core: Replace string literals with enums in public APIhttps://github.com/NVIDIA/cuda-python/issues/1995#top
https://github.com/mdboom
P0High priority - Must do!https://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22P0%22
RFCPlans and announcementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22RFC%22
cuda.coreEverything related to the cuda.core modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.core%22
enhancementAny code-related improvementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
cuda.core v1.0.0https://github.com/NVIDIA/cuda-python/milestone/43
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on Apr 30, 2026https://github.com/NVIDIA/cuda-python/issues/1995#issue-4358762558
mdboomhttps://github.com/mdboom
enhancementAny code-related improvementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
RFCPlans and announcementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22RFC%22
cuda.coreEverything related to the cuda.core modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.core%22
on Apr 30, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25037422995
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on Apr 30, 2026https://github.com/NVIDIA/cuda-python/issues/1995#issuecomment-4353229804
leofanghttps://github.com/leofang
on Apr 30, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25050965092
Audit cuda.core API for 1.0 release #1919https://github.com/NVIDIA/cuda-python/issues/1919
leofanghttps://github.com/leofang
mdboomhttps://github.com/mdboom
on May 1, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25058634261
leofanghttps://github.com/leofang
cuda.core v1.0.0https://github.com/NVIDIA/cuda-python/milestone/43
on May 1, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25058634882
leofanghttps://github.com/leofang
P0High priority - Must do!https://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22P0%22
on May 1, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25058635960
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on May 1, 2026https://github.com/NVIDIA/cuda-python/issues/1995#issuecomment-4360249171
https://github.com/mdboom
mdboomhttps://github.com/mdboom
on May 1, 2026https://github.com/NVIDIA/cuda-python/issues/1995#issuecomment-4360356454
mdboomhttps://github.com/mdboom
on May 5, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25181180572
Fix NVIDIA#1995: Use StrEnum for enum-like stringshttps://github.com/mdboom/cuda-python/commit/4d1ddb4bff40518750fccbc72864ab7dfbab7603
NVIDIA#1995https://github.com/NVIDIA/cuda-python/issues/1995
https://docs.github.com/articles/closing-issues-via-commit-messages
4d1ddb4https://github.com/mdboom/cuda-python/commit/4d1ddb4bff40518750fccbc72864ab7dfbab7603
mdboomhttps://github.com/mdboom
completedhttps://github.com/NVIDIA/cuda-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
cec0efbhttps://github.com/NVIDIA/cuda-python/commit/cec0efbb647527a363542c771e531d0d14208601
on May 5, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25193038461
mdboomhttps://github.com/mdboom
on May 5, 2026https://github.com/NVIDIA/cuda-python/issues/1995#event-25193284990
Fix NVIDIA#1995: Use StrEnum for enum-like strings (NVIDIA#2016)https://github.com/mdboom/cuda-python/commit/cec0efbb647527a363542c771e531d0d14208601
NVIDIA#1995https://github.com/NVIDIA/cuda-python/issues/1995
NVIDIA#2016https://github.com/NVIDIA/cuda-python/pull/2016
https://docs.github.com/articles/closing-issues-via-commit-messages
cec0efbhttps://github.com/mdboom/cuda-python/commit/cec0efbb647527a363542c771e531d0d14208601
Sign up for freehttps://github.com/signup?return_to=https://github.com/NVIDIA/cuda-python/issues/1995
Sign in to commenthttps://github.com/login?return_to=https://github.com/NVIDIA/cuda-python/issues/1995
mdboomhttps://github.com/mdboom
P0High priority - Must do!https://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22P0%22
RFCPlans and announcementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22RFC%22
cuda.coreEverything related to the cuda.core modulehttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22cuda.core%22
enhancementAny code-related improvementshttps://github.com/NVIDIA/cuda-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
cuda.core v1.0.0https://github.com/NVIDIA/cuda-python/milestone/43
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.