Skip to content

feat: has_operation #9471

feat: has_operation

feat: has_operation #9471

Triggered via pull request January 13, 2025 20:40
Status Success
Total duration 17s
Artifacts

release-drafter.yml

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

Annotations

2 errors and 1 warning
update_release_draft
Resource not accessible by integration { name: 'HttpError', id: '12755698612', status: 403, response: { url: 'https://api.github.com/repos/narwhals-dev/narwhals/releases', status: 403, 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', connection: 'close', 'content-encoding': 'gzip', 'content-security-policy': "default-src 'none'", 'content-type': 'application/json; charset=utf-8', date: 'Mon, 13 Jan 2025 20:40:33 GMT', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', server: 'github.com', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'transfer-encoding': 'chunked', vary: 'Accept-Encoding, Accept, X-Requested-With', 'x-accepted-github-permissions': 'contents=write; contents=write,workflows=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': '53C7:15C72C:12789939:12D98D11:67857A40', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4961', 'x-ratelimit-reset': '1736802898', 'x-ratelimit-resource': 'core', 'x-ratelimit-used': '39', 'x-xss-protection': '0' }, data: { message: 'Resource not accessible by integration', documentation_url: 'https://docs.github.com/rest/releases/releases#create-a-release', status: '403' } }, request: { method: 'POST', url: 'https://api.github.com/repos/narwhals-dev/narwhals/releases', headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'probot/12.2.5 octokit-core.js/3.5.1 Node.js/20.18.0 (linux; x64)', authorization: 'token [REDACTED]', 'content-type': 'application/json; charset=utf-8' }, body: '{"target_commitish":"refs/pull/1807/merge","name":"Narwhals unreleased","tag_name":"","body":"## Changes\\n\\n## ✨ Enhancements\\n\\n- feat: add `DataFrame` and `Series` `to_polars` (#1803)\\n- feat: add support for `SparkLikeNamespace.when` (#1805)\\n\\nThank you to all our contributors for making this release possible!\\n@EdAbati, @FBruzzesi and @camriddell\\n","draft":true,"prerelease":false,"make_latest":"true"}', request: {} }, event: { id: '12755698612', name: 'pull_request', payload: { action: 'edited', changes: { body: { from: '<!--\r\n' + '# Thanks for contributing a pull request! \r\n' + '## Please make sure you see our contribution guidelines: https://github.com/narwhals-dev/narwhals/blob/main/CONTRIBUTING.md\r\n' + '-->\r\n' + '\r\n' + '## What type of PR is this? (check all applicable)\r\n' + '\r\n' + '- [ ] 💾 Refactor\r\n' + '- [x] ✨ Feature\r\n' + '- [ ] 🐛 Bug Fix\r\n' + '- [ ] 🔧 Optimization\r\n' + '- [ ] 📝 Documentation\r\n' + '- [ ] ✅ Test\r\n' + '- [ ] 🐳 Other\r\n' + '\r\n' + '## Related issues\r\n' + '\r\n' + '- Related issue #1610 \r\n' + '- Closes #\\<issue number\\>\r\n' + '\r\n' + '## Checklist\r\n' + '\r\n' + '- [x] Code follows style guide (ruff)\r\n' + '- [x] Tests added\r\n' + '- [x] Documented the changes\r\n' + '\r\n' + '## If you have comments or can explain your changes, please do so below\r\n' + 'Wanted to get feedback for an idea I had to implement `has_operation`. The current API implements the following changes\r\n' + '\r\
update_release_draft
HttpError: Resource not accessible by integration at /home/runner/work/_actions/release-drafter/release-drafter/v6/dist/index.js:8462: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:30793:18) { name: 'AggregateError', event: { id: '12755698612', name: 'pull_request', payload: { action: 'edited', changes: { body: { from: '<!--\r\n' + '# Thanks for contributing a pull request! \r\n' + '## Please make sure you see our contribution guidelines: https://github.com/narwhals-dev/narwhals/blob/main/CONTRIBUTING.md\r\n' + '-->\r\n' + '\r\n' + '## What type of PR is this? (check all applicable)\r\n' + '\r\n' + '- [ ] 💾 Refactor\r\n' + '- [x] ✨ Feature\r\n' + '- [ ] 🐛 Bug Fix\r\n' + '- [ ] 🔧 Optimization\r\n' + '- [ ] 📝 Documentation\r\n' + '- [ ] ✅ Test\r\n' + '- [ ] 🐳 Other\r\n' + '\r\n' + '## Related issues\r\n' + '\r\n' + '- Related issue #1610 \r\n' + '- Closes #\\<issue number\\>\r\n' + '\r\n' + '## Checklist\r\n' + '\r\n' + '- [x] Code follows style guide (ruff)\r\n' + '- [x] Tests added\r\n' + '- [x] Documented the changes\r\n' + '\r\n' + '## If you have comments or can explain your changes, please do so below\r\n' + 'Wanted to get feedback for an idea I had to implement `has_operation`. The current API implements the following changes\r\n' + '\r\n' + '- custom `metaproperty` decorator that behaves similarly to `property` (only the getter syntax other functionality would need to be implemented or would need to inherit from property itself).\r\n' + ' - enables chained syntax to move from an Expression/Series to its constituent namespaces without requiring an instance\r\n' + ' - `nw.Expr.dt.date` is valid syntax.\r\n' + '- add `has_operation` to check if a given function passed using the above syntax is available for any given backend.\r\n' + '\r\n' + 'What would be nice for this feature would be if these components were more readily accessible from the narwhals namespace, dynamic imports based on internalized mappings can become tricky to maintain (see `narwhals/utils:has_operation locals.backend_mapping`) Instead these expressions could be added to the Implementation enum providing more informative metadata (such as import location lookups as well as namespace import names).\r\n' + '\r\n' + '---\r\n' + '\r\n' + 'Feedback on the concept as a whole or the specific implementation is welcome!\r\n' + '\r\n' + 'Here are a few examples to show what this PR contains\r\n' + '\r\n' + '```python\r\n' + 'from narwhals import has_operation\r\n' + 'import narwhals as nw\r\n' + 'import polars as pl\r\n' + 'import pandas as pd\r\n' + 'import pyarrow as pa\r\n' + 'import duckdb\r\n' + 'import dask.dataframe as dd\r\n' + '\r\n' + '\r\n' + 'print(\r\n' + ' f"{has_operation(pl, nw.Expr.mean) = }", # True\r\n' + ' f"{has_operation(pl, nw.Expr.dt.date) = }", # True\r\n' + ' f"{has_operation(pl, nw.Series.mean) = }", # True\r\n' + ' f"{has_operation(pl, nw.Series.str.to_uppercase) = }", # True\r\n' + ' f"{has_operation(pl, nw.DataFrame.explode) = }", # True\r\n' + ' f"{has_operation(pl, nw.LazyFrame.drop_nulls) = }", # True\r\n' + ' "",\r\n
update_release_draft
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636