{
"cells": [
{
"cell_type": "markdown",
"id": "c19cc072-62ff-4ced-93c6-eda6d16d8da7",
"metadata": {},
"source": [
"# `pygieons` documentation\n",
"\n",
"## What is `pygieons`?\n",
"\n",
"The name (you would anyway ask 😉): ***Py***thon ***GI***S and ***E***arch ***O***bservation ***N***etwork***s***\n",
"\n",
"As described elsewhere, this website is largely generated automatically by using a Python tool called `pygieons`. This tool auto-generates content regarding the listed packages and adds them to the website either as tables or interactive Network visualizations. `pygieons` is currently focused on parsing information about Python GIS and Earth Observation libraries, but it is a rather generic tool, with modest modifications it would be possible to parse and visualize information from any collection of libraries available on PyPi.\n",
"\n",
"`pygieons` is largely based on [pandas](https://pandas.pydata.org/) which is used for data manipulation, while [pyvis](https://pyvis.readthedocs.io/) library is used to visualize the connections between libraries as an interactive network of links. In addition, under the hood libraries such as `requests`, `beautifulsoup4` and `pypistats` are used to extract relevant information about the listed libraries from the PyPi web pages. \n",
"\n",
"Below, we demonstrate some basic functionalities that can be used to auto-generate content using `pygieons`."
]
},
{
"cell_type": "markdown",
"id": "0dc5335c-ab3b-49fc-a3a8-979d4b47ed77",
"metadata": {},
"source": [
"## Basic usage\n",
"\n",
"### Initializing the tool\n",
"\n",
"To generate content with `pygieons`, you need to first initialize the tool with `Ecosystem()` object which accepts a parameter `plot_type` that can be used to define which category of libraries we want to plot, and parameter `log` which can be used to disable logging to the screen. Below is the slightly modified output from `help(Ecosystem)` command showing information about how the tool can be initialized: \n",
"\n",
"```raw\n",
"class Ecosystem(builtins.object)\n",
" | Ecosystem(plot_type='all', keep_all=False, log=True)\n",
" | \n",
" | Parameters\n",
" | ==========\n",
" | \n",
" | plot_type : str\n",
" | This can be used to specify if you want to plot all packages in same figure, or only vector or raster.\n",
" | Possible values are: \"all\", \"vector\", \"raster\", \"generic\", \"vector+generic\", \"raster+generic\".\n",
" | keep_all : bool\n",
" | If True, also packages that are not available from PyPi or which are not maintained will be kept.\n",
" | log: bool\n",
" | If True, will print messages during process.\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "9a45ec0b-2d9b-4203-b8a8-8ac5eebfe417",
"metadata": {},
"source": [
"- Let's initialize the tool and configure it for plotting `raster` libraries."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "5c7992e2-6ad0-457b-b32f-f8705c58d693",
"metadata": {},
"outputs": [],
"source": [
"from pygieons import Ecosystem\n",
"\n",
"# Initialize the tool \n",
"e = Ecosystem(plot_type=\"raster\", log=True)"
]
},
{
"cell_type": "markdown",
"id": "38563aa0-778a-4b7a-961b-861ccde61a45",
"metadata": {},
"source": [
"### Generating tables\n",
"\n",
"To generate a table showing various information about the libraries, you can use method `prepare_table()`, which autogenerates the table contents based on the packages listed in [ecosystem_connections.py](https://github.com/pygieons/pygieons/blob/main/src/pygieons/ecosystem_connections.py) and [ecosystem_pkgs.py](https://github.com/pygieons/pygieons/blob/main/src/pygieons/ecosystem_pkgs.py) files. The tool will print out information about the progress if `log` was specified as `True`:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c57eead6-bb34-43a7-971d-797766e726c7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Find out the number of monthly downloads from PyPi for the libraries ..\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9e3da1d542cf4506a34d569c0b8111f9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/41 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extract project details ..\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "157e2dc1f298494bab574a329fea42cc",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/41 [00:00, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Generate the content\n",
"tbl = e.prepare_table()"
]
},
{
"cell_type": "markdown",
"id": "9195e4b4-1b8f-4342-899b-23e4a1559054",
"metadata": {},
"source": [
"- You can visualize the table by calling `.show()` of the returned `Table` object:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "a4e64847-886b-4d1a-9580-4a6b9e46c18f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"