Title: Prefer using literal types over enums · Issue #576 · apify/apify-client-python · GitHub
Open Graph Title: Prefer using literal types over enums · Issue #576 · apify/apify-client-python
X Title: Prefer using literal types over enums · Issue #576 · apify/apify-client-python
Description: We should prefer typing.Literal types over enum.Enum. Motivation Better developer experience - Literals can be passed directly as values, without requiring additional imports. Type safety is preserved - When used with a type checker, Lit...
Open Graph Description: We should prefer typing.Literal types over enum.Enum. Motivation Better developer experience - Literals can be passed directly as values, without requiring additional imports. Type safety is preser...
X Description: We should prefer typing.Literal types over enum.Enum. Motivation Better developer experience - Literals can be passed directly as values, without requiring additional imports. Type safety is preser...
Opengraph URL: https://github.com/apify/apify-client-python/issues/576
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Prefer using literal types over enums","articleBody":"- We should prefer `typing.Literal` types over `enum.Enum`.\n\n### Motivation\n\n- Better developer experience - Literals can be passed directly as values, without requiring additional imports.\n- Type safety is preserved - When used with a type checker, Literal types provide the same level of safety as enums.\n- Fewer footguns - The usage of enums can easily lead to bugs like this one: https://github.com/apify/apify-client-python/pull/575.\n- Consistency across our tooling - We already prefer literals in Crawlee and the SDK.\n\n### Scope\n\n- This primarily applies to constants currently defined as enums, especially those in: https://github.com/apify/apify-shared-python/blob/master/src/apify_shared/consts.py.\n\n### Compatibility\n\n- This is a breaking change, so it should be tracked and implemented as part of apify-python-client v3.","author":{"url":"https://github.com/vdusek","@type":"Person","name":"vdusek"},"datePublished":"2026-01-09T14:42:04Z","url":"https://github.com/apify/apify-client-python/issues/576"}
| 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:9e92609e-5157-04ca-f462-5ea45852c1b4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9844:22E601:FFFAC2:1582BFA:6B005D8B |
| html-safe-nonce | 085420264d1b48ef84c2b5f0dca1c0ccc52655779d2b86ec1f789a3b9e30aaec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODQ0OjIyRTYwMTpGRkZBQzI6MTU4MkJGQTo2QjAwNUQ4QiIsInZpc2l0b3JfaWQiOiI2MDM2NTY1MzgyMjkzMTE4MzQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 32beba3bee5616d369cbef8021f4afee3018ac1a1c7e6b938da80367dc8dfdb8 |
| hovercard-subject-tag | issue:3797196341 |
| 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/apify/apify-client-python/576/issue_layout |
| twitter:image | https://opengraph.githubassets.com/847767e0c068145a44932b566619d5463a7d2c03053f216e36b9e0ea5d4dec84/apify/apify-client-python/issues/576 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/847767e0c068145a44932b566619d5463a7d2c03053f216e36b9e0ea5d4dec84/apify/apify-client-python/issues/576 |
| og:image:alt | We should prefer typing.Literal types over enum.Enum. Motivation Better developer experience - Literals can be passed directly as values, without requiring additional imports. Type safety is preser... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vdusek |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| turbo-cache-control | no-preview |
| go-import | github.com/apify/apify-client-python git https://github.com/apify/apify-client-python.git |
| octolytics-dimension-user_id | 24586296 |
| octolytics-dimension-user_login | apify |
| octolytics-dimension-repository_id | 164647835 |
| octolytics-dimension-repository_nwo | apify/apify-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 164647835 |
| octolytics-dimension-repository_network_root_nwo | apify/apify-client-python |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width