From 2cd495b88fdbe8ca226982f88ba50ddd4f6e2d87 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli Date: Tue, 22 Oct 2024 08:43:24 +0100 Subject: [PATCH] Add Narwhals to package list (#5121) Narwhals is a lightweight compatibility layer between dataframe libraries, with zero dependencies. It's now used by Altair, so I'm opening this PR to enable them to update their version here on Pyodide vega/altair#3642 --- docs/project/changelog.md | 1 + packages/narwhals/meta.yaml | 16 ++++++++++++++++ packages/narwhals/test_narwhals.py | 21 +++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 packages/narwhals/meta.yaml create mode 100644 packages/narwhals/test_narwhals.py diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 857571dde..121bf7432 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -90,6 +90,7 @@ myst: - Added `tree-sitter-go` 0.23.1 {pr}`5102` - Added `tree-sitter-java` 0.23.2 {pr}`5102` - Added `tree-sitter-python` 0.23.2 {pr}`5102` +- Added `Narwhals` 1.9.4 {pr}`5121` ## Version 0.26.3 diff --git a/packages/narwhals/meta.yaml b/packages/narwhals/meta.yaml new file mode 100644 index 000000000..455220285 --- /dev/null +++ b/packages/narwhals/meta.yaml @@ -0,0 +1,16 @@ +package: + name: narwhals + version: 1.10.0 + top-level: + - narwhals +source: + url: https://files.pythonhosted.org/packages/82/45/6bb08a5e5ac2d9a95f4116567d0aafb1e5f86c4bbcf982e209e5ae872b3d/narwhals-1.10.0-py3-none-any.whl + sha256: c83a378960651c391e5f3d68af3a821eda74c9713073518fe0c39aefc5ad8f8e +about: + home: https://github.com/narwhals-dev/narwhals + PyPI: https://pypi.org/project/narwhals + summary: Extremely lightweight compatibility layer between dataframe libraries + license: MIT +extra: + recipe-maintainers: + - MarcoGorelli diff --git a/packages/narwhals/test_narwhals.py b/packages/narwhals/test_narwhals.py new file mode 100644 index 000000000..a4c36e9b7 --- /dev/null +++ b/packages/narwhals/test_narwhals.py @@ -0,0 +1,21 @@ +from pytest_pyodide import run_in_pyodide + + +@run_in_pyodide(packages=["narwhals"]) +def test_narwhals_from_native(selenium): + import narwhals as nw + + class MyDictDataFrame: + def __init__(self, data): + self._data = data + + def __narwhals_dataframe__(self): + return self + + @property + def columns(self): + return list(self._data) + + assert nw.from_native( + MyDictDataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) + ).columns == ["a", "b"]