==========================
eea.jupyter
==========================
.. image:: https://ci.eionet.europa.eu/buildStatus/icon?job=eea/eea.jupyter/develop
:target: https://ci.eionet.europa.eu/job/eea/job/eea.jupyter/job/develop/display/redirect
:alt: Develop
.. image:: https://ci.eionet.europa.eu/buildStatus/icon?job=eea/eea.jupyter/master
:target: https://ci.eionet.europa.eu/job/eea/job/eea.jupyter/job/master/display/redirect
:alt: Master
The eea.jupyter is a jupyter utility package for EEA.
.. contents::
Installation
============
.. code-block:: console
pip install eea.jupyter
Usage
=====
.. code-block:: python
from eea.jupyter import upload_plotly
Uploads or creates a `Chart (interactive)` to a specified `url`. This function accepts any number of keyword arguments.
Parameters:
- :code:`url` (required): The URL of the visualization to be updated or created, e.g. :code:`https://eea.europa.eu/en/sandbox/chart-1`. Default: :code:`None`
- :code:`fig` (required): The figure to be used as part of the visualization. Can accept a :code:`plotly.graph_objs.Figure` or a :code:`dict`. Default: :code:`None`
- :code:`api_url` (optional): The base URL of the plone API, e.g., :code:`https://eea.europa.eu/admin/++api++`. Default: :code:`/++api++` concatenated to the hostname of the visualization URL, e.g.: if the :code:`url` is :code:`https://biodiversity.eea.europa.eu/en/sandbox/chart-1` then the default value for :code:`api_url` will be :code:`https://biodiversity.eea.europa.eu/admin/++api++`
- :code:`auth_provider` (optional): Provider to be used for authentication. Allowed values: `basic`, `microsoft`. Default: `basic`
- :code:`auth_token` (optional): Token to be used instead of allways authenticating. Default: :code:`None`
- :code:`__ac__key` (optional): Key to be used in cookies if :code:`microsoft` auth_provider is used. Default: :code:`__ac`
- :code:`**metadata` (optional): Any :code:`Chart (interactive)` metadata desired to be customized, e.g., `title`, `description`, `topics`
**Example 1**: how to use it with basic authentication
.. code-block:: python
# Cell 1 will have some logic to generate a fig
# Cell 2
from eea.jupyter import upload_plotly
url = "https://www.eea.europa.eu/en/sandbox/miu-test/chart-1"
metadata = {
"title": "Chart 1 example",
"description": "This exemplifies how to use upload_plotly"
}
upload_plotly(url=url, fig=fig, **metadata)
In this example you specify the visualization that you want to update, if it already exists, or where you want to create it. In case the visualization doesn't exists it will be created inside of :code:`https://www.eea.europa.eu/en/sandbox/miu-test` with the id of :code:`chart-1`.
After calling :code:`upload_plotly` you will be prompted with :code:`username` and :code:`password` inputs.
**Example 2**: how to use it with microsoft authentication
.. code-block:: python
# Cell 1 will have some logic to generate a fig
# Cell 2
from eea.jupyter import upload_plotly
url = "https://www.eea.europa.eu/en/sandbox/miu-test/chart-1"
metadata = {
"title": "Chart 1 example",
"description": "This exemplifies how to use upload_plotly"
}
upload_plotly(url=url, fig=fig, auth_provider="microsoft", __ac__key="__ac__eea", **metadata)
In this example you specify the microsoft auth_provider and also the key of __ac.
After calling :code:`upload_plotly` you will be prompted with :code:`auth_token` input which expects a valid :code:`__ac` token. To get the :code:`__ac` you will need to authenticate on https://www.eea.europa.eu/admin and get the value of :code:`__ac__eea` cookie. You can use a cookie chrome extension to retrive the value of the cookie.
**Example 3**: initialize :code:`auth_token` so that you can pass the authentication input
.. code-block:: python
# Cell 1 will have some logic to generate a fig
# Cell 2
auth_token = input()
# Cell 3
from eea.jupyter import upload_plotly
url = "https://www.eea.europa.eu/en/sandbox/miu-test/chart-1"
metadata = {
"title": "Chart 1 example",
"description": "This exemplifies how to use upload_plotly"
}
upload_plotly(url=url, fig=fig, auth_provider="microsoft", __ac__key="__ac__eea", auth_token=auth_token, **metadata)
In this example, firstly, you will be prompted with specifying the value of :code:`auth_token`, which will then be added as a parameter to :code:`upload_plotly`. This allows you to initialize the value of :code:`auth_token` only once, then you can run cell 3 as many times as you like.
Same behaviour regardless of the :code:`auth_provider`.
**Example 4**: passing multiple types of metadata
.. code-block:: python
# Cell 1 will have some logic to generate a fig
# Cell 2
auth_token = input()
# Cell 3
from eea.jupyter import upload_plotly
url = "https://www.eea.europa.eu/en/sandbox/miu-test/chart-1"
metadata = {
"title": "Chart 1 example",
"description": "This exemplifies how to use upload_plotly",
"topics": ["Agriculture and food"],
"temporal_coverage": [2011, 2020],
"geo_coverage": ["Italy"],
"subjects": ["tag 1"],
"data_provenance": [
{"title": "European Environment Agency", "organisation": "EEA", "link": "https://eea.europa.eu"}
]
}
upload_plotly(url=url, fig=fig, auth_provider="microsoft", __ac__key="__ac__eea", auth_token=auth_token, **metadata)
Metadata
========
In this section you will learn about various metadata that can be specified when calling :code:`upload_plotly`.
- :code:`figure_note` (slate): sets the figure note
- :code:`topics` (list): sets the list of strings for topics (e.g., ["Agriculture and food", "Bathing water quality"])
- :code:`temporal_coverage` (list): sets the list of years for temporal coverage (e.g., [2022, 2023, 2024])
- :code:`geo_coverage` (list): sets the list of strings for geographical coverage (e.g., ["Italy", "Romania"])
- :code:`subjects` (list): sets the list of strings for tags (e.g., ["tag 1", "tag 2"])
- :code:`data_provenance` (list) sets the list of data provenance (e.g., [{ "title": "European Environment Agency", "organization": "EEA", "link": "https://eea.europa.eu"}])
If any of these doesn't meet the required format, you will get an error explaining what is wrong.
If, for example, you specify :code:`topics = ["Agriculture and fod"]` with a typo, you will get an error because the topic is not in the topics vocabulary and a list with the available topics will be printed.
Eggs repository
===============
- https://pypi.python.org/pypi/eea.jupyter
- http://eggrepo.eea.europa.eu/simple
How to contribute
=================
See the `contribution guidelines (CONTRIBUTING.md) <https://github.com/eea/eea.jupyter/blob/main/CONTRIBUTING.md>`_.
Copyright and license
=====================
eea.jupyter (the Original Code) is free software; you can
redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA.
The Initial Owner of the Original Code is European Environment Agency (EEA).
Portions created by Eau de Web are Copyright (C) 2009 by
European Environment Agency. All Rights Reserved.
Funding
=======
EEA_ - European Environment Agency (EU)
.. _EEA: https://www.eea.europa.eu/
.. _`EEA Web Systems Training`: http://www.youtube.com/user/eeacms/videos?view=1
Changelog
=========
1.6 - (2025-03-20)
---------------------------
* Change: Make sure fig is a real fig before transforming it into a png
[razvanMiu]
1.5 - (2025-03-20)
---------------------------
* Change: don't extract data sources for now
[razvanMiu]
1.4 - (2025-03-11)
---------------------------
* Change: get_theme & get_template functions added
[razvanMiu]
1.3 - (2025-02-20)
---------------------------
* Change: Add debug
[razvanMiu]
1.2 - (2025-01-16)
---------------------------
* Change: Add preview_image
[razvanMiu]
1.1 - (2025-01-16)
---------------------------
* Change: Add new function, uplod_plotly, to automate jupyter workflow
[razvanMiu]
1.0 - (2024-12-04)
---------------------------
* Change: make uploadPlotly accept dict, ref #281230
[razvanMiu]
0.9 - (2024-02-02)
---------------------------
* Change: update readme + set postMessage origin
[razvanMiu]
0.8 - (2024-02-01)
---------------------------
* Change: fix import
[razvanMiu]
0.7 - (2024-02-01)
---------------------------
* Change: add uploadPlotly function wrapper
[razvanMiu]
0.6 - (2024-01-30)
---------------------------
* Change: Develop
[razvanMiu]
0.5 - (2024-01-30)
---------------------------
* Change: Develop
[razvanMiu]
0.4 - (2024-01-30)
---------------------------
* Change: Develop
[razvanMiu]
0.3 - (2024-01-30)
---------------------------
* Change: Develop
[razvanMiu]
0.2 - (2024-01-30)
---------------------------
* Change: 0.2
[razvanMiu]
0.1 - (2024-01-19)
-----------------------
* Initial release.
[eea]
Raw data
{
"_id": null,
"home_page": "https://github.com/eea/eea.banner",
"name": "eea.jupyter",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "EEA Utilities",
"author": "European Environment Agency: IDM2 A-Team",
"author_email": "eea-edw-a-team-alerts@googlegroups.com",
"download_url": "https://files.pythonhosted.org/packages/fe/8f/9537a8eec23bdab881d62b4e164b1a583ef47c08a36b6ee68e105aa0ea75/eea.jupyter-1.6.tar.gz",
"platform": null,
"description": "==========================\neea.jupyter\n==========================\n.. image:: https://ci.eionet.europa.eu/buildStatus/icon?job=eea/eea.jupyter/develop\n :target: https://ci.eionet.europa.eu/job/eea/job/eea.jupyter/job/develop/display/redirect\n :alt: Develop\n.. image:: https://ci.eionet.europa.eu/buildStatus/icon?job=eea/eea.jupyter/master\n :target: https://ci.eionet.europa.eu/job/eea/job/eea.jupyter/job/master/display/redirect\n :alt: Master\n\nThe eea.jupyter is a jupyter utility package for EEA.\n\n.. contents::\n\n\nInstallation\n============\n.. code-block:: console\n\n pip install eea.jupyter\n\n\nUsage\n=====\n\n.. code-block:: python\n\n from eea.jupyter import upload_plotly\n\nUploads or creates a `Chart (interactive)` to a specified `url`. This function accepts any number of keyword arguments.\n\nParameters:\n\n- :code:`url` (required): The URL of the visualization to be updated or created, e.g. :code:`https://eea.europa.eu/en/sandbox/chart-1`. Default: :code:`None`\n- :code:`fig` (required): The figure to be used as part of the visualization. Can accept a :code:`plotly.graph_objs.Figure` or a :code:`dict`. Default: :code:`None`\n- :code:`api_url` (optional): The base URL of the plone API, e.g., :code:`https://eea.europa.eu/admin/++api++`. Default: :code:`/++api++` concatenated to the hostname of the visualization URL, e.g.: if the :code:`url` is :code:`https://biodiversity.eea.europa.eu/en/sandbox/chart-1` then the default value for :code:`api_url` will be :code:`https://biodiversity.eea.europa.eu/admin/++api++`\n- :code:`auth_provider` (optional): Provider to be used for authentication. Allowed values: `basic`, `microsoft`. Default: `basic`\n- :code:`auth_token` (optional): Token to be used instead of allways authenticating. Default: :code:`None`\n- :code:`__ac__key` (optional): Key to be used in cookies if :code:`microsoft` auth_provider is used. Default: :code:`__ac`\n- :code:`**metadata` (optional): Any :code:`Chart (interactive)` metadata desired to be customized, e.g., `title`, `description`, `topics`\n\n**Example 1**: how to use it with basic authentication\n\n.. code-block:: python\n\n # Cell 1 will have some logic to generate a fig\n # Cell 2\n from eea.jupyter import upload_plotly\n\n url = \"https://www.eea.europa.eu/en/sandbox/miu-test/chart-1\"\n\n metadata = {\n \"title\": \"Chart 1 example\",\n \"description\": \"This exemplifies how to use upload_plotly\"\n }\n\n upload_plotly(url=url, fig=fig, **metadata)\n\nIn this example you specify the visualization that you want to update, if it already exists, or where you want to create it. In case the visualization doesn't exists it will be created inside of :code:`https://www.eea.europa.eu/en/sandbox/miu-test` with the id of :code:`chart-1`.\nAfter calling :code:`upload_plotly` you will be prompted with :code:`username` and :code:`password` inputs.\n\n**Example 2**: how to use it with microsoft authentication\n\n.. code-block:: python\n\n # Cell 1 will have some logic to generate a fig\n # Cell 2\n from eea.jupyter import upload_plotly\n\n url = \"https://www.eea.europa.eu/en/sandbox/miu-test/chart-1\"\n\n metadata = {\n \"title\": \"Chart 1 example\",\n \"description\": \"This exemplifies how to use upload_plotly\"\n }\n\n upload_plotly(url=url, fig=fig, auth_provider=\"microsoft\", __ac__key=\"__ac__eea\", **metadata)\n\nIn this example you specify the microsoft auth_provider and also the key of __ac.\n\nAfter calling :code:`upload_plotly` you will be prompted with :code:`auth_token` input which expects a valid :code:`__ac` token. To get the :code:`__ac` you will need to authenticate on https://www.eea.europa.eu/admin and get the value of :code:`__ac__eea` cookie. You can use a cookie chrome extension to retrive the value of the cookie.\n\n**Example 3**: initialize :code:`auth_token` so that you can pass the authentication input\n\n.. code-block:: python\n\n # Cell 1 will have some logic to generate a fig\n # Cell 2\n auth_token = input()\n # Cell 3\n from eea.jupyter import upload_plotly\n\n url = \"https://www.eea.europa.eu/en/sandbox/miu-test/chart-1\"\n\n metadata = {\n \"title\": \"Chart 1 example\",\n \"description\": \"This exemplifies how to use upload_plotly\"\n }\n\n upload_plotly(url=url, fig=fig, auth_provider=\"microsoft\", __ac__key=\"__ac__eea\", auth_token=auth_token, **metadata)\n\nIn this example, firstly, you will be prompted with specifying the value of :code:`auth_token`, which will then be added as a parameter to :code:`upload_plotly`. This allows you to initialize the value of :code:`auth_token` only once, then you can run cell 3 as many times as you like.\n\nSame behaviour regardless of the :code:`auth_provider`.\n\n**Example 4**: passing multiple types of metadata\n\n.. code-block:: python\n\n # Cell 1 will have some logic to generate a fig\n # Cell 2\n auth_token = input()\n # Cell 3\n from eea.jupyter import upload_plotly\n\n url = \"https://www.eea.europa.eu/en/sandbox/miu-test/chart-1\"\n\n metadata = {\n \"title\": \"Chart 1 example\",\n \"description\": \"This exemplifies how to use upload_plotly\",\n \"topics\": [\"Agriculture and food\"],\n \"temporal_coverage\": [2011, 2020],\n \"geo_coverage\": [\"Italy\"],\n \"subjects\": [\"tag 1\"],\n \"data_provenance\": [\n {\"title\": \"European Environment Agency\", \"organisation\": \"EEA\", \"link\": \"https://eea.europa.eu\"}\n ]\n }\n\n upload_plotly(url=url, fig=fig, auth_provider=\"microsoft\", __ac__key=\"__ac__eea\", auth_token=auth_token, **metadata)\n\nMetadata\n========\nIn this section you will learn about various metadata that can be specified when calling :code:`upload_plotly`.\n\n- :code:`figure_note` (slate): sets the figure note\n- :code:`topics` (list): sets the list of strings for topics (e.g., [\"Agriculture and food\", \"Bathing water quality\"])\n- :code:`temporal_coverage` (list): sets the list of years for temporal coverage (e.g., [2022, 2023, 2024])\n- :code:`geo_coverage` (list): sets the list of strings for geographical coverage (e.g., [\"Italy\", \"Romania\"])\n- :code:`subjects` (list): sets the list of strings for tags (e.g., [\"tag 1\", \"tag 2\"])\n- :code:`data_provenance` (list) sets the list of data provenance (e.g., [{ \"title\": \"European Environment Agency\", \"organization\": \"EEA\", \"link\": \"https://eea.europa.eu\"}])\n\nIf any of these doesn't meet the required format, you will get an error explaining what is wrong.\n\nIf, for example, you specify :code:`topics = [\"Agriculture and fod\"]` with a typo, you will get an error because the topic is not in the topics vocabulary and a list with the available topics will be printed.\n\nEggs repository\n===============\n\n- https://pypi.python.org/pypi/eea.jupyter\n- http://eggrepo.eea.europa.eu/simple\n\n\nHow to contribute\n=================\nSee the `contribution guidelines (CONTRIBUTING.md) <https://github.com/eea/eea.jupyter/blob/main/CONTRIBUTING.md>`_.\n\n\nCopyright and license\n=====================\n\neea.jupyter (the Original Code) is free software; you can\nredistribute it and/or modify it under the terms of the\nGNU General Public License as published by the Free Software Foundation;\neither version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc., 59\nTemple Place, Suite 330, Boston, MA 02111-1307 USA.\n\nThe Initial Owner of the Original Code is European Environment Agency (EEA).\nPortions created by Eau de Web are Copyright (C) 2009 by\nEuropean Environment Agency. All Rights Reserved.\n\n\nFunding\n=======\n\nEEA_ - European Environment Agency (EU)\n\n.. _EEA: https://www.eea.europa.eu/\n.. _`EEA Web Systems Training`: http://www.youtube.com/user/eeacms/videos?view=1\n\nChangelog\n=========\n\n1.6 - (2025-03-20)\n---------------------------\n* Change: Make sure fig is a real fig before transforming it into a png\n [razvanMiu]\n\n1.5 - (2025-03-20)\n---------------------------\n* Change: don't extract data sources for now\n [razvanMiu]\n\n1.4 - (2025-03-11)\n---------------------------\n* Change: get_theme & get_template functions added\n [razvanMiu]\n\n1.3 - (2025-02-20)\n---------------------------\n* Change: Add debug\n [razvanMiu]\n\n1.2 - (2025-01-16)\n---------------------------\n* Change: Add preview_image\n [razvanMiu]\n\n1.1 - (2025-01-16)\n---------------------------\n* Change: Add new function, uplod_plotly, to automate jupyter workflow\n [razvanMiu]\n\n1.0 - (2024-12-04)\n---------------------------\n* Change: make uploadPlotly accept dict, ref #281230\n [razvanMiu]\n\n0.9 - (2024-02-02)\n---------------------------\n* Change: update readme + set postMessage origin\n [razvanMiu]\n\n0.8 - (2024-02-01)\n---------------------------\n* Change: fix import\n [razvanMiu]\n\n0.7 - (2024-02-01)\n---------------------------\n* Change: add uploadPlotly function wrapper\n [razvanMiu]\n\n0.6 - (2024-01-30)\n---------------------------\n* Change: Develop\n [razvanMiu]\n\n0.5 - (2024-01-30)\n---------------------------\n* Change: Develop\n [razvanMiu]\n\n0.4 - (2024-01-30)\n---------------------------\n* Change: Develop\n [razvanMiu]\n\n0.3 - (2024-01-30)\n---------------------------\n* Change: Develop\n [razvanMiu]\n\n0.2 - (2024-01-30)\n---------------------------\n* Change: 0.2\n [razvanMiu]\n\n0.1 - (2024-01-19)\n-----------------------\n\n* Initial release.\n [eea]\n",
"bugtrack_url": null,
"license": "GPL version 2",
"summary": "eea.jupyter utilities for jupyter notebook",
"version": "1.6",
"project_urls": {
"Homepage": "https://github.com/eea/eea.banner"
},
"split_keywords": [
"eea",
"utilities"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fe8f9537a8eec23bdab881d62b4e164b1a583ef47c08a36b6ee68e105aa0ea75",
"md5": "7bc2bea35c34476e2031df5d0ea4d128",
"sha256": "1c7af9162df8a9d4623b0f39f9b923fffe2b87404918790cf2084636c02c75f2"
},
"downloads": -1,
"filename": "eea.jupyter-1.6.tar.gz",
"has_sig": false,
"md5_digest": "7bc2bea35c34476e2031df5d0ea4d128",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20924,
"upload_time": "2025-03-20T14:09:25",
"upload_time_iso_8601": "2025-03-20T14:09:25.203163Z",
"url": "https://files.pythonhosted.org/packages/fe/8f/9537a8eec23bdab881d62b4e164b1a583ef47c08a36b6ee68e105aa0ea75/eea.jupyter-1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-20 14:09:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eea",
"github_project": "eea.banner",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "eea.jupyter"
}