Picobrew Server Lines of Code Analysis

A bunch of people have now asked me how many lines of code did it take to build out the Picobrew server that we are using that is multi-platform and provides a fairly simple bundled image for bootstrapping people with a RaspberryPi (again the server isn't platform dependent feel free to get it setup on Win/Mac/Linux/etc).

So what did I do... well I programmatically measured out how many lines of code written in our shared community repo that was started by Pete Marinec (not me BTW!).

Code Repository visualized by File Type (pichart)
Code Repository visualized by Contribution Date (time plot)

Server Code

The code that answers the API from both your web browser and from the Picobrew machines attached to the server.

Python Lines (including tests)

git ls-files | grep "\.py$" | xargs wc -l
      99 app/__init__.py
       6 app/main/__init__.py
      88 app/main/config.py
      37 app/main/firmware.py
     140 app/main/model.py
     121 app/main/recipe_import.py
     322 app/main/recipe_parser.py
     752 app/main/routes_frontend.py
      69 app/main/routes_iSpindel_api.py
     270 app/main/routes_pico_api.py
     129 app/main/routes_picoferm_api.py
      37 app/main/routes_picostill_api.py
     670 app/main/routes_zseries_api.py
     232 app/main/routes_zymatic_api.py
     276 app/main/session_parser.py
      62 app/main/test_recipe_import.py
      44 app/main/test_routes_frontend.py
      19 server.py
      18 test_server.py
    3391 total


Python Lines (only tests...)

yeah test coverage sucks... yay side projects

git ls-files | grep "test.*\.py$" | xargs wc -l
      62 app/main/test_recipe_import.py
      44 app/main/test_routes_frontend.py
      18 test_server.py
     124 total

Base Recipes (Zymatic only)

The Zymatic had a way for Picobrew to push some base utilities that later were bundled in the firmware for the ZSeries devices this is for Utilities > Cleaning v1, Utilities > Rinse v3, and Utilities > New Clean Beta v6 while connecting to the "mothership" can be edited remotely by Picobrew staff and sent updated to your device just like your recipe instructions... after all a clean or rinse is just a brew with no grains and no hops.

git ls-files | grep "\.json" | xargs wc -l
      90 app/recipes/zymatic/Cleaning_v1.json
     139 app/recipes/zymatic/New_Clean_Beta_v6.json
      13 app/recipes/zymatic/Rinse_v3.json
     242 total

Static Code / Website

All the markup and javascript that powers the web experience you see at http://raspberrypi or http://picobrew.com or http://192.168.72.1 or http://<ip-of-flask/python-server> depending on your setup.

HTML Markup (webpage structure)

git ls-files | grep "\.html$" | xargs wc -l
      55 app/templates/about.html
      24 app/templates/base.html
      29 app/templates/brew_history.html
      29 app/templates/ferm_history.html
      26 app/templates/iSpindel_history.html
      54 app/templates/import_brewhouse_recipe.html
      79 app/templates/index.html
      12 app/templates/invalid_file.html
      50 app/templates/navbar.html
      30 app/templates/new_pico_recipe.html
      25 app/templates/new_zseries_recipe.html
      25 app/templates/new_zymatic_recipe.html
      10 app/templates/pico_recipes.html
      48 app/templates/recipe_list.html
     104 app/templates/setup.html
      11 app/templates/units_selector.html
      10 app/templates/zseries_recipes.html
      10 app/templates/zymatic_recipes.html
     631 total

Javascript (dynamic code powering experience)

The majority of this code is libraries so I'll split that out separately like test coverage above. Though for now still including all of these libraries (which some have been minified meaning all lines are collapsed to a single set of them instead of "source" it won't do much...)

git ls-files | grep "\.js$" | xargs wc -l
       6 app/static/js/bootstrap/bootstrap.min.js
      48 app/static/js/brew_graph.js
      67 app/static/js/brew_graph_socketio.js
       2 app/static/js/brew_history.js
     105 app/static/js/convert_units.js
      58 app/static/js/ferm_graph.js
      74 app/static/js/ferm_graph_socketio.js
       2 app/static/js/ferm_history.js
     113 app/static/js/highcharts/annotations.js
      13 app/static/js/highcharts/dark-unica.js
      29 app/static/js/highcharts/export-data.js
      42 app/static/js/highcharts/exporting.js
     544 app/static/js/highcharts/highcharts.js
      58 app/static/js/iSpindel_graph.js
      74 app/static/js/iSpindel_graph_socketio.js
      41 app/static/js/import_recipe.js
       2 app/static/js/jquery/jquery.min.js
     331 app/static/js/pico_recipe.js
      22 app/static/js/server_management.js
      95 app/static/js/setup.js
       8 app/static/js/socketio/socket.io.slim.js
       1 app/static/js/tabulator/accessor.min.js
       1 app/static/js/tabulator/ajax.min.js
       1 app/static/js/tabulator/edit.min.js
       1 app/static/js/tabulator/filter.min.js
       1 app/static/js/tabulator/format.min.js
       1 app/static/js/tabulator/frozen_rows.min.js
       1 app/static/js/tabulator/jquery_wrapper.min.js
       1 app/static/js/tabulator/menu.min.js
       1 app/static/js/tabulator/moveable_rows.min.js
       1 app/static/js/tabulator/responsive_layout.min.js
       1 app/static/js/tabulator/sort.min.js
      12 app/static/js/tabulator/tabulator.min.js
       5 app/static/js/tabulator/tabulator_core.min.js
       1 app/static/js/tabulator/validate.min.js
     313 app/static/js/zseries_recipe.js
     310 app/static/js/zymatic_recipe.js
    2386 total

Tabulator (minified)

git ls-files | grep "\.js$" | grep "tabulator" | xargs wc -l
       1 app/static/js/tabulator/accessor.min.js
       1 app/static/js/tabulator/ajax.min.js
       1 app/static/js/tabulator/edit.min.js
       1 app/static/js/tabulator/filter.min.js
       1 app/static/js/tabulator/format.min.js
       1 app/static/js/tabulator/frozen_rows.min.js
       1 app/static/js/tabulator/jquery_wrapper.min.js
       1 app/static/js/tabulator/menu.min.js
       1 app/static/js/tabulator/moveable_rows.min.js
       1 app/static/js/tabulator/responsive_layout.min.js
       1 app/static/js/tabulator/sort.min.js
      12 app/static/js/tabulator/tabulator.min.js
       5 app/static/js/tabulator/tabulator_core.min.js
       1 app/static/js/tabulator/validate.min.js
      29 total

SocketIo (minified)

git ls-files | grep "\.js$" | grep "socketio" | xargs wc -l
      67 app/static/js/brew_graph_socketio.js
      74 app/static/js/ferm_graph_socketio.js
      74 app/static/js/iSpindel_graph_socketio.js
       8 app/static/js/socketio/socket.io.slim.js
     223 total

Highcharts (minified)

git ls-files | grep "\.js$" | grep "highcharts" | xargs wc -l
     113 app/static/js/highcharts/annotations.js
      13 app/static/js/highcharts/dark-unica.js
      29 app/static/js/highcharts/export-data.js
      42 app/static/js/highcharts/exporting.js
     544 app/static/js/highcharts/highcharts.js
     741 total

jQuery (minified+ tabulator wrapper)

git ls-files | grep "\.js$" | grep "jquery" | xargs wc -l
       2 app/static/js/jquery/jquery.min.js
       1 app/static/js/tabulator/jquery_wrapper.min.js
       3 total

Stylesheets (CSS)

AKA the stuff that makes websites "pretty".

git ls-files | grep "\.css" | xargs wc -l
       6 app/static/css/bootstrap/bootstrap.min.css
       4 app/static/css/fontawesome/all.min.css
       4 app/static/css/fontawesome/fontawesome.min.css
      43 app/static/css/main.css
       3 app/static/css/tabulator/tabulator_bootstrap4.min.css
       3 app/static/css/tabulator/tabulator_midnight.min.css
      63 total

Binary (firmware...)

No this isn't code anyone from the community has written nor anyone really... this is compiled and packaged code that is shipped to your Picobrew devices via our server and thus included in the repository... wanted to include just for simple data collection (I personally love data even the "useless" kinds).

git ls-files | grep "\.bin" | xargs wc -l
       0 app/firmware/pico/pico_0_1_34.bin
       0 app/firmware/pico_c/pico_c_0_1_34.bin
     849 app/firmware/picoferm/picoferm_0_1_0.bin
     848 app/firmware/picoferm/picoferm_0_1_2.bin
     848 app/firmware/picoferm/picoferm_0_1_3.bin
     848 app/firmware/picoferm/picoferm_0_1_4.bin
     905 app/firmware/picoferm/picoferm_0_1_5.bin
     903 app/firmware/picoferm/picoferm_0_1_6.bin
     905 app/firmware/picoferm/picoferm_0_1_7.bin
     911 app/firmware/picoferm/picoferm_0_1_8.bin
    1122 app/firmware/picoferm/picoferm_0_2_0.bin
    1129 app/firmware/picoferm/picoferm_0_2_1.bin
    1117 app/firmware/picoferm/picoferm_0_2_2.bin
    1116 app/firmware/picoferm/picoferm_0_2_3.bin
    1113 app/firmware/picoferm/picoferm_0_2_4.bin
    1114 app/firmware/picoferm/picoferm_0_2_5.bin
    1120 app/firmware/picoferm/picoferm_0_2_6.bin
    1114 app/firmware/picoferm/picoferm_0_2_7.bin
    6510 app/firmware/picostill/picostill_0_0_30.bin
    6494 app/firmware/picostill/picostill_0_0_31.bin
    6480 app/firmware/picostill/picostill_0_0_32.bin
    7986 app/firmware/picostill/picostill_0_0_33.bin
    8053 app/firmware/picostill/picostill_0_0_34.bin
    8071 app/firmware/picostill/picostill_0_0_35.bin
   15012 app/firmware/zseries/zseries_0_0_116.bin
   16189 app/firmware/zseries/zseries_0_0_119.bin
   90757 total

Contribution Info and Statistics

The server as it exists today is largely built on top of another OSS project, hotzenklotz/picobrew-server, that had only support for Zymatic with no web UI or graph/visualization support. Pete took it from there as a prototype and a learning bed for new stuff (what us engineers like to do all the time). A few members from the community, myself included, have been working on adding additional features and fixes along the way. Now numbering 11 total people have contributed code where even more have been submitting feedback, bugs, and feature requests.

Lines of Code Changed by Author

(technically I cheated as all the binary files are being reported as written by me...)

7882 author Pete
7732 author Trevor Mack
1747 author Todd
 350 author Tom O'Neil
 146 author zuiko42
  59 author Austin Chambers
  30 author troyef
  22 author Andrew Berryman
   4 author mweddle
   2 author Matt Johnson

Can't quite comprehend what this means and want to see a video of it instead... well your wish is my command. Here is a fairly cool animation showing the actual server being built and maintained over time.

Additional thanks to the 34 additional people who have filed Github Issues some more detailed than others, but each are appreciated and glad you are finding value and helping to push for a better overall experience for everyone.

Much appreciated, Cheers 🍻!

References

arzzen/git-quick-stats
▁▅▆▃▅ Git quick statistics is a simple and efficient way to access various statistics in git repository. - arzzen/git-quick-stats
IonicaBizau/github-stats
:chart_with_upwards_trend: Visualize stats about GitHub users and projects in your terminal. - IonicaBizau/github-stats
acaudwell/Gource
software version control visualization. Contribute to acaudwell/Gource development by creating an account on GitHub.
FFmpeg/FFmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git. Contribute to FFmpeg/FFmpeg development by creating an account on GitHub.