From 2efa62b31762d4865ce1ee0773e04b756885f7f0 Mon Sep 17 00:00:00 2001 From: Gabriel Stefanini Vicente Date: Thu, 8 Feb 2024 19:48:52 -0500 Subject: [PATCH] Change Versioning (#38) * Migrate to setuptools_scm * Rename package --- .gitignore | 3 + Makefile | 8 - notebooks/world-bank-api.ipynb | 12 +- notebooks/world-bank-package.ipynb | 513 +++++++++++++++++++----- pyproject.toml | 20 +- src/datalab/VERSION | 1 - src/datalab/__init__.py | 3 - src/template/__init__.py | 7 + src/{datalab => template}/indicators.py | 0 9 files changed, 436 insertions(+), 131 deletions(-) delete mode 100644 Makefile delete mode 100644 src/datalab/VERSION delete mode 100644 src/datalab/__init__.py create mode 100644 src/template/__init__.py rename src/{datalab => template}/indicators.py (100%) diff --git a/.gitignore b/.gitignore index beb3890..dd6d4f7 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,6 @@ _build/ # python-dotenv .env + +# setuptools-scm/ +src/*/_version.py diff --git a/Makefile b/Makefile deleted file mode 100644 index 4939ec0..0000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -all: build serve - -build: - jupyter-book build . --config docs/_config.yml --toc docs/_toc.yml - -serve: - open _build/html/index.html diff --git a/notebooks/world-bank-api.ipynb b/notebooks/world-bank-api.ipynb index ff428dd..d0825e2 100644 --- a/notebooks/world-bank-api.ipynb +++ b/notebooks/world-bank-api.ipynb @@ -7,7 +7,7 @@ "tags": [] }, "source": [ - "# Indicators Example\n", + "# World Bank Indicators API Example\n", "\n", "> The following is an example of a [Jupyter notebook](https://jupyter.org) - a tutorial of how to retrieve data from the [World Bank Indicators API](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation) - that illustrates how to use computational content with the [template](https://worldbank.github.io/template). " ] @@ -41,13 +41,7 @@ "id": "fb8d2738-535e-4957-b82a-987891955a7f", "metadata": {}, "source": [ - "## Retrieve Data\n", - "\n", - "https://data.worldbank.org/indicator\n", - "\n", - "\n", - "https://databank.worldbank.org/reports.aspx?source=World-Development-Indicators\n", - "\n", + "## Data Retrieval\n", "\n", "In this example, we retrieve **Population, total** (`SP.POP.TOTL`) from the [World Bank Indicators](https://data.worldbank.org/indicator) for [BRICS](https://infobrics.org)." ] @@ -701,7 +695,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.12.1" }, "vscode": { "interpreter": { diff --git a/notebooks/world-bank-package.ipynb b/notebooks/world-bank-package.ipynb index 383aeae..993c335 100644 --- a/notebooks/world-bank-package.ipynb +++ b/notebooks/world-bank-package.ipynb @@ -7,9 +7,9 @@ "tags": [] }, "source": [ - "# Package Example\n", + "# `template` Package Example\n", "\n", - "> The following is an example of on how to use and distribute the source code of your project as a [Python package](https://packaging.python.org) using the template." + "> The following is an example of on how to use and distribute your project as a [Python package](https://packaging.python.org) using the example template. Remember mix and match to yout project's requirements. " ] }, { @@ -25,7 +25,7 @@ "id": "b4c0f3e8-7756-41bb-aa21-cc2eee5ff67f", "metadata": {}, "source": [ - "Unlike the [previous example](https://worldbank.github.io/template/notebooks/world-bank-api.html), where the source code was contained on the Jupyter notebok itself, we (re)use a Python package - the [datalab](https://github.com/worldbank/template/tree/main/src/datalab) Python package - which will let us (re)use any attributes and methods in the following example.\n", + "Unlike the [previous example](https://worldbank.github.io/template/notebooks/world-bank-api.html), where the source code was contained on the Jupyter notebok itself, we (re)use a Python package - the [template](https://github.com/worldbank/template/tree/main/src/template) Python package - which will let us (re)use any attributes and methods in the following example.\n", "\n", "Let's start by importing `WorldBankIndicatorsAPI`, a Python API wrapper class created to facilitate the usage of the [World Bank Indicators API](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation)." ] @@ -37,7 +37,7 @@ "metadata": {}, "outputs": [], "source": [ - "from datalab.indicators import WorldBankIndicatorsAPI" + "from template.indicators import WorldBankIndicatorsAPI" ] }, { @@ -78,14 +78,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "Help on method query in module datalab.indicators:\n", + "Help on method query in module template.indicators:\n", "\n", - "query(indicator, country: list = 'all', params: dict = {}) method of datalab.indicators.WorldBankIndicatorsAPI instance\n", + "query(indicator, country: list = 'all', params: dict = {}) method of template.indicators.WorldBankIndicatorsAPI instance\n", " Retrieve a response, valid JSON response or error, from the World Bank Indicators API.\n", - " \n", + "\n", " See also:\n", " https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation\n", - " \n", + "\n", " Parameters\n", " ----------\n", " indicator : str\n", @@ -94,7 +94,7 @@ " List of countries. The country name is converted to ISO 3166-1 alpha-3 country code.\n", " params : dict, optional\n", " World Bank API Indicator Query Strings.\n", - " \n", + "\n", " Returns\n", " -------\n", " pandas.core.frame.DataFrame\n", @@ -140,7 +140,7 @@ "id": "46662c1b-4c19-424b-8a61-f651cb486c5b", "metadata": {}, "source": [ - "**Voilà!** We just (re)used the [datalab](https://github.com/worldbank/template/tree/main/src/datalab) Python package in our example delegating the maintenance and logic, making the notebook easier to understand and reproduce. \n", + "**Voilà!** We just (re)used the [template](https://github.com/worldbank/template/tree/main/src/template) Python package in our example delegating the maintenance and logic, making the notebook easier to understand and reproduce. \n", "\n", "```{tip}\n", "In addition, the `template` makes any Python package automatically [pip installable](https://packaging.python.org/en/latest/tutorials/installing-packages/) and accessible to *anyone* and from *anywhere*!\n", @@ -174,7 +174,7 @@ "metadata": {}, "source": [ "```{caution}\n", - "The `datalab` Python package should be used for demonstration purposes only. For support, please see the [World Bank Indicators API Documentation](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation).\n", + "The `template` Python package should be used for demonstration purposes only. For support, please see the [World Bank Indicators API Documentation](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation).\n", "```" ] }, @@ -249,43 +249,43 @@ " \n", " \n", " 1960\n", - " 73092515\n", - " 667070000\n", - " 445954579\n", - " 119897000\n", - " 16520441\n", + " 73092515.0\n", + " 6.670700e+08\n", + " 4.459546e+08\n", + " 119897000.0\n", + " 16520441.0\n", " \n", " \n", " 1961\n", - " 75330008\n", - " 660330000\n", - " 456351876\n", - " 121236000\n", - " 16989464\n", + " 75330008.0\n", + " 6.603300e+08\n", + " 4.563519e+08\n", + " 121236000.0\n", + " 16989464.0\n", " \n", " \n", " 1962\n", - " 77599218\n", - " 665770000\n", - " 467024193\n", - " 122591000\n", - " 17503133\n", + " 77599218.0\n", + " 6.657700e+08\n", + " 4.670242e+08\n", + " 122591000.0\n", + " 17503133.0\n", " \n", " \n", " 1963\n", - " 79915555\n", - " 682335000\n", - " 477933619\n", - " 123960000\n", - " 18042215\n", + " 79915555.0\n", + " 6.823350e+08\n", + " 4.779336e+08\n", + " 123960000.0\n", + " 18042215.0\n", " \n", " \n", " 1964\n", - " 82262794\n", - " 698355000\n", - " 489059309\n", - " 125345000\n", - " 18603097\n", + " 82262794.0\n", + " 6.983550e+08\n", + " 4.890593e+08\n", + " 125345000.0\n", + " 18603097.0\n", " \n", " \n", " ...\n", @@ -296,80 +296,80 @@ " ...\n", " \n", " \n", - " 2017\n", - " 208504960\n", - " 1396215000\n", - " 1354195680\n", - " 144496739\n", - " 56641209\n", - " \n", - " \n", " 2018\n", - " 210166592\n", - " 1402760000\n", - " 1369003306\n", - " 144477859\n", - " 57339635\n", + " 210166592.0\n", + " 1.402760e+09\n", + " 1.369003e+09\n", + " 144477859.0\n", + " 57339635.0\n", " \n", " \n", " 2019\n", - " 211782878\n", - " 1407745000\n", - " 1383112050\n", - " 144406261\n", - " 58087055\n", + " 211782878.0\n", + " 1.407745e+09\n", + " 1.383112e+09\n", + " 144406261.0\n", + " 58087055.0\n", " \n", " \n", " 2020\n", - " 213196304\n", - " 1411100000\n", - " 1396387127\n", - " 144073139\n", - " 58801927\n", + " 213196304.0\n", + " 1.411100e+09\n", + " 1.396387e+09\n", + " 144073139.0\n", + " 58801927.0\n", " \n", " \n", " 2021\n", - " 214326223\n", - " 1412360000\n", - " 1407563842\n", - " 143449286\n", - " 59392255\n", + " 214326223.0\n", + " 1.412360e+09\n", + " 1.407564e+09\n", + " 144130482.0\n", + " 59392255.0\n", + " \n", + " \n", + " 2022\n", + " 215313498.0\n", + " 1.412175e+09\n", + " 1.417173e+09\n", + " 144236933.0\n", + " 59893885.0\n", " \n", " \n", "\n", - "

62 rows × 5 columns

\n", + "

63 rows × 5 columns

\n", "" ], "text/plain": [ - "country.value Brazil China India Russian Federation \\\n", - "date \n", - "1960 73092515 667070000 445954579 119897000 \n", - "1961 75330008 660330000 456351876 121236000 \n", - "1962 77599218 665770000 467024193 122591000 \n", - "1963 79915555 682335000 477933619 123960000 \n", - "1964 82262794 698355000 489059309 125345000 \n", - "... ... ... ... ... \n", - "2017 208504960 1396215000 1354195680 144496739 \n", - "2018 210166592 1402760000 1369003306 144477859 \n", - "2019 211782878 1407745000 1383112050 144406261 \n", - "2020 213196304 1411100000 1396387127 144073139 \n", - "2021 214326223 1412360000 1407563842 143449286 \n", + "country.value Brazil China India Russian Federation \\\n", + "date \n", + "1960 73092515.0 6.670700e+08 4.459546e+08 119897000.0 \n", + "1961 75330008.0 6.603300e+08 4.563519e+08 121236000.0 \n", + "1962 77599218.0 6.657700e+08 4.670242e+08 122591000.0 \n", + "1963 79915555.0 6.823350e+08 4.779336e+08 123960000.0 \n", + "1964 82262794.0 6.983550e+08 4.890593e+08 125345000.0 \n", + "... ... ... ... ... \n", + "2018 210166592.0 1.402760e+09 1.369003e+09 144477859.0 \n", + "2019 211782878.0 1.407745e+09 1.383112e+09 144406261.0 \n", + "2020 213196304.0 1.411100e+09 1.396387e+09 144073139.0 \n", + "2021 214326223.0 1.412360e+09 1.407564e+09 144130482.0 \n", + "2022 215313498.0 1.412175e+09 1.417173e+09 144236933.0 \n", "\n", "country.value South Africa \n", "date \n", - "1960 16520441 \n", - "1961 16989464 \n", - "1962 17503133 \n", - "1963 18042215 \n", - "1964 18603097 \n", + "1960 16520441.0 \n", + "1961 16989464.0 \n", + "1962 17503133.0 \n", + "1963 18042215.0 \n", + "1964 18603097.0 \n", "... ... \n", - "2017 56641209 \n", - "2018 57339635 \n", - "2019 58087055 \n", - "2020 58801927 \n", - "2021 59392255 \n", + "2018 57339635.0 \n", + "2019 58087055.0 \n", + "2020 58801927.0 \n", + "2021 59392255.0 \n", + "2022 59893885.0 \n", "\n", - "[62 rows x 5 columns]" + "[63 rows x 5 columns]" ] }, "execution_count": 6, @@ -404,9 +404,17 @@ { "data": { "text/html": [ - "
\n", - " \n", - " Loading BokehJS ...\n", + " \n", + "
\n", + " \n", + " Loading BokehJS ...\n", "
\n" ] }, @@ -415,8 +423,292 @@ }, { "data": { - "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\nconst JS_MIME_TYPE = 'application/javascript';\n const HTML_MIME_TYPE = 'text/html';\n const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n const CLASS_NAME = 'output_bokeh rendered_html';\n\n /**\n * Render data to the DOM node\n */\n function render(props, node) {\n const script = document.createElement(\"script\");\n node.appendChild(script);\n }\n\n /**\n * Handle when an output is cleared or removed\n */\n function handleClearOutput(event, handle) {\n const cell = handle.cell;\n\n const id = cell.output_area._bokeh_element_id;\n const server_id = cell.output_area._bokeh_server_id;\n // Clean up Bokeh references\n if (id != null && id in Bokeh.index) {\n Bokeh.index[id].model.document.clear();\n delete Bokeh.index[id];\n }\n\n if (server_id !== undefined) {\n // Clean up Bokeh references\n const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n cell.notebook.kernel.execute(cmd_clean, {\n iopub: {\n output: function(msg) {\n const id = msg.content.text.trim();\n if (id in Bokeh.index) {\n Bokeh.index[id].model.document.clear();\n delete Bokeh.index[id];\n }\n }\n }\n });\n // Destroy server and session\n const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n cell.notebook.kernel.execute(cmd_destroy);\n }\n }\n\n /**\n * Handle when a new output is added\n */\n function handleAddOutput(event, handle) {\n const output_area = handle.output_area;\n const output = handle.output;\n\n // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n return\n }\n\n const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n\n if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n // store reference to embed id on output_area\n output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n }\n if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n const bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n const script_attrs = bk_div.children[0].attributes;\n for (let i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n }\n\n function register_renderer(events, OutputArea) {\n\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n const toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[toinsert.length - 1]);\n element.append(toinsert);\n return toinsert\n }\n\n /* Handle when an output is cleared or removed */\n events.on('clear_output.CodeCell', handleClearOutput);\n events.on('delete.Cell', handleClearOutput);\n\n /* Handle when a new output is added */\n events.on('output_added.OutputArea', handleAddOutput);\n\n /**\n * Register the mime type and append_mime function with output_area\n */\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n /* Is output safe? */\n safe: true,\n /* Index of renderer in `output_area.display_order` */\n index: 0\n });\n }\n\n // register the mime type if in Jupyter Notebook environment and previously unregistered\n if (root.Jupyter !== undefined) {\n const events = require('base/js/events');\n const OutputArea = require('notebook/js/outputarea').OutputArea;\n\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n }\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n const NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"
    \\n\"+\n \"
  • re-rerun `output_notebook()` to attempt to load from CDN again, or
  • \\n\"+\n \"
  • use INLINE resources instead, as so:
  • \\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n const el = document.getElementById(\"1002\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\nif (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n const cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));", - "application/vnd.bokehjs_load.v0+json": "" + "application/javascript": [ + "(function(root) {\n", + " function now() {\n", + " return new Date();\n", + " }\n", + "\n", + " const force = true;\n", + "\n", + " if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n", + " root._bokeh_onload_callbacks = [];\n", + " root._bokeh_is_loading = undefined;\n", + " }\n", + "\n", + "const JS_MIME_TYPE = 'application/javascript';\n", + " const HTML_MIME_TYPE = 'text/html';\n", + " const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n", + " const CLASS_NAME = 'output_bokeh rendered_html';\n", + "\n", + " /**\n", + " * Render data to the DOM node\n", + " */\n", + " function render(props, node) {\n", + " const script = document.createElement(\"script\");\n", + " node.appendChild(script);\n", + " }\n", + "\n", + " /**\n", + " * Handle when an output is cleared or removed\n", + " */\n", + " function handleClearOutput(event, handle) {\n", + " function drop(id) {\n", + " const view = Bokeh.index.get_by_id(id)\n", + " if (view != null) {\n", + " view.model.document.clear()\n", + " Bokeh.index.delete(view)\n", + " }\n", + " }\n", + "\n", + " const cell = handle.cell;\n", + "\n", + " const id = cell.output_area._bokeh_element_id;\n", + " const server_id = cell.output_area._bokeh_server_id;\n", + "\n", + " // Clean up Bokeh references\n", + " if (id != null) {\n", + " drop(id)\n", + " }\n", + "\n", + " if (server_id !== undefined) {\n", + " // Clean up Bokeh references\n", + " const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n", + " cell.notebook.kernel.execute(cmd_clean, {\n", + " iopub: {\n", + " output: function(msg) {\n", + " const id = msg.content.text.trim()\n", + " drop(id)\n", + " }\n", + " }\n", + " });\n", + " // Destroy server and session\n", + " const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n", + " cell.notebook.kernel.execute(cmd_destroy);\n", + " }\n", + " }\n", + "\n", + " /**\n", + " * Handle when a new output is added\n", + " */\n", + " function handleAddOutput(event, handle) {\n", + " const output_area = handle.output_area;\n", + " const output = handle.output;\n", + "\n", + " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n", + " if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n", + " return\n", + " }\n", + "\n", + " const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n", + "\n", + " if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n", + " toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n", + " // store reference to embed id on output_area\n", + " output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n", + " }\n", + " if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n", + " const bk_div = document.createElement(\"div\");\n", + " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", + " const script_attrs = bk_div.children[0].attributes;\n", + " for (let i = 0; i < script_attrs.length; i++) {\n", + " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n", + " toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n", + " }\n", + " // store reference to server id on output_area\n", + " output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n", + " }\n", + " }\n", + "\n", + " function register_renderer(events, OutputArea) {\n", + "\n", + " function append_mime(data, metadata, element) {\n", + " // create a DOM node to render to\n", + " const toinsert = this.create_output_subarea(\n", + " metadata,\n", + " CLASS_NAME,\n", + " EXEC_MIME_TYPE\n", + " );\n", + " this.keyboard_manager.register_events(toinsert);\n", + " // Render to node\n", + " const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n", + " render(props, toinsert[toinsert.length - 1]);\n", + " element.append(toinsert);\n", + " return toinsert\n", + " }\n", + "\n", + " /* Handle when an output is cleared or removed */\n", + " events.on('clear_output.CodeCell', handleClearOutput);\n", + " events.on('delete.Cell', handleClearOutput);\n", + "\n", + " /* Handle when a new output is added */\n", + " events.on('output_added.OutputArea', handleAddOutput);\n", + "\n", + " /**\n", + " * Register the mime type and append_mime function with output_area\n", + " */\n", + " OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n", + " /* Is output safe? */\n", + " safe: true,\n", + " /* Index of renderer in `output_area.display_order` */\n", + " index: 0\n", + " });\n", + " }\n", + "\n", + " // register the mime type if in Jupyter Notebook environment and previously unregistered\n", + " if (root.Jupyter !== undefined) {\n", + " const events = require('base/js/events');\n", + " const OutputArea = require('notebook/js/outputarea').OutputArea;\n", + "\n", + " if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n", + " register_renderer(events, OutputArea);\n", + " }\n", + " }\n", + " if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n", + " root._bokeh_timeout = Date.now() + 5000;\n", + " root._bokeh_failed_load = false;\n", + " }\n", + "\n", + " const NB_LOAD_WARNING = {'data': {'text/html':\n", + " \"
\\n\"+\n", + " \"

\\n\"+\n", + " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", + " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", + " \"

\\n\"+\n", + " \"
    \\n\"+\n", + " \"
  • re-rerun `output_notebook()` to attempt to load from CDN again, or
  • \\n\"+\n", + " \"
  • use INLINE resources instead, as so:
  • \\n\"+\n", + " \"
\\n\"+\n", + " \"\\n\"+\n", + " \"from bokeh.resources import INLINE\\n\"+\n", + " \"output_notebook(resources=INLINE)\\n\"+\n", + " \"\\n\"+\n", + " \"
\"}};\n", + "\n", + " function display_loaded() {\n", + " const el = document.getElementById(\"de2eefd6-7f19-44f0-b075-2843144d5825\");\n", + " if (el != null) {\n", + " el.textContent = \"BokehJS is loading...\";\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " if (el != null) {\n", + " el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n", + " }\n", + " } else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(display_loaded, 100)\n", + " }\n", + " }\n", + "\n", + " function run_callbacks() {\n", + " try {\n", + " root._bokeh_onload_callbacks.forEach(function(callback) {\n", + " if (callback != null)\n", + " callback();\n", + " });\n", + " } finally {\n", + " delete root._bokeh_onload_callbacks\n", + " }\n", + " console.debug(\"Bokeh: all callbacks have finished\");\n", + " }\n", + "\n", + " function load_libs(css_urls, js_urls, callback) {\n", + " if (css_urls == null) css_urls = [];\n", + " if (js_urls == null) js_urls = [];\n", + "\n", + " root._bokeh_onload_callbacks.push(callback);\n", + " if (root._bokeh_is_loading > 0) {\n", + " console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", + " return null;\n", + " }\n", + " if (js_urls == null || js_urls.length === 0) {\n", + " run_callbacks();\n", + " return null;\n", + " }\n", + " console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", + " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", + "\n", + " function on_load() {\n", + " root._bokeh_is_loading--;\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", + " run_callbacks()\n", + " }\n", + " }\n", + "\n", + " function on_error(url) {\n", + " console.error(\"failed to load \" + url);\n", + " }\n", + "\n", + " for (let i = 0; i < css_urls.length; i++) {\n", + " const url = css_urls[i];\n", + " const element = document.createElement(\"link\");\n", + " element.onload = on_load;\n", + " element.onerror = on_error.bind(null, url);\n", + " element.rel = \"stylesheet\";\n", + " element.type = \"text/css\";\n", + " element.href = url;\n", + " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " for (let i = 0; i < js_urls.length; i++) {\n", + " const url = js_urls[i];\n", + " const element = document.createElement('script');\n", + " element.onload = on_load;\n", + " element.onerror = on_error.bind(null, url);\n", + " element.async = false;\n", + " element.src = url;\n", + " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", + " document.head.appendChild(element);\n", + " }\n", + " };\n", + "\n", + " function inject_raw_css(css) {\n", + " const element = document.createElement(\"style\");\n", + " element.appendChild(document.createTextNode(css));\n", + " document.body.appendChild(element);\n", + " }\n", + "\n", + " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.3.4.min.js\"];\n", + " const css_urls = [];\n", + "\n", + " const inline_js = [ function(Bokeh) {\n", + " Bokeh.set_log_level(\"info\");\n", + " },\n", + "function(Bokeh) {\n", + " }\n", + " ];\n", + "\n", + " function run_inline_js() {\n", + " if (root.Bokeh !== undefined || force === true) {\n", + " for (let i = 0; i < inline_js.length; i++) {\n", + " inline_js[i].call(root, root.Bokeh);\n", + " }\n", + "if (force === true) {\n", + " display_loaded();\n", + " }} else if (Date.now() < root._bokeh_timeout) {\n", + " setTimeout(run_inline_js, 100);\n", + " } else if (!root._bokeh_failed_load) {\n", + " console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n", + " root._bokeh_failed_load = true;\n", + " } else if (force !== true) {\n", + " const cell = $(document.getElementById(\"de2eefd6-7f19-44f0-b075-2843144d5825\")).parents('.cell').data().cell;\n", + " cell.output_area.append_execute_result(NB_LOAD_WARNING)\n", + " }\n", + " }\n", + "\n", + " if (root._bokeh_is_loading === 0) {\n", + " console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", + " run_inline_js();\n", + " } else {\n", + " load_libs(css_urls, js_urls, function() {\n", + " console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n", + " run_inline_js();\n", + " });\n", + " }\n", + "}(window));" + ], + "application/vnd.bokehjs_load.v0+json": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n const NB_LOAD_WARNING = {'data': {'text/html':\n \"
\\n\"+\n \"

\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"

\\n\"+\n \"
    \\n\"+\n \"
  • re-rerun `output_notebook()` to attempt to load from CDN again, or
  • \\n\"+\n \"
  • use INLINE resources instead, as so:
  • \\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n const el = document.getElementById(\"de2eefd6-7f19-44f0-b075-2843144d5825\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.3.4.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-3.3.4.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\nif (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n const cell = $(document.getElementById(\"de2eefd6-7f19-44f0-b075-2843144d5825\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" }, "metadata": {}, "output_type": "display_data" @@ -425,7 +717,7 @@ "data": { "text/html": [ "\n", - "
\n" + "
\n" ] }, "metadata": {}, @@ -433,12 +725,37 @@ }, { "data": { - "application/javascript": "(function(root) {\n function embed_document(root) {\n const docs_json = {\"27a5602b-a100-49a8-be71-4c1a30cbf69c\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1014\"}],\"center\":[{\"id\":\"1017\"},{\"id\":\"1021\"},{\"id\":\"1052\"}],\"left\":[{\"id\":\"1018\"}],\"renderers\":[{\"id\":\"1040\"},{\"id\":\"1058\"},{\"id\":\"1077\"},{\"id\":\"1098\"},{\"id\":\"1121\"}],\"title\":{\"id\":\"1004\"},\"toolbar\":{\"id\":\"1029\"},\"width\":700,\"x_range\":{\"id\":\"1006\"},\"x_scale\":{\"id\":\"1010\"},\"y_range\":{\"id\":\"1008\"},\"y_scale\":{\"id\":\"1012\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#fc8d59\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1119\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1113\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Population, total (World Bank)\",\"text_font_size\":\"12pt\"},\"id\":\"1004\",\"type\":\"Title\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#fee08b\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1097\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1014\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1017\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1114\",\"type\":\"Selection\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1094\"},\"glyph\":{\"id\":\"1095\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1097\"},\"nonselection_glyph\":{\"id\":\"1096\"},\"view\":{\"id\":\"1099\"}},\"id\":\"1098\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#99d594\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1056\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1138\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"Russian Federation\"},\"renderers\":[{\"id\":\"1098\"}]},\"id\":\"1116\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1139\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1027\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1070\",\"type\":\"Selection\"},{\"attributes\":{\"label\":{\"value\":\"Brazil\"},\"renderers\":[{\"id\":\"1040\"}]},\"id\":\"1053\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1069\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#99d594\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1057\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1090\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis\":{\"id\":\"1018\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1021\",\"type\":\"Grid\"},{\"attributes\":{\"label\":{\"value\":\"South Africa\"},\"renderers\":[{\"id\":\"1121\"}]},\"id\":\"1141\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1019\",\"type\":\"BasicTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#e6f598\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1075\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"tools\":[{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"},{\"id\":\"1027\"}]},\"id\":\"1029\",\"type\":\"Toolbar\"},{\"attributes\":{\"line_color\":\"#99d594\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1055\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"AllLabels\"},{\"attributes\":{\"overlay\":{\"id\":\"1028\"}},\"id\":\"1024\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"India\"},\"renderers\":[{\"id\":\"1077\"}]},\"id\":\"1093\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data\":{\"x\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"y\":[119897000,121236000,122591000,123960000,125345000,126745000,127468000,128196000,128928000,129664000,130404000,131155000,131909000,132669000,133432000,134200000,135147000,136100000,137060000,138027000,139010000,139941000,140823000,141668000,142745000,143858000,144894000,145908000,146857000,147721000,147969407,148394216,148538197,148458777,148407912,148375787,148160129,147915361,147670784,147214776,146596869,145976482,145306497,144648618,144067316,143518814,143049637,142805114,142742366,142785349,142849468,142960908,143201721,143506995,143819667,144096870,144342397,144496739,144477859,144406261,144073139,143449286]},\"selected\":{\"id\":\"1114\"},\"selection_policy\":{\"id\":\"1113\"}},\"id\":\"1094\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"1073\"}},\"id\":\"1078\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1091\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1044\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#e6f598\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1076\",\"type\":\"Line\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1028\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"source\":{\"id\":\"1054\"}},\"id\":\"1059\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#fee08b\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1096\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1073\"},\"glyph\":{\"id\":\"1074\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1076\"},\"nonselection_glyph\":{\"id\":\"1075\"},\"view\":{\"id\":\"1078\"}},\"id\":\"1077\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"y\":[16520441,16989464,17503133,18042215,18603097,19187194,19789771,20410677,21050540,21704214,22368306,23031441,23698507,24382513,25077016,25777964,26480300,27199838,27943445,28697014,29463549,30232561,31022417,31865176,32768207,33752964,34877834,36119333,37393853,38668684,39877570,40910959,41760755,42525440,43267982,43986084,44661603,45285048,45852166,46364681,46813266,47229714,47661514,48104048,48556071,49017147,49491756,49996094,50565812,51170779,51784921,52443325,53145033,53873616,54729551,55876504,56422274,56641209,57339635,58087055,58801927,59392255]},\"selected\":{\"id\":\"1139\"},\"selection_policy\":{\"id\":\"1138\"}},\"id\":\"1117\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1094\"}},\"id\":\"1099\",\"type\":\"CDSView\"},{\"attributes\":{\"line_color\":\"#fc8d59\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1118\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"y\":[73092515,75330008,77599218,79915555,82262794,84623747,86979283,89323288,91659246,94000381,96369875,98766288,101194394,103666904,106167372,108700515,111286504,113939886,116664382,119447303,122288383,125168060,128065095,130977370,133888775,136783180,139643355,142466264,145253973,148003411,150706446,153336445,155900790,158440875,160980472,163515328,166037122,168546707,171039804,173486281,175873720,178211881,180476685,182629278,184722043,186797334,188820682,190779453,192672317,194517549,196353492,198185302,199977707,201721767,203459650,205188205,206859578,208504960,210166592,211782878,213196304,214326223]},\"selected\":{\"id\":\"1050\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1036\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"#e6f598\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1074\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":\"#fee08b\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1095\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#fc8d59\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1120\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1054\"},\"glyph\":{\"id\":\"1055\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1057\"},\"nonselection_glyph\":{\"id\":\"1056\"},\"view\":{\"id\":\"1059\"}},\"id\":\"1058\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"y\":[445954579,456351876,467024193,477933619,489059309,500114346,510992617,521987069,533431909,545314670,557501301,569999178,582837973,596107483,609721951,623524219,637451448,651685628,666267760,681248383,696828385,712869298,729169466,745826546,762895156,780242084,797878993,815716125,833729681,852012673,870452165,888941756,907574049,926351297,945261958,964279129,983281218,1002335230,1021434576,1040500054,1059633675,1078970907,1098313039,1117415123,1136264583,1154638713,1172373788,1189691809,1206734806,1223640160,1240613620,1257621191,1274487215,1291132063,1307246509,1322866505,1338636340,1354195680,1369003306,1383112050,1396387127,1407563842]},\"selected\":{\"id\":\"1091\"},\"selection_policy\":{\"id\":\"1090\"}},\"id\":\"1073\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1036\"}},\"id\":\"1041\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#3288bd\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1038\",\"type\":\"Line\"},{\"attributes\":{\"axis_label\":\"Population, total (in millions)\",\"coordinates\":null,\"formatter\":{\"id\":\"1044\"},\"group\":null,\"major_label_policy\":{\"id\":\"1045\"},\"ticker\":{\"id\":\"1019\"}},\"id\":\"1018\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#3288bd\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1039\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1117\"}},\"id\":\"1122\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1036\"},\"glyph\":{\"id\":\"1037\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1039\"},\"nonselection_glyph\":{\"id\":\"1038\"},\"view\":{\"id\":\"1041\"}},\"id\":\"1040\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1117\"},\"glyph\":{\"id\":\"1118\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1120\"},\"nonselection_glyph\":{\"id\":\"1119\"},\"view\":{\"id\":\"1122\"}},\"id\":\"1121\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"click_policy\":\"mute\",\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1053\"},{\"id\":\"1072\"},{\"id\":\"1093\"},{\"id\":\"1116\"},{\"id\":\"1141\"}],\"location\":\"right\"},\"id\":\"1052\",\"type\":\"Legend\"},{\"attributes\":{\"axis_label\":\"Year\",\"coordinates\":null,\"formatter\":{\"id\":\"1047\"},\"group\":null,\"major_label_policy\":{\"id\":\"1048\"},\"ticker\":{\"id\":\"1015\"}},\"id\":\"1014\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"x\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\"],\"y\":[667070000,660330000,665770000,682335000,698355000,715185000,735400000,754550000,774510000,796025000,818315000,841105000,862030000,881940000,900350000,916395000,930685000,943455000,956165000,969005000,981235000,993885000,1008630000,1023310000,1036825000,1051040000,1066790000,1084035000,1101630000,1118650000,1135185000,1150780000,1164970000,1178440000,1191835000,1204855000,1217550000,1230075000,1241935000,1252735000,1262645000,1271850000,1280400000,1288400000,1296075000,1303720000,1311020000,1317885000,1324655000,1331260000,1337705000,1345035000,1354190000,1363240000,1371860000,1379860000,1387790000,1396215000,1402760000,1407745000,1411100000,1412360000]},\"selected\":{\"id\":\"1070\"},\"selection_policy\":{\"id\":\"1069\"}},\"id\":\"1054\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"#3288bd\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"China\"},\"renderers\":[{\"id\":\"1058\"}]},\"id\":\"1072\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1012\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1015\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n const render_items = [{\"docid\":\"27a5602b-a100-49a8-be71-4c1a30cbf69c\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"756bcecf-5d05-4b33-b3f9-817acf206cf6\"}}];\n root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n }\n if (root.Bokeh !== undefined) {\n embed_document(root);\n } else {\n let attempts = 0;\n const timer = setInterval(function(root) {\n if (root.Bokeh !== undefined) {\n clearInterval(timer);\n embed_document(root);\n } else {\n attempts++;\n if (attempts > 100) {\n clearInterval(timer);\n console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n }\n }\n }, 10, root)\n }\n})(window);", + "application/javascript": [ + "(function(root) {\n", + " function embed_document(root) {\n", + " const docs_json = {\"83a8787d-591a-4cbc-a615-08bea756a017\":{\"version\":\"3.3.4\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"Figure\",\"id\":\"p1001\",\"attributes\":{\"width\":700,\"x_range\":{\"type\":\"object\",\"name\":\"DataRange1d\",\"id\":\"p1002\"},\"y_range\":{\"type\":\"object\",\"name\":\"DataRange1d\",\"id\":\"p1003\"},\"x_scale\":{\"type\":\"object\",\"name\":\"LinearScale\",\"id\":\"p1011\"},\"y_scale\":{\"type\":\"object\",\"name\":\"LinearScale\",\"id\":\"p1012\"},\"title\":{\"type\":\"object\",\"name\":\"Title\",\"id\":\"p1004\",\"attributes\":{\"text\":\"Population, total (World Bank)\",\"text_font_size\":\"12pt\"}},\"renderers\":[{\"type\":\"object\",\"name\":\"GlyphRenderer\",\"id\":\"p1040\",\"attributes\":{\"data_source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1034\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1035\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1036\"},\"data\":{\"type\":\"map\",\"entries\":[[\"x\",{\"type\":\"ndarray\",\"array\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"shape\":[63],\"dtype\":\"object\",\"order\":\"little\"}],[\"y\",{\"type\":\"ndarray\",\"array\":{\"type\":\"bytes\",\"data\":\"AAAAjDZtkUEAAABgx/WRQQAAAMhHgJJBAAAAjKgNk0EAAAAo7JyTQQAAAAwGLZRBAAAATMu8lEEAAABg3EuVQQAAALhv2pVBAAAA9FNplkEAAABM8/mWQQAAAEA3jJdBAAAAaGogmEEAAABgU7eYQQAAADDxT5lBAAAAjI3qmUEAAACgY4iaQQAAALhWKptBAAAA+KDQm0EAAAAcfHqcQQAAAPzjJ51BAAAA8KbXnUEAAAAceYieQQAAAGg5Op9BAAAAHOzrn0EAAACYSk6gQQAAALaTpaBBAAAAsLn7oEEAAACqzFChQQAAAKa0pKFBAAAAHDL3oUEAAAD6dEeiQQAAAOy2laJBAAAAVjvjokEAAADwuzCjQQAAAIAXfqNBAAAABA3Lo0EAAAAmoxekQQAAAHi4Y6RBAAAAkmGupEEAAABwPfekQQAAAFKYPqVBAAAAGraDpUEAAAA8Z8WlQQAAAPZEBaZBAAAALJpEpkEAAACUWYKmQQAAAHogvqZBAAAAeuT3pkEAAABaNDCnQQAAAKg7aKdBAAAArCKgp0EAAADW1danQQAAAE4PDKhBAAAAhBhBqEEAAADa2HWoQQAAAHTaqKhBAAAAABHbqEEAAACAxg2pQQAAALwZP6lBAAAAIDxqqUEAAACet4ypQQAAALTYqqlB\"},\"shape\":[63],\"dtype\":\"float64\",\"order\":\"little\"}]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1041\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1042\"}}},\"glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1037\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#3288bd\",\"line_width\":2}},\"nonselection_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1038\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#3288bd\",\"line_alpha\":0.1,\"line_width\":2}},\"muted_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1039\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#3288bd\",\"line_alpha\":0.2,\"line_width\":2}}}},{\"type\":\"object\",\"name\":\"GlyphRenderer\",\"id\":\"p1051\",\"attributes\":{\"data_source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1045\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1046\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1047\"},\"data\":{\"type\":\"map\",\"entries\":[[\"x\",{\"type\":\"ndarray\",\"array\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"shape\":[63],\"dtype\":\"object\",\"order\":\"little\"}],[\"y\",{\"type\":\"ndarray\",\"array\":{\"type\":\"bytes\",\"data\":\"AAAAGFfhw0EAAAAI663DQQAAAAhs18NBAAAAjM1VxEEAAACcBtDEQQAAALRtUMVBAAAAIKjqxUEAAAB4wnzGQQAAANgKFcdBAAAAVDC5x0EAAAB8P2PIQQAAADQfEclBAAAAWMSwyUEAAAAQq0jKQQAAABgg1cpBAAAA/IlPy0EAAAAkkLzLQQAAAIz9HcxBAAAAxPV+zEEAAADk6+DMQQAAAJw6Ps1BAAAApL2ezUEAAAB4PA/OQQAAAFg8f85BAAAA1FjmzkEAAACAzFLPQQAAADj2ys9BAAAA7kMn0EEAAACMYmrQQQAAAKRPq9BBAAAAGmPq0EEAAACY4CXRQQAAAAQCXNFBAAAAUGSP0UEAAABefcLRQQAAADYo9NFBAAAArJUk0kEAAAAeXVTSQQAAACabgdJBAAAABs6q0kEAAADCm9DSQQAAAAS589JBAAAAoFYU00EAAAAg2zLTQQAAAD4iUNNBAAAAEExt00EAAAD4JInTQQAAABJVo9NBAAAAZii900EAAACYWtbTQQAAAIrw7tNBAAAAvuYK1EEAAAAs0y3UQQAAABBZUNRBAAAACDtx1EEAAACIv4/UQQAAAKz/rdRBAAAANiPO1EEAAADQGufUQQAAAPoe+tRBAAAAWOsG1UEAAADQuQvVQQAAACYFC9VB\"},\"shape\":[63],\"dtype\":\"float64\",\"order\":\"little\"}]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1052\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1053\"}}},\"glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1048\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#99d594\",\"line_width\":2}},\"nonselection_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1049\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#99d594\",\"line_alpha\":0.1,\"line_width\":2}},\"muted_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1050\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#99d594\",\"line_alpha\":0.2,\"line_width\":2}}}},{\"type\":\"object\",\"name\":\"GlyphRenderer\",\"id\":\"p1061\",\"attributes\":{\"data_source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1055\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1056\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1057\"},\"data\":{\"type\":\"map\",\"entries\":[[\"x\",{\"type\":\"ndarray\",\"array\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"shape\":[63],\"dtype\":\"object\",\"order\":\"little\"}],[\"y\",{\"type\":\"ndarray\",\"array\":{\"type\":\"bytes\",\"data\":\"AAAAE7qUukEAAACEYDO7QQAAAEE51rtBAAAAM7B8vEEAAADtcya9QQAAAKojz71BAAAA6SB1vkEAAAD94xy/QQAAAGWGy79BAAAAt2tAwEEAAIC6ZZ3AQQAAAKW//MBBAACAarNewUEAAIBt8MPBQQAAgC/PK8JBAACAvRyVwkEAAABcXv/CQQAAAH73a8NBAAAAODjbw0EAAIA/g03EQQAAgPBgxMRBAAAA2cI+xUEAAAAdH7vFQQAAAHk0OsZBAAAAmm28xkEAAABSxkDHQQAAgGhVx8dBAACAjmtPyEEAAIBI2tjIQQAAgEBXZMlBAACA4gXxyUEAAABeFn7KQQAAgJA9DMtBAACA4H+by0EAAADDxivMQQAAgKzdvMxBAAAAIddNzUEAAAD/Nd/NQQAAAGjtcM5BAAAAq2ICz0EAAIAFXZTPQQAAwIbyE9BBAADAU7td0EEAAMC0mabQQQAAwGGB7tBBAABA3pg00UEAAABHQHjRQQAAQGhQutFBAACA9VP70UEAAAAY0TvSQQAAAL2QfNJBAADAsXG90kEAAMBryP3SQQAAwCdHPdNBAABA679600EAAEDSVbbTQQAAAA1+8tNBAAAAuNgt1EEAAIBKVWbUQQAAgFwnnNRBAADATcvO1EEAAIAQbvnUQQAAQC0WHtVB\"},\"shape\":[63],\"dtype\":\"float64\",\"order\":\"little\"}]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1062\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1063\"}}},\"glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1058\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#e6f598\",\"line_width\":2}},\"nonselection_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1059\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#e6f598\",\"line_alpha\":0.1,\"line_width\":2}},\"muted_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1060\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#e6f598\",\"line_alpha\":0.2,\"line_width\":2}}}},{\"type\":\"object\",\"name\":\"GlyphRenderer\",\"id\":\"p1071\",\"attributes\":{\"data_source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1065\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1066\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1067\"},\"data\":{\"type\":\"map\",\"entries\":[[\"x\",{\"type\":\"ndarray\",\"array\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"shape\":[63],\"dtype\":\"object\",\"order\":\"little\"}],[\"y\",{\"type\":\"ndarray\",\"array\":{\"type\":\"bytes\",\"data\":\"AAAAoO6VnEEAAACAqOecQQAAAGBcOp1BAAAAAOuNnUEAAACgc+KdQQAAAKDmN55BAAAAgAdknkEAAACAdpCeQQAAAAAkvZ5BAAAAABDqnkEAAACAOhefQQAAAOAQRZ9BAAAAIBZzn0EAAAAgeaGfQQAAAAAL0J9BAAAAAOv+n0EAAADwWxygQQAAAEBxOaBBAAAAQL1WoEEAAADwP3SgQQAAAKA/kqBBAAAAEKmuoEEAAACwk8mgQQAAAEBd46BBAAAAUDsEoUEAAACgMiahQQAAAGDQRaFBAAAAQMJkoUEAAABQuIGhQQAAAFAWnKFBAAAA/qqjoUEAAADQobChQQAAAKoGtaFBAAAAMpqyoUEAAADQDLGhQQAAANYRsKFBAAAAAn2poUEAAADCBKKhQQAAAACOmqFBAAAAcKOMoUEAAAAKyHmhQQAAAETZZqFBAAAAAmdSoUEAAABUUz6hQQAAAOiVLKFBAAAAvNgboUEAAABKhw2hQQAAAPQQBqFBAAAAvCYEoUEAAACKdgWhQQAAAHhrB6FBAAAAGNIKoUEAAAByKxKhQQAAAGZ8G6FBAAAAJgcloUEAAADMfC2hQQAAAPr6NKFBAAAAxrA5oUEAAABGHTmhQQAAAOrtNqFBAAAAZsMsoUEAAABkgy6hQQAAAArDMaFB\"},\"shape\":[63],\"dtype\":\"float64\",\"order\":\"little\"}]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1072\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1073\"}}},\"glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1068\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fee08b\",\"line_width\":2}},\"nonselection_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1069\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fee08b\",\"line_alpha\":0.1,\"line_width\":2}},\"muted_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1070\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fee08b\",\"line_alpha\":0.2,\"line_width\":2}}}},{\"type\":\"object\",\"name\":\"GlyphRenderer\",\"id\":\"p1081\",\"attributes\":{\"data_source\":{\"type\":\"object\",\"name\":\"ColumnDataSource\",\"id\":\"p1075\",\"attributes\":{\"selected\":{\"type\":\"object\",\"name\":\"Selection\",\"id\":\"p1076\",\"attributes\":{\"indices\":[],\"line_indices\":[]}},\"selection_policy\":{\"type\":\"object\",\"name\":\"UnionRenderers\",\"id\":\"p1077\"},\"data\":{\"type\":\"map\",\"entries\":[[\"x\",{\"type\":\"ndarray\",\"array\":[\"1960\",\"1961\",\"1962\",\"1963\",\"1964\",\"1965\",\"1966\",\"1967\",\"1968\",\"1969\",\"1970\",\"1971\",\"1972\",\"1973\",\"1974\",\"1975\",\"1976\",\"1977\",\"1978\",\"1979\",\"1980\",\"1981\",\"1982\",\"1983\",\"1984\",\"1985\",\"1986\",\"1987\",\"1988\",\"1989\",\"1990\",\"1991\",\"1992\",\"1993\",\"1994\",\"1995\",\"1996\",\"1997\",\"1998\",\"1999\",\"2000\",\"2001\",\"2002\",\"2003\",\"2004\",\"2005\",\"2006\",\"2007\",\"2008\",\"2009\",\"2010\",\"2011\",\"2012\",\"2013\",\"2014\",\"2015\",\"2016\",\"2017\",\"2018\",\"2019\",\"2020\",\"2021\",\"2022\"],\"shape\":[63],\"dtype\":\"object\",\"order\":\"little\"}],[\"y\",{\"type\":\"ndarray\",\"array\":{\"type\":\"bytes\",\"data\":\"AAAAIJ+Cb0EAAACA0TNwQQAAANA5sXBBAAAAcNY0cUEAAACQxb1xQQAAAKBfTHJBAAAAsHzfckEAAABQE3dzQQAAAMBKE3RBAAAAYOGydEEAAAAgA1V1QQAAABDp9nVBAAAAsMSZdkEAAAAQw0B3QQAAAIBR6ndBAAAAwHKVeEEAAADA6kB5QQAAAOCV8HlBAAAAUCGmekEAAABgG157QQAAANA/GXxBAAAAEP/UfEEAAAAQ1ZV9QQAAAICVY35BAAAA8AxAf0EAAAAgPBiAQQAAAFCMoYBBAAAAKBk5gUEAAADordSBQQAAAGBMcIJBAAAAEN4Dg0EAAAB4A4KDQQAAAJi/6YNBAAAAABhHhEEAAABwvKGEQQAAACBl+YRBAAAAGNtLhUEAAADA9ZeFQQAAADAw3YVBAAAASMAbhkEAAACQglKGQQAAAJBYhYZBAAAAUA66hkEAAACAE/CGQQAAADhBJ4dBAAAA2Ilfh0EAAABgeZmHQQAAAPAJ14dBAAAAoJUciEEAAADYbmaIQQAAAMhmsYhBAAAA6MUBiUEAAABIbleJQQAAAIBesIlBAAAAeNoYikEAAADA3KSKQQAAABB854pBAAAAyDUCi0EAAACYd1eLQQAAAHi0sotBAAAAOPgJjEEAAAD4B1KMQQAAAOhDj4xB\"},\"shape\":[63],\"dtype\":\"float64\",\"order\":\"little\"}]]}}},\"view\":{\"type\":\"object\",\"name\":\"CDSView\",\"id\":\"p1082\",\"attributes\":{\"filter\":{\"type\":\"object\",\"name\":\"AllIndices\",\"id\":\"p1083\"}}},\"glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1078\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fc8d59\",\"line_width\":2}},\"nonselection_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1079\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fc8d59\",\"line_alpha\":0.1,\"line_width\":2}},\"muted_glyph\":{\"type\":\"object\",\"name\":\"Line\",\"id\":\"p1080\",\"attributes\":{\"x\":{\"type\":\"field\",\"field\":\"x\"},\"y\":{\"type\":\"field\",\"field\":\"y\"},\"line_color\":\"#fc8d59\",\"line_alpha\":0.2,\"line_width\":2}}}}],\"toolbar\":{\"type\":\"object\",\"name\":\"Toolbar\",\"id\":\"p1010\",\"attributes\":{\"tools\":[{\"type\":\"object\",\"name\":\"PanTool\",\"id\":\"p1023\"},{\"type\":\"object\",\"name\":\"WheelZoomTool\",\"id\":\"p1024\",\"attributes\":{\"renderers\":\"auto\"}},{\"type\":\"object\",\"name\":\"BoxZoomTool\",\"id\":\"p1025\",\"attributes\":{\"overlay\":{\"type\":\"object\",\"name\":\"BoxAnnotation\",\"id\":\"p1026\",\"attributes\":{\"syncable\":false,\"level\":\"overlay\",\"visible\":false,\"left\":{\"type\":\"number\",\"value\":\"nan\"},\"right\":{\"type\":\"number\",\"value\":\"nan\"},\"top\":{\"type\":\"number\",\"value\":\"nan\"},\"bottom\":{\"type\":\"number\",\"value\":\"nan\"},\"left_units\":\"canvas\",\"right_units\":\"canvas\",\"top_units\":\"canvas\",\"bottom_units\":\"canvas\",\"line_color\":\"black\",\"line_alpha\":1.0,\"line_width\":2,\"line_dash\":[4,4],\"fill_color\":\"lightgrey\",\"fill_alpha\":0.5}}}},{\"type\":\"object\",\"name\":\"SaveTool\",\"id\":\"p1031\"},{\"type\":\"object\",\"name\":\"ResetTool\",\"id\":\"p1032\"},{\"type\":\"object\",\"name\":\"HelpTool\",\"id\":\"p1033\"}]}},\"left\":[{\"type\":\"object\",\"name\":\"LinearAxis\",\"id\":\"p1018\",\"attributes\":{\"ticker\":{\"type\":\"object\",\"name\":\"BasicTicker\",\"id\":\"p1019\",\"attributes\":{\"mantissas\":[1,2,5]}},\"formatter\":{\"type\":\"object\",\"name\":\"BasicTickFormatter\",\"id\":\"p1020\"},\"axis_label\":\"Population, total (in millions)\",\"major_label_policy\":{\"type\":\"object\",\"name\":\"AllLabels\",\"id\":\"p1021\"}}}],\"below\":[{\"type\":\"object\",\"name\":\"LinearAxis\",\"id\":\"p1013\",\"attributes\":{\"ticker\":{\"type\":\"object\",\"name\":\"BasicTicker\",\"id\":\"p1014\",\"attributes\":{\"mantissas\":[1,2,5]}},\"formatter\":{\"type\":\"object\",\"name\":\"BasicTickFormatter\",\"id\":\"p1015\"},\"axis_label\":\"Year\",\"major_label_policy\":{\"type\":\"object\",\"name\":\"AllLabels\",\"id\":\"p1016\"}}}],\"center\":[{\"type\":\"object\",\"name\":\"Grid\",\"id\":\"p1017\",\"attributes\":{\"axis\":{\"id\":\"p1013\"}}},{\"type\":\"object\",\"name\":\"Grid\",\"id\":\"p1022\",\"attributes\":{\"dimension\":1,\"axis\":{\"id\":\"p1018\"}}},{\"type\":\"object\",\"name\":\"Legend\",\"id\":\"p1043\",\"attributes\":{\"location\":\"right\",\"click_policy\":\"mute\",\"items\":[{\"type\":\"object\",\"name\":\"LegendItem\",\"id\":\"p1044\",\"attributes\":{\"label\":{\"type\":\"value\",\"value\":\"Brazil\"},\"renderers\":[{\"id\":\"p1040\"}]}},{\"type\":\"object\",\"name\":\"LegendItem\",\"id\":\"p1054\",\"attributes\":{\"label\":{\"type\":\"value\",\"value\":\"China\"},\"renderers\":[{\"id\":\"p1051\"}]}},{\"type\":\"object\",\"name\":\"LegendItem\",\"id\":\"p1064\",\"attributes\":{\"label\":{\"type\":\"value\",\"value\":\"India\"},\"renderers\":[{\"id\":\"p1061\"}]}},{\"type\":\"object\",\"name\":\"LegendItem\",\"id\":\"p1074\",\"attributes\":{\"label\":{\"type\":\"value\",\"value\":\"Russian Federation\"},\"renderers\":[{\"id\":\"p1071\"}]}},{\"type\":\"object\",\"name\":\"LegendItem\",\"id\":\"p1084\",\"attributes\":{\"label\":{\"type\":\"value\",\"value\":\"South Africa\"},\"renderers\":[{\"id\":\"p1081\"}]}}]}}]}}]}};\n", + " const render_items = [{\"docid\":\"83a8787d-591a-4cbc-a615-08bea756a017\",\"roots\":{\"p1001\":\"f6c53deb-6dcf-46cb-8206-c2d2bdca531a\"},\"root_ids\":[\"p1001\"]}];\n", + " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", + " }\n", + " if (root.Bokeh !== undefined) {\n", + " embed_document(root);\n", + " } else {\n", + " let attempts = 0;\n", + " const timer = setInterval(function(root) {\n", + " if (root.Bokeh !== undefined) {\n", + " clearInterval(timer);\n", + " embed_document(root);\n", + " } else {\n", + " attempts++;\n", + " if (attempts > 100) {\n", + " clearInterval(timer);\n", + " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", + " }\n", + " }\n", + " }, 10, root)\n", + " }\n", + "})(window);" + ], "application/vnd.bokehjs_exec.v0+json": "" }, "metadata": { "application/vnd.bokehjs_exec.v0+json": { - "id": "1003" + "id": "p1001" } }, "output_type": "display_data" @@ -495,7 +812,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.1" }, "vscode": { "interpreter": { diff --git a/pyproject.toml b/pyproject.toml index db59961..30fef0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,15 @@ [build-system] -requires = ["setuptools>=61.0.0"] +requires = ["setuptools>=64.0.0", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" [project] -name = "datalab" +name = "template" dynamic = ["version"] -description = "An Python exampe package from the World Bank Data Lab" +description = "A template Python package from the World Bank Data Lab" readme = { file = "README.md", content-type = "text/markdown" } license = { file = "LICENSE" } -keywords = ["template", "reproducible research"] +keywords = ["template", "reproducibility"] authors = [{ name = "Development Data Group", email = "datalab@worldbank.org" }] -maintainers = [ - { name = "Gabriel Stefanini Vicente", email = "gvicente@worldbank.org" }, -] classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", @@ -26,18 +23,17 @@ classifiers = [ "Operating System :: OS Independent", ] requires-python = ">=3.7" -dependencies = ["requests>=2.28.1", "pycountry>=22.3.5"] +dependencies = ["requests>=2.28.1", "pandas>=2", "pycountry>=22.3.5"] [project.optional-dependencies] docs = [ - "docutils==0.17.1", # https://jupyterbook.org/en/stable/content/citations.html?highlight=docutils#citations-and-bibliographies + "docutils==0.17.1", # https://jupyterbook.org/en/stable/content/citations.html?highlight=docutils#citations-and-bibliographies "jupyter-book >=1,<2", ] -notebook = ["notebook>=6.5.2"] [project.urls] "Homepage" = "https://github.com/worldbank/template" "Bug Reports" = "https://github.com/worldbank/template/issues" "Source" = "https://github.com/worldbank/template" -[tool.setuptools.dynamic] -version = { attr = "datalab.__version__" } +[tool.setuptools_scm] +write_to = "src/template/_version.py" diff --git a/src/datalab/VERSION b/src/datalab/VERSION deleted file mode 100644 index 6e8bf73..0000000 --- a/src/datalab/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.0 diff --git a/src/datalab/__init__.py b/src/datalab/__init__.py deleted file mode 100644 index 67adea5..0000000 --- a/src/datalab/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from pathlib import Path - -__version__ = (Path(__file__).parent / "VERSION").read_text().strip() diff --git a/src/template/__init__.py b/src/template/__init__.py new file mode 100644 index 0000000..a535a10 --- /dev/null +++ b/src/template/__init__.py @@ -0,0 +1,7 @@ +from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version("datalab") +except PackageNotFoundError: + # package is not installed + pass diff --git a/src/datalab/indicators.py b/src/template/indicators.py similarity index 100% rename from src/datalab/indicators.py rename to src/template/indicators.py