openpvtools
Contents
openpvtools#
[1]:
import utils
from bokeh.plotting import figure, show
from bokeh.models import HoverTool
from bokeh.io import output_notebook
[2]:
output_notebook()
ReadTheDocs#
[3]:
df = utils.get_rtd_analytics_data('openpvtools')
data_period = df['Date'].min().strftime('%Y-%m-%d') + ' to ' + df['Date'].max().strftime('%Y-%m-%d')
[4]:
daily_views = df.pivot_table(values='Views', index='Date', columns='Version', aggfunc='sum')[['latest']].fillna(0)
p = figure(x_axis_type="datetime", height=350, title=f"Daily views by RTD version")
hover_tool = HoverTool(tooltips=[('Date', '@x{%Y-%m-%d}'), ('Views', '@y')],
formatters={'@x': 'datetime'})
hover_tool.point_policy = 'snap_to_data'
p.add_tools(hover_tool)
p.line(daily_views.index, daily_views['latest'], legend_label='latest')
p.yaxis.axis_label = 'Daily page views'
show(p)
[5]:
df2 = df.loc[(df['Version'] == 'latest'), :].copy()
pathviews = df2.groupby('Path')['Views'].sum().reset_index()
[6]:
n = 20
subset = pathviews.sort_values('Views', ascending=False)[:n]
p = figure(y_range=subset['Path'], height=400, tooltips=[("URL", "@Path"), ("Views", "@Views")],
title=f"Views by URL (Top {n}, {data_period})")
p.hbar(y='Path', right='Views', source=subset, height=0.75,
line_color='white')
p.xaxis.axis_label = 'Total page views'
show(p)
GitHub#
[7]:
gh = utils.get_github_stars('openpvtools/openpvtools')
[8]:
p = utils.plot_github_stars_timeseries(gh)
show(p)
[9]:
contributor_ts, _ = utils.get_github_contributor_timeseries("openpvtools/openpvtools")
p = utils.plot_github_contributors_timeseries(contributor_ts)
show(p)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
Cell In[9], line 1
----> 1 contributor_ts, _ = utils.get_github_contributor_timeseries("openpvtools/openpvtools")
2 p = utils.plot_github_contributors_timeseries(contributor_ts)
3 show(p)
File ~/work/pv-foss-engagement/pv-foss-engagement/sphinx/source/project/utils.py:183, in get_github_contributor_timeseries(repo, max_retries, retry_delay)
181 break
182 else:
--> 183 raise Exception("Could not fetch contributor data")
185 commits_by_week = {}
186 first_commit_dates = []
Exception: Could not fetch contributor data
[10]:
contributors = utils.get_github_contributors('openpvtools/openpvtools')
[11]:
mosaic = utils.make_github_contributors_mosaic(contributors)
mosaic
[11]:
[ ]: