Package: openstats
Open StatsDiscover and share the KPIs of your OpenSource project.OpenStats is a library built on top ofstreamlitthat extracts data from the Github API
and shows the main KPIs for an OpenSource project:Star evolution: What is the popularity of the repo?Good First issues: Is there a focus towards the community?Recurrent collaborators: How many people are involved?Repository traffic: How many visits and clones do we have?While there many other things to take into account, these metrics help us get a taste on how our project is doing in
a single view.If you'd like to see other metrics or graphics, open an issue or jump into the action!RequirementsHow does it work?ConfigSecretsCachingPublishingContributingAcknowledgementsLicenseRequirementsPython 3.6+The main dependencies arestreamlitandpandas. The configuration is managed withLevy.In terms of permissions, the traffic data requires an account (token) withwriteto the repo.You can install OpenStats with:$ pip install openstats
---> 100%
Successfully installed openstatsHow does it work?OpenStats is a helper tool to build an amazing dashboard from a config file. You can check an examplehere:To run astreamlitapp, we need the following ingredients:app.pyfile that triggers the application.requirements.txt, where we will just addopenstatsOptionally, a.streamlit/config.tomlconfig file with the theme.By creating anopenstats.yamlfile, we will pick up the necessary information, build the streamlit components
and help you generate the theme file 🚀This means that the final setup can look like this:Anapp.pywith:fromopenstats.appimportrunif__name__=="__main__":run()Arequirements.txtfile withopenstats.Anopenstats.yamlfile following the examples 👇ThemeTo generate the theme file based on the config, you can runopenstats-themeafter installingopenstats.This will create the.streamlit/config.tomlfile with the properties defined in ouropenstats.yaml.ConfigLet's take a look at how to configureopenstats.yaml. You can see an examplehere:title:"Dashboardtitle"logo_file:"Imagefiletoshowatthesidebar"client:# Information about the repositoryroot:"api.github.com"# We only support GitHub APIowner:"e.g.,pmbrull"repo:"e.g.,OpenStats"start_date:"Startcountingstarsfromthisdate"# Format "Aug 1 2021" (`%b %d %Y`)style:# To generate the streamlit themeprimary_color:"#7147E8"# Also used for the charts coloringbackground_color:"#F9F8FD"secondary_background_color:"#EEEAF8"text_color:"#37352F"font:"sansserif"social:"Freemarkdowntext!Showyourbadges💪"Note that thestylesection is only to centralise and generate theconfig.tomlfile forstreamlit. The
only added value here is that we will use theprimary_colorfor the theme and charts.If you don't want to add any image to the sidebar, just remove the YAML entry.More on streamlit themes 👉blogMinimum ConfigThe app can run with as minimum configuration as:title:"Levy"client:root:"api.github.com"# We only support GitHub APIowner:"pmbrull"repo:"levy"start_date:"Aug12021"# Format `%b %d %Y`SecretsTo show the traffic data and to have a higher API query rate, we need to identify ourselves to the GitHub API.OpenStats only supports authenticated requests. To make things work, there are two options:Prepare anAPI_TOKENenvironment variable before running the appUsestreamlit secretswhen publishing the app. The secret
should also be namedAPI_TOKEN.The app will first try to obtain the token from the environment variables and will fall back to using streamlit secrets.How to create an access token 👉docsCachingNot all computations are lightning fast. In order to provide the best possible UX, we cache the API results usingstreamlitmemoization features. If you want to refresh the data, there is aclear cachebutton available.PublishingYou can create and manage yourstreamlitapps athttps://share.streamlit.io/. You can follow thedocsfor more information.ContributingTake a look at ourCONTRIBUTINGguide.AcknowledgementsThanks tostreamlitfor an amazing library and theGitHub APIfor sharing all the information!LicenseOpenStats is released underApache License, Version 2.0