From 2f7ee961eae3689e2bfb25c7af42e34dac8c9b27 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sun, 22 Sep 2024 11:58:24 +0100 Subject: [PATCH] Version 2.2.0 --- docs/changelog.md | 11 +++++--- docs/ipywidgets.md | 5 ++-- packages/itables_anywidget/pyproject.toml | 31 ----------------------- src/itables/interactive.py | 10 -------- src/itables/utils.py | 2 +- src/itables/version.py | 2 +- tests/test_extension_arguments.py | 2 +- 7 files changed, 13 insertions(+), 50 deletions(-) delete mode 100644 packages/itables_anywidget/pyproject.toml diff --git a/docs/changelog.md b/docs/changelog.md index 98caaee3..a34ea128 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,16 +1,19 @@ ITables ChangeLog ================= -2.2.0-dev (2024-09-??) +2.2.0 (2024-09-22) ------------------ **Added** - ITables has a Jupyter Widget ([#267](https://github.com/mwouts/itables/issues/267)). Our widget was developed and packaged using [AnyWidget](https://anywidget.dev/) which I highly recommend! -- The selected rows are now available! Use either the `selected_rows` attribute of the `ITable` widget, or the returned value of the Streamlit `interactive_table` component, or the `{table_id}_selected_rows` input in Shiny ([#208](https://github.com/mwouts/itables/issues/208), [#250](https://github.com/mwouts/itables/issues/250)) -- ITables works offline in Shiny applications too! +- The selected rows are now available in the apps. Use either the `selected_rows` attribute of the `ITable` widget, the returned value of the Streamlit `interactive_table` component, or the `{table_id}_selected_rows` input in Shiny ([#208](https://github.com/mwouts/itables/issues/208), [#250](https://github.com/mwouts/itables/issues/250)) +- ITables works offline in Shiny applications too - just add `ui.HTML(init_itables())` to your application **Changed** -- `tableId` has been renamed to `table_id` +- The `tableId` argument of `to_html_datatable` has been renamed to `table_id` + +**Fixed** +- The dependencies of the streamlit component have been updated ([#320](https://github.com/mwouts/itables/issues/320)) 2.1.5 (2024-09-08) diff --git a/docs/ipywidgets.md b/docs/ipywidgets.md index 35a2b94d..7893c3f7 100644 --- a/docs/ipywidgets.md +++ b/docs/ipywidgets.md @@ -18,7 +18,8 @@ ITables is available as a [Jupyter Widget](https://ipywidgets.readthedocs.io) si ## The `ITable` widget -The `ITable` widget has a few dependencies that you can install with +The `ITable` widget has a few dependencies (essentially [AnyWidget](https://anywidget.dev), +a great widget development framework!) that you can install with ```bash pip install itables[widget] ``` @@ -91,7 +92,7 @@ table.update(df.head(20), selected_rows=[7, 8]) Compared to `show`, the `ITable` widget has the same limitations as the [streamlit component](streamlit.md#limitations), e.g. structured headers are not available, you can't pass JavaScript callback, etc. -The good news is that if you only want to _display_ the table, you **do not need** +The good news is that if you only want to _display_ the table, you do not need the `ITables` widget. Below is an example in which we use `show` to display a different table depending on the value of a drop-down component: diff --git a/packages/itables_anywidget/pyproject.toml b/packages/itables_anywidget/pyproject.toml deleted file mode 100644 index a279f56c..00000000 --- a/packages/itables_anywidget/pyproject.toml +++ /dev/null @@ -1,31 +0,0 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "itables_anywidget" -version = "0.0.0" -dependencies = ["anywidget"] -readme = "README.md" - -[project.optional-dependencies] -dev = ["watchfiles", "jupyterlab"] - -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] - - -[tool.hatch.build] -only-packages = true -artifacts = ["src/itables_anywidget/static/*"] - -[tool.hatch.build.hooks.jupyter-builder] -build-function = "hatch_jupyter_builder.npm_builder" -ensured-targets = ["src/itables_anywidget/static/widget.js"] -skip-if-exists = ["src/itables_anywidget/static/widget.js"] -dependencies = ["hatch-jupyter-builder>=0.5.0"] - -[tool.hatch.build.hooks.jupyter-builder.build-kwargs] -npm = "npm" -build_cmd = "build" diff --git a/src/itables/interactive.py b/src/itables/interactive.py index c774d0ed..69015afa 100644 --- a/src/itables/interactive.py +++ b/src/itables/interactive.py @@ -1,15 +1,5 @@ """Activate the representation of Pandas dataframes as interactive tables""" -import warnings - from .javascript import init_notebook_mode -# We issue a FutureWarning rather than a DeprecationWarning... -# because the DeprecationWarning is not shown in the notebook -warnings.warn( - """Importing itables.interactive is deprecated. -Please execute instead 'from itables import init_notebook_mode; init_notebook_mode(all_interactive=True)'""", - FutureWarning, -) - init_notebook_mode(all_interactive=True) diff --git a/src/itables/utils.py b/src/itables/utils.py index c4ccb1d2..0c837279 100644 --- a/src/itables/utils.py +++ b/src/itables/utils.py @@ -1,7 +1,7 @@ from io import open from pathlib import Path -UNPKG_DT_BUNDLE_URL = "https://www.unpkg.com/dt_for_itables@2.0.12/dt_bundle.js" +UNPKG_DT_BUNDLE_URL = "https://www.unpkg.com/dt_for_itables@2.0.13/dt_bundle.js" UNPKG_DT_BUNDLE_CSS = UNPKG_DT_BUNDLE_URL.replace(".js", ".css") UNPKG_DT_BUNDLE_URL_NO_VERSION = "https://www.unpkg.com/dt_for_itables/dt_bundle.js" UNPKG_DT_BUNDLE_CSS_NO_VERSION = "https://www.unpkg.com/dt_for_itables/dt_bundle.css" diff --git a/src/itables/version.py b/src/itables/version.py index cb2a6e60..44b3b644 100644 --- a/src/itables/version.py +++ b/src/itables/version.py @@ -1,3 +1,3 @@ """ITables' version number""" -__version__ = "2.2.0-dev" +__version__ = "2.2.0" diff --git a/tests/test_extension_arguments.py b/tests/test_extension_arguments.py index b13c2492..1c4c0953 100644 --- a/tests/test_extension_arguments.py +++ b/tests/test_extension_arguments.py @@ -36,7 +36,7 @@ def test_get_itables_extension_arguments(df): def test_no_use_to_html(): with pytest.raises( TypeError, - match="In the context of the streamlit extension, these options are not available", + match="In the context of the itable widget or streamlit extension, these options are not available", ): get_itables_extension_arguments(pd.DataFrame({"a": [0]}), use_to_html=True)