Skip to content

Conversation

@machow
Copy link
Collaborator

@machow machow commented Jul 25, 2024

Currently, we have code in _tbl_data.py, which uses generic functions to handle DataFrame logic for both pandas and polars. While this works well, it requires that we basically maintain a tiny DataFrame translation layer. This PR starts work towards using narwhals to handle the pandas and polars logic.

The big advantage of narwhals is that it translates the polars API over different DataFrame types (e.g. pandas). Wiring it up means we use our polars logic, but can apply it to pandas, etc..

  • @schloerke said he'll take this and run with it (feel free to blast anything; I'm happy to try a narwhals PR if anything is needed)

(Big thanks to @MarcoGorelli for pairing w/ @schloerke, @jcheng5, and I to work on the key pieces :)

* main:
  setup.cfg -> pyproject.toml (posit-dev#1625)
  docs(navset): Add server function to navset docs (posit-dev#1596)
  Pin syrupy to avoid pytest-rerunfailures incompatibility (posit-dev#1632)
  refactor: `shiny create` and `shiny add test` supporting functions (posit-dev#1629)
  Update CHANGELOG.md
  Fix posit-dev#1601: Force text/javascript for .js files
  Work around griffe 1.0 breaking changes
  feat(shiny create): Support simpler syntax for `--github` flag (posit-dev#1623)
  Make sure `Chat.messages(format='google')` converts role assistant -> model (posit-dev#1622)
  Fix `NormalizerRegistry.register()` (posit-dev#1619)
  Update JS/CSS from shiny and bslib (posit-dev#1617)
  Add ability to update `Chat()`'s input placeholder (posit-dev#1594)
  docs: Add double-quotes to shiny[theme] (posit-dev#1605)
  `json.dump()` each websocket message once instead of twice (posit-dev#1597)
  docs: Update note on style keys allowing for kebab-case (posit-dev#1595)
  docs: fix navset function links (posit-dev#1590)
  Get `ui.Chat()` working inside Shiny modules (posit-dev#1582)
  bug(notification): Allow for duration to be `None` and passed to client (posit-dev#1577)
  Fix logic for detection of support files in docs (posit-dev#1580)
  docs(navset): Add examples for navset (posit-dev#1579)
* main:
  CI(deploy): Add more installation configs to surface failure cause (posit-dev#1658)
  `Chat.messages()` no longer trims messages by default (posit-dev#1657)
  tests(controllers): Split _controls.py into separate files (posit-dev#1652)
  Chat tweaks (posit-dev#1607)
  docs: Add modal_show/remove examples (posit-dev#1628)
  Delay sending of chat UI messages until reactive graph is flushed (posit-dev#1593)
  ci(remove future behavior warning): Set the `asyncio_default_fixture_loop_scope` to `fixture` (posit-dev#1655)
  bug: Verify mypy can run on CI (posit-dev#1650)
  Fix CI install failures on Windows (posit-dev#1651)
  Quartodoc 0.7.6 (posit-dev#1636)
  Allow `@chat.transform_assistant_response` function to return `None` (posit-dev#1641)
  feat: Support templates with `_template.json` metadata (posit-dev#1631)
  Fix KeyError when serving static files (posit-dev#1648)
  tests(navsets): Add navsets kitchensink tests (posit-dev#1602)
  Change default claude model to 3.5 sonnet
* main:
  chore: Fix white space formatting in `reactive.poll` Returns (posit-dev#1667)
  fix(shiny create): Use `template.id` for default directory (posit-dev#1666)
  fix(tests): Add missing env vars for shinyapps.io tests (posit-dev#1663)
  v1.1.0 release candidate
  Put streaming visual cue at the end of the content (posit-dev#1659)
  CI(debug): Print full stdout/stderr when command fails (posit-dev#1660)
@schloerke schloerke enabled auto-merge (squash) October 3, 2024 20:26
Copy link
Contributor

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing effort here, and thanks the reports you've issued to Narwhals along the way! 🤗

I've just got a question about the upper bound

@schloerke schloerke merged commit 3ff6567 into posit-dev:main Oct 3, 2024
40 checks passed
schloerke added a commit that referenced this pull request Oct 7, 2024
* main:
  tests(sidebar): Add tests for sidebar (#1715)
  tests(accordion): Add kitchensink tests for accordion (#1710)
  tests(bug): Use locator instead of element handles (#1716)
  tests(deploys): Move import from htmltools into code to help with debugging deploys (#1718)
  build: set Narwhals 1.9.1 as minimum, remove upper bound, use narwhals.stable.v1 for dtypes and typing (#1717)
  feat: support DataFrames via narwhals (#1570)
  Adds Deploy to Connect Cloud buttons to app READMEs (#1709)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data frame Related to @render.data_frame

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants