From a4357d37c507aa65dd294da8b52b836bda943364 Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 12:46:19 -0800 Subject: [PATCH 1/6] docs(plausible): privacy-preserving docs analytics --- docs/source/conf.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ecd171ae43..5c7024cf0c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -763,8 +763,21 @@ def setup(app): """ Connect the replace_iframe_src function to the doctree-resolved event. """ + print(f"Building with builder: {app.builder.name}") + app.connect("doctree-resolved", ignore_svg_images_for_latex) app.connect("doctree-resolved", remove_external_images_for_latex) app.connect('doctree-resolved', replace_iframe_src) app.connect("doctree-resolved", assert_external_images_removed) - app.add_css_file('graphistry.css', priority=900) \ No newline at end of file + app.add_css_file('graphistry.css', priority=900) + + if app.builder.name == "html" or app.builder.name == "readthedocs": + app.add_js_file("https://plausible.io/js/script.hash.outbound-links.js", **{ + "defer": "true", + "data-domain": "pygraphistry.readthedocs.io", + }) + app.add_js_file(None, body=""" + window.plausible = window.plausible || function() { + (window.plausible.q = window.plausible.q || []).push(arguments) + } + """) From 6f7ceb5ef085e5db3a98604f33ecdfe0e47c16ac Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 13:09:23 -0800 Subject: [PATCH 2/6] wip(plausible) --- docs/source/conf.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5c7024cf0c..ff3f2f1bba 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,6 +13,7 @@ import docutils.nodes, os, logging, re, sys from docutils import nodes from packaging.version import Version +from sphinx.application import Sphinx sys.path.insert(0, os.path.abspath("../..")) @@ -759,7 +760,7 @@ def assert_external_images_removed(app, doctree, fromdocname): assert "://" not in image_uri, f"Failed to remove external image: {image_uri}" -def setup(app): +def setup(app: Sphinx): """ Connect the replace_iframe_src function to the doctree-resolved event. """ @@ -771,7 +772,13 @@ def setup(app): app.connect("doctree-resolved", assert_external_images_removed) app.add_css_file('graphistry.css', priority=900) - if app.builder.name == "html" or app.builder.name == "readthedocs": + if not hasattr(app, 'builder'): + print('No app.builder found') + # use dir to enumerate field names & types + attr_and_types: str = '\n'.join([f'{name}: {type(getattr(app, name))}' for name in dir(app)]) + print(f'attr_and_types:\n---\n{attr_and_types}\n---\n') + + if hasattr(app, 'builder') and (app.builder.name == "html" or app.builder.name == "readthedocs"): app.add_js_file("https://plausible.io/js/script.hash.outbound-links.js", **{ "defer": "true", "data-domain": "pygraphistry.readthedocs.io", From 5dbdbf00d3bc5d7d536695187a0911021b0e7765 Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 13:15:52 -0800 Subject: [PATCH 3/6] wip(plausible) --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ff3f2f1bba..50930056d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -764,7 +764,6 @@ def setup(app: Sphinx): """ Connect the replace_iframe_src function to the doctree-resolved event. """ - print(f"Building with builder: {app.builder.name}") app.connect("doctree-resolved", ignore_svg_images_for_latex) app.connect("doctree-resolved", remove_external_images_for_latex) From 7242839f538a20320f9a00b0d26f591a1062951a Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 13:33:35 -0800 Subject: [PATCH 4/6] wip(plausible) --- docs/source/conf.py | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 50930056d2..83684afd21 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -769,21 +769,29 @@ def setup(app: Sphinx): app.connect("doctree-resolved", remove_external_images_for_latex) app.connect('doctree-resolved', replace_iframe_src) app.connect("doctree-resolved", assert_external_images_removed) - app.add_css_file('graphistry.css', priority=900) - - if not hasattr(app, 'builder'): - print('No app.builder found') - # use dir to enumerate field names & types - attr_and_types: str = '\n'.join([f'{name}: {type(getattr(app, name))}' for name in dir(app)]) - print(f'attr_and_types:\n---\n{attr_and_types}\n---\n') - - if hasattr(app, 'builder') and (app.builder.name == "html" or app.builder.name == "readthedocs"): - app.add_js_file("https://plausible.io/js/script.hash.outbound-links.js", **{ - "defer": "true", - "data-domain": "pygraphistry.readthedocs.io", - }) - app.add_js_file(None, body=""" - window.plausible = window.plausible || function() { - (window.plausible.q = window.plausible.q || []).push(arguments) - } - """) + + def on_builder(app: Sphinx) -> None: + if not hasattr(app, 'builder'): + print('No app.builder found for app type=', type(app)) + # use dir to enumerate field names & types + attr_and_types: str = '\n'.join([f'{name}: {type(getattr(app, name))}' for name in dir(app)]) + print(f'attr_and_types:\n---\n{attr_and_types}\n---\n') + return + + if (app.builder.name == "html" or app.builder.name == "readthedocs"): + app.add_css_file('graphistry.css', priority=900) + app.add_js_file("https://plausible.io/js/script.hash.outbound-links.js", **{ + "defer": "true", + "data-domain": "pygraphistry.readthedocs.io", + }) + app.add_js_file(None, body=""" + window.plausible = window.plausible || function() { + (window.plausible.q = window.plausible.q || []).push(arguments) + } + """) + return + + print('No custom handling for app.builder.name=', app.builder.name) + + app.connect('builder-inited', on_builder) + From 18b80c562a46ff5c97ed2bd26e6e7b2055bc0829 Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 13:43:01 -0800 Subject: [PATCH 5/6] fix(ipynb): warnings --- .../simple/table_to_graph_three_ways.ipynb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/demos/more_examples/simple/table_to_graph_three_ways.ipynb b/demos/more_examples/simple/table_to_graph_three_ways.ipynb index 13e4ac360c..030343c471 100644 --- a/demos/more_examples/simple/table_to_graph_three_ways.ipynb +++ b/demos/more_examples/simple/table_to_graph_three_ways.ipynb @@ -25,7 +25,7 @@ "\n", "Local pip install to run the shaping and analytics locally, CPU or GPU\n", "\n", - "For the GPU cloud visualization sessons, and GPU analytics offloading of bigger graphs, get a free username/password or api key at [hub.graphistry.com](hub.graphistry.com)" + "For the GPU cloud visualization sessons, and GPU analytics offloading of bigger graphs, get a free username/password or api key at [hub.graphistry.com](https://hub.graphistry.com)" ] }, { @@ -839,15 +839,6 @@ "\n", "\n" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "-TGBwgfNgATr" - }, - "outputs": [], - "source": [] } ], "metadata": { From 07d7a953614342163833476c35a024282dffa97e Mon Sep 17 00:00:00 2001 From: Leo Meyerovich Date: Sat, 11 Jan 2025 13:43:35 -0800 Subject: [PATCH 6/6] docs(changelog) --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b961b0fdf4..9e067681da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Development] +## [0.35.6 - 2025-01-11] + ### Docs * Fix typo in new shaping tutorial - +* Privacy-preserving analytics ## [0.35.5 - 2025-01-10]