Skip to content

chore: Add DType.__call__ #19097

chore: Add DType.__call__

chore: Add DType.__call__ #19097

Triggered via pull request January 7, 2026 17:35
Status Success
Total duration 13s
Artifacts

release-drafter.yml

on: pull_request
update_release_draft
8s
update_release_draft
Fit to window
Zoom out
Zoom in

Annotations

2 errors and 4 warnings
update_release_draft
HttpError: Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"} at /home/runner/work/_actions/release-drafter/release-drafter/v6/dist/index.js:7146:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Job.doExecute (/home/runner/work/_actions/release-drafter/release-drafter/v6/dist/index.js:61885:18) { name: 'AggregateError', event: { id: '20790569641', name: 'pull_request', payload: { action: 'edited', changes: { body: { from: '# Description\r\n' + 'As part of #3386, @FBruzzesi and I identified an issue with simply reusing `IntoDType.__eq__` to compare `DType`s.\r\n' + '\r\n' + 'When we start **nesting** `DType`s, there are cases like this where a change from a default makes the `Schema` incompatible:\r\n' + '\r\n' + '```py\r\n' + 'import datetime as dt\r\n' + '\r\n' + 'import polars as pl\r\n' + '\r\n' + 'data = {\r\n' + ' "a": [1, 2, 3],\r\n' + ' "b": ["hello", None, "its me again"],\r\n' + ' "c": [\r\n' + ' dt.datetime(2000, 1, 1, 12, 0, 0),\r\n' + ' dt.datetime(2000, 1, 1, 13, 0, 0),\r\n' + ' dt.datetime(2000, 2, 1, 9, 0, 0),\r\n' + ' ],\r\n' + '}\r\n' + '\r\n' + 'base = pl.DataFrame(data, schema_overrides={"c": pl.Datetime("us")}) # the default, but for visibility\r\n' + 'collect_struct = pl.struct(pl.all()).alias("struct")\r\n' + 'base_struct = base.select(collect_struct)\r\n' + 'c = pl.col("c")\r\n' + '\r\n' + 'diff_time_unit = base.with_columns(c.dt.cast_time_unit("ms")).select(collect_struct) # ✔️ \r\n' + 'diff_time_zone = base.with_columns(c.dt.convert_time_zone("UTC")).select(collect_struct) # ❌\r\n' + '```\r\n' + '\r\n' + 'Here, different `time_unit`s are allowed and we should just pick the less-precise one:\r\n' + '\r\n' + '```py\r\n' + 'pl.concat([base_struct, diff_time_unit], how="vertical_relaxed").schema\r\n' + '```\r\n' + '```\r\n' + "Schema([('struct',\r\n" + " Struct({'a': Int64, 'b': String, 'c': Datetime(time_unit='ms', time_zone=None)}))])\r\n" + '```\r\n' + '\r\n' + 'But if the difference is on `time_zone`s - we should raise:\r\n' + '\r\n' + '```py\r\n' + 'pl.concat([base_struct, diff_time_zone], how="vertical_relaxed")\r\n' + '```\r\n' + '```\r\n' + 'SchemaError: failed to determine supertype of struct[3] and struct[3]\r\n' + '```\r\n' + '\r\n' + '[This commit](https://github.com/narwhals-dev/narwhals/commit/bdbb1c5730583508e931af532b61fb20c31eaa4a) shows how many `isinstance` checks and `import`s that it saves.\r\n' + 'The cost might seem small, but it adds up once you consider `concat` need to do it for \r\n' + '- a pairwise comparison of many `Schema`s\r\n' + '- each field may contain any number of nested `DType`s\r\n' + '- those `DType`s can also be nested 😳 \r\n' + '\r\n' + "Caching **will help**, but since this problem can scale in multiple directions - it's probably best we minimize anything we can 😄 \r\n" + '\r\n' + '## What type of PR is this? (check all applicable)\r\n' + '\r\n' + '- [x] 🔧 Optimization\r\n' + '- [x] 🐳 Other\r\n' + '\r\n' + '## Related issues\r\n' + '\r\n' + '- https://github.com/narwhals-dev/narwhals/commit/bdbb1c5730583508e931af532b61fb20c31eaa4a\r\n' + '- #3386\r\n' + '\r\n' + 'Needed to se
update_release_draft
Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"} { name: 'HttpError', id: '20790569641', status: 422, response: { url: 'https://api.github.com/repos/narwhals-dev/narwhals/releases/245770708', status: 422, headers: { 'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'content-length': '210', 'content-security-policy': "default-src 'none'", 'content-type': 'application/json; charset=utf-8', date: 'Wed, 07 Jan 2026 17:35:12 GMT', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', server: 'github.com', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', vary: 'Accept-Encoding, Accept, X-Requested-With', 'x-accepted-github-permissions': 'contents=write', 'x-content-type-options': 'nosniff', 'x-frame-options': 'deny', 'x-github-api-version-selected': '2022-11-28', 'x-github-media-type': 'github.v3; format=json', 'x-github-request-id': 'C401:FFD92:18227EA:69A6BF6:695E994F', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4979', 'x-ratelimit-reset': '1767810600', 'x-ratelimit-resource': 'core', 'x-ratelimit-used': '21', 'x-xss-protection': '0' }, data: { message: 'Validation Failed', errors: [ { resource: 'Release', code: 'invalid', field: 'target_commitish' } ], documentation_url: 'https://docs.github.com/rest/releases/releases#update-a-release', status: '422' } }, request: { method: 'PATCH', url: 'https://api.github.com/repos/narwhals-dev/narwhals/releases/245770708', headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'probot/12.4.0 octokit-core.js/3.6.0 Node.js/20.19.5 (linux; x64)', 'x-github-delivery': '20790569641', authorization: 'token [REDACTED]', 'content-type': 'application/json; charset=utf-8' }, body: '{"body":"## Changes\\n\\n## ✨ Enhancements\\n\\n- feat: Add `{Expr,Series}.cos` (#3392)\\n- feat: Add `testing.assert_frame_equal` (#3220)\\n\\nThank you to all our contributors for making this release possible!\\n@FBruzzesi, @dangotbanned and @liamholmes31\\n","draft":true,"prerelease":false,"make_latest":"true","name":"Narwhals unreleased","tag_name":"untagged-5857ee5b463af7437b01","target_commitish":"refs/pull/3393/merge"}', request: {} }, event: { id: '20790569641', name: 'pull_request', payload: { action: 'edited', changes: { body: { from: '# Description\r\n' + 'As part of #3386, @FBruzzesi and I identified an issue with simply reusing `IntoDType.__eq__` to compare `DType`s.\r\n' + '\r\n' + 'When we start **nesting** `DType`s, there are cases like this where a change from a default makes the `Schema` incompatible:\r\n' + '\r\n' + '```py\r\n' + 'import datetime as dt\r\n' + '\r\n' + 'import polars as pl\r\n' + '\r\n' + 'data = {\r\n' + ' "a": [1, 2, 3],\r\n' + ' "b": ["hello", None, "its me again"],\r\n' + ' "c": [\r\n' + ' dt.datetime(2000, 1, 1, 12, 0, 0),\r\n' + ' dt.datetime(2000, 1, 1, 13, 0, 0),\r\n' + ' dt.datetime(2000, 2, 1, 9, 0, 0),\r\n' + ' ],\r\n' + '}\r\n' + '\r\n' + 'base = pl.DataFrame(data, schema_overrides={"c": pl.Datetime("us")}) # the default, but for visibility\r\n' + 'collect_struct = pl.struct(pl.all()).alias("struct")\r\n' + 'base_struct = base.se
update_release_draft
"pull_request_target.edited" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)
update_release_draft
"pull_request_target.synchronize" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)
update_release_draft
"pull_request_target.reopened" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)
update_release_draft
"pull_request_target.opened" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)