From bb1ba2fd178707074cbb36e7562313bd650e2470 Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Tue, 22 Aug 2023 23:17:21 +0200 Subject: [PATCH 01/11] docs: implement autoapi --- docs/conf.py | 8 +++++++- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1c6b9c75..d2d6d6b6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,7 +30,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["jupyter_sphinx", "sphinx_rtd_theme"] +extensions = ["jupyter_sphinx", "sphinx_rtd_theme", "autoapi.extension"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -59,3 +59,9 @@ html_css_files = [ "custom.css", ] + +# -- Options for autosummary/autodoc output ------------------------------------ +autodoc_typehints = "description" +autoapi_dirs = ["../ipyvuetify"] +autoapi_python_class_content = "init" +autoapi_member_order = "groupwise" diff --git a/pyproject.toml b/pyproject.toml index 6ced8785..a912fecf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ content-type = "text/markdown" [project.optional-dependencies] dev = ["nox", "pre-commit", "mypy"] test = ["pytest", "pytest-playwright", "jupyterlab<4", "solara[pytest]"] -doc = ["sphinx<7", "jupyter-sphinx", "ipykernel"] +doc = ["sphinx<7", "jupyter-sphinx", "ipykernel", "sphinx-rtd-theme", "sphinx-autoapi"] [tool.setuptools] include-package-data = true From 05d648cf65606c2add265e3ebc0cbd7d24a58cc7 Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Wed, 23 Aug 2023 10:54:15 +0200 Subject: [PATCH 02/11] docs: ignore private members --- docs/conf.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index d2d6d6b6..59fdea65 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -65,3 +65,21 @@ autoapi_dirs = ["../ipyvuetify"] autoapi_python_class_content = "init" autoapi_member_order = "groupwise" +autoapi_options = [ + "members", + "undoc-members", + "show-inheritance", + "show-module-summary", + "special-members", + "imported-members", +] + + +def skip_submodules(app, what, name, obj, skip, options): + if what == "module" and name in ["Html"]: + skip = True + return skip + + +def setup(sphinx): + sphinx.connect("autoapi-skip-member", skip_submodules) From 1ee7f06a9c3821387a6406372bc2193612b0435d Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Wed, 23 Aug 2023 10:54:43 +0200 Subject: [PATCH 03/11] docs: ignore special members --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 59fdea65..de4dcb2a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -70,7 +70,6 @@ "undoc-members", "show-inheritance", "show-module-summary", - "special-members", "imported-members", ] From c41144714a538f71aff4f3f0ec4132dd4b5697fd Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Wed, 23 Aug 2023 10:55:08 +0200 Subject: [PATCH 04/11] fix: drop skipmodule --- docs/conf.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index de4dcb2a..46a11496 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -72,13 +72,3 @@ "show-module-summary", "imported-members", ] - - -def skip_submodules(app, what, name, obj, skip, options): - if what == "module" and name in ["Html"]: - skip = True - return skip - - -def setup(sphinx): - sphinx.connect("autoapi-skip-member", skip_submodules) From 269fd2ec50fd325cb956fa6d4f5f437b8941371c Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Wed, 23 Aug 2023 10:55:51 +0200 Subject: [PATCH 05/11] docs: use class content widgets usually don't overwrite the __init__ method --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 46a11496..918c8808 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,7 +63,6 @@ # -- Options for autosummary/autodoc output ------------------------------------ autodoc_typehints = "description" autoapi_dirs = ["../ipyvuetify"] -autoapi_python_class_content = "init" autoapi_member_order = "groupwise" autoapi_options = [ "members", From fffb4dc62547f6d8aa1ccd83da99c0363f70ad64 Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Wed, 23 Aug 2023 11:19:36 +0200 Subject: [PATCH 06/11] refactor: make ruff accept init unused imports --- .gitignore | 2 +- generate_source/generate_source.py | 2 +- ipyvuetify/{Html.py => _Html.py} | 0 ipyvuetify/{VuetifyTemplate.py => _VuetifyTemplate.py} | 0 ipyvuetify/__init__.py | 10 +++++----- ipyvuetify/extra/__init__.py | 2 +- pyproject.toml | 1 + 7 files changed, 9 insertions(+), 8 deletions(-) rename ipyvuetify/{Html.py => _Html.py} (100%) rename ipyvuetify/{VuetifyTemplate.py => _VuetifyTemplate.py} (100%) diff --git a/.gitignore b/.gitignore index 7df9d44b..f9f8cc87 100755 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ build/ # generated code generate_source/build -ipyvuetify/generated +ipyvuetify/_generated js/src/generated # Compiled javascript diff --git a/generate_source/generate_source.py b/generate_source/generate_source.py index f327dddc..309b8353 100644 --- a/generate_source/generate_source.py +++ b/generate_source/generate_source.py @@ -20,7 +20,7 @@ project_dir = here.parent destination_js = project_dir / "js" / "src" / "generated" -destination_python = project_dir / "ipyvuetify" / "generated" +destination_python = project_dir / "ipyvuetify" / "_generated" def reset_dir(name: Path): diff --git a/ipyvuetify/Html.py b/ipyvuetify/_Html.py similarity index 100% rename from ipyvuetify/Html.py rename to ipyvuetify/_Html.py diff --git a/ipyvuetify/VuetifyTemplate.py b/ipyvuetify/_VuetifyTemplate.py similarity index 100% rename from ipyvuetify/VuetifyTemplate.py rename to ipyvuetify/_VuetifyTemplate.py diff --git a/ipyvuetify/__init__.py b/ipyvuetify/__init__.py index c044e3c2..91a71ac7 100755 --- a/ipyvuetify/__init__.py +++ b/ipyvuetify/__init__.py @@ -1,8 +1,8 @@ -from ._version import __version__ # noqa: F401 -from .generated import * # noqa: F401, F403 -from .Html import Html # noqa: F401 -from .Themes import theme # noqa: F401 -from .VuetifyTemplate import VuetifyTemplate # noqa: F401 +from ._generated import * # noqa: F403 +from ._Html import Html as Html +from ._version import __version__ as __version__ +from ._VuetifyTemplate import VuetifyTemplate as VuetifyTemplate +from .Themes import theme as theme def _jupyter_labextension_paths(): diff --git a/ipyvuetify/extra/__init__.py b/ipyvuetify/extra/__init__.py index 79465061..0011b169 100644 --- a/ipyvuetify/extra/__init__.py +++ b/ipyvuetify/extra/__init__.py @@ -1 +1 @@ -from .file_input import FileInput # noqa: F401 +from .file_input import FileInput as FileInput diff --git a/pyproject.toml b/pyproject.toml index a912fecf..5b602a6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ exclude = ["docs*", "tests*"] universal = true [tool.ruff] +ignore-init-module-imports = true fix = true exclude = [ '.git', From 257880ca40c1f9f1c8446d99af4ef5e42e46deaf Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Thu, 24 Aug 2023 22:14:42 +0200 Subject: [PATCH 07/11] fix: rollback to non prefix packages --- .gitignore | 2 +- generate_source/generate_source.py | 2 +- ipyvuetify/{_Html.py => Html.py} | 0 ipyvuetify/{_VuetifyTemplate.py => VuetifyTemplate.py} | 0 ipyvuetify/__init__.py | 6 +++--- 5 files changed, 5 insertions(+), 5 deletions(-) rename ipyvuetify/{_Html.py => Html.py} (100%) rename ipyvuetify/{_VuetifyTemplate.py => VuetifyTemplate.py} (100%) diff --git a/.gitignore b/.gitignore index f9f8cc87..7df9d44b 100755 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ build/ # generated code generate_source/build -ipyvuetify/_generated +ipyvuetify/generated js/src/generated # Compiled javascript diff --git a/generate_source/generate_source.py b/generate_source/generate_source.py index 309b8353..f327dddc 100644 --- a/generate_source/generate_source.py +++ b/generate_source/generate_source.py @@ -20,7 +20,7 @@ project_dir = here.parent destination_js = project_dir / "js" / "src" / "generated" -destination_python = project_dir / "ipyvuetify" / "_generated" +destination_python = project_dir / "ipyvuetify" / "generated" def reset_dir(name: Path): diff --git a/ipyvuetify/_Html.py b/ipyvuetify/Html.py similarity index 100% rename from ipyvuetify/_Html.py rename to ipyvuetify/Html.py diff --git a/ipyvuetify/_VuetifyTemplate.py b/ipyvuetify/VuetifyTemplate.py similarity index 100% rename from ipyvuetify/_VuetifyTemplate.py rename to ipyvuetify/VuetifyTemplate.py diff --git a/ipyvuetify/__init__.py b/ipyvuetify/__init__.py index 91a71ac7..607f20db 100755 --- a/ipyvuetify/__init__.py +++ b/ipyvuetify/__init__.py @@ -1,8 +1,8 @@ -from ._generated import * # noqa: F403 -from ._Html import Html as Html from ._version import __version__ as __version__ -from ._VuetifyTemplate import VuetifyTemplate as VuetifyTemplate +from .generated import * # noqa: F403 +from .Html import Html as Html from .Themes import theme as theme +from .VuetifyTemplate import VuetifyTemplate as VuetifyTemplate def _jupyter_labextension_paths(): From d26f6caaa5cb4be9cab0d4ecb0a7f3f45deae98a Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Thu, 24 Aug 2023 22:59:05 +0200 Subject: [PATCH 08/11] docs: skip private modules and packages --- docs/conf.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 918c8808..af580707 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -71,3 +71,22 @@ "show-module-summary", "imported-members", ] + + +def skip_submodules(app, what, name, obj, skip, options): + """Ignore the modules and packages taht are private + + Only necessary for those that are not using a leading underscore + """ + privates = { + "ipyvuetify.Html": "modules", + "ipyvuetify.VuetifyTemplate": "module", + "ipyvuetify.generated": "package", + } + if any([what == t and name == m for m, t in privates.items()]): + skip = True + return skip + + +def setup(sphinx): + sphinx.connect("autoapi-skip-member", skip_submodules) From 1915a2679d864ee77c33e9c197a102f42698e8e2 Mon Sep 17 00:00:00 2001 From: Pierrick Rambaud Date: Thu, 24 Aug 2023 23:06:19 +0200 Subject: [PATCH 09/11] refactor: typo --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index af580707..7f8f3cb8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -79,7 +79,7 @@ def skip_submodules(app, what, name, obj, skip, options): Only necessary for those that are not using a leading underscore """ privates = { - "ipyvuetify.Html": "modules", + "ipyvuetify.Html": "module", "ipyvuetify.VuetifyTemplate": "module", "ipyvuetify.generated": "package", } From 3e8f246ee159ec4c17e87861d8d38eed3236f7a8 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 25 Aug 2023 07:54:26 +0000 Subject: [PATCH 10/11] refactor: easier to read implmentation --- docs/conf.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7f8f3cb8..3f84a0f0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -78,14 +78,14 @@ def skip_submodules(app, what, name, obj, skip, options): Only necessary for those that are not using a leading underscore """ - privates = { - "ipyvuetify.Html": "module", - "ipyvuetify.VuetifyTemplate": "module", - "ipyvuetify.generated": "package", - } - if any([what == t and name == m for m, t in privates.items()]): - skip = True - return skip + privates = [ + ("module", "ipyvuetify.Html"), + ("module", "ipyvuetify.VuetifyTemplate"), + ("package", "ipyvuetify.generated"), + ] + + # return `skip` when nothing is catch to keep skipping the private members + return any([what == t and name == m for t, m in privates]) or skip def setup(sphinx): From acc697d41de3f15c1f2895607c14349d77a49475 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 25 Aug 2023 08:30:24 +0000 Subject: [PATCH 11/11] fix: reduce the scope of the PR --- ipyvuetify/__init__.py | 10 +++++----- ipyvuetify/extra/__init__.py | 2 +- pyproject.toml | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ipyvuetify/__init__.py b/ipyvuetify/__init__.py index 607f20db..c044e3c2 100755 --- a/ipyvuetify/__init__.py +++ b/ipyvuetify/__init__.py @@ -1,8 +1,8 @@ -from ._version import __version__ as __version__ -from .generated import * # noqa: F403 -from .Html import Html as Html -from .Themes import theme as theme -from .VuetifyTemplate import VuetifyTemplate as VuetifyTemplate +from ._version import __version__ # noqa: F401 +from .generated import * # noqa: F401, F403 +from .Html import Html # noqa: F401 +from .Themes import theme # noqa: F401 +from .VuetifyTemplate import VuetifyTemplate # noqa: F401 def _jupyter_labextension_paths(): diff --git a/ipyvuetify/extra/__init__.py b/ipyvuetify/extra/__init__.py index 0011b169..79465061 100644 --- a/ipyvuetify/extra/__init__.py +++ b/ipyvuetify/extra/__init__.py @@ -1 +1 @@ -from .file_input import FileInput as FileInput +from .file_input import FileInput # noqa: F401 diff --git a/pyproject.toml b/pyproject.toml index 5b602a6a..a912fecf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,6 @@ exclude = ["docs*", "tests*"] universal = true [tool.ruff] -ignore-init-module-imports = true fix = true exclude = [ '.git',