From 436448419226512b8d010fb0fa40b16b683e7dc5 Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Thu, 18 Nov 2021 02:06:54 -0800 Subject: [PATCH] docs: add hpi query example, links to other repos also updated the MODULE_DESIGN docs to mention the current workaround for converting single file modules to namespace packages through the deprecation warning --- README.org | 49 +++++++++++++++++++++++++++++++++++++++++++ doc/MODULE_DESIGN.org | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 332b3c1..184c250 100644 --- a/README.org +++ b/README.org @@ -75,6 +75,7 @@ This library is my attempt to achieve this vision. - Accessing exercise data - Book reading progress - Messenger stats + - Which month in 2020 did I make the most git commits in? - Querying Roam Research database - How does it get input data? - Q & A @@ -85,6 +86,7 @@ This library is my attempt to achieve this vision. - But /should/ I use it? - Would it suit /me/? - What it isn't? +- HPI Repositories - Related links - -- :END: @@ -518,6 +520,38 @@ How much do I chat on Facebook Messenger? [[https://beepb00p.xyz/hpi_files/messenger_2016_to_2019.png]] +** Which month in 2020 did I make the most git commits in? +:PROPERTIES: +:CUSTOM_ID: hpi_query_git +:END: + +If you like the shell or just want to quickly convert/grab some information from HPI, it also comes with a JSON query interface - so you can export the data, or just pipeline to your heart's content: + +#+begin_src bash + $ hpi query my.coding.commits.commits --stream # stream JSON objects as they're read + --order-type datetime # find the 'datetime' attribute and order by that + --after '2020-01-01 00:00:00' --before '2020-12-31 23:59:59' # in 2020 + | jq '.committed_dt' -r # extract the datetime + # mangle the output a bit to group by month and graph it + | cut -d'-' -f-2 | sort | uniq -c | awk '{print $2,$1}' | sort -n | termgraph +#+end_src + +#+begin_src +2020-01: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 458.00 +2020-02: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 440.00 +2020-03: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 545.00 +2020-04: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 585.00 +2020-05: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 518.00 +2020-06: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 755.00 +2020-07: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 467.00 +2020-08: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 449.00 +2020-09: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 1.03 K +2020-10: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 791.00 +2020-11: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 474.00 +2020-12: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 383.00 +#+end_src + + ** Querying Roam Research database :PROPERTIES: :CUSTOM_ID: roamresearch @@ -675,6 +709,21 @@ I'm not sure whether it's a solvable problem at this point, but happy to hear an Please take my ideas and code and build something cool from it! +* HPI Repositories +:PROPERTIES: +:CUSTOM_ID: hpi_repos +:END: + +One of HPI's core goals is to be as extendable as possible. The goal here isn't to become a monorepo and support every possible data source/website to the point that this isn't maintainable anymore, but hopefully you get a few modules 'for free'. + +If you want to write modules for personal use but don't want to merge them into here, you're free to maintain modules locally in a separate directory to avoid any merge conflicts, and entire HPI repositories can even be published separately and installed into the single ~my~ python package (For more info on this, see [[https://github.com/karlicoss/HPI/tree/master/doc/MODULE_DESIGN.org][MODULE_DESIGN]]) + +Other HPI Repositories: + +- [[https://github.com/seanbreckenridge/HPI][seanbreckenridge/HPI]] +- [[https://github.com/madelinecameron/hpi][madelinecameron/HPI]] + + * Related links :PROPERTIES: :CUSTOM_ID: links diff --git a/doc/MODULE_DESIGN.org b/doc/MODULE_DESIGN.org index 9019dfa..c62cdac 100644 --- a/doc/MODULE_DESIGN.org +++ b/doc/MODULE_DESIGN.org @@ -52,7 +52,7 @@ As an example of this, take a look at the [[https://github.com/karlicoss/HPI/tre Not all HPI Modules are currently at that level of complexity -- some are simple enough that one can understand the file by just reading it top to bottom. Some wouldn't make sense to split off into separate modules for one reason or another. -A related concern is how to structure namespace packages to allow users to easily extend them, and how this conflicts with single file modules. Keep reading below for more information on namespace packages/extension. If a module is converted from a single file module to a namespace with multiple files, it seems this is a breaking change, see [[https://github.com/karlicoss/HPI/issues/89][#89]] for an example of this. +A related concern is how to structure namespace packages to allow users to easily extend them, and how this conflicts with single file modules (Keep reading below for more information on namespace packages/extension) If a module is converted from a single file module to a namespace with multiple files, it seems this is a breaking change, see [[https://github.com/karlicoss/HPI/issues/89][#89]] for an example of this. The current workaround is to leave it a regular python package with an ~__init__.py~` for some amount of time and send a deprecation warning, and then eventually remove the ~__init__.py~ file to convert it into a namespace package. For an example, see the [[https://github.com/karlicoss/HPI/blob/8422c6e420f5e274bd1da91710663be6429c666c/my/reddit/__init__.py][reddit init file]]. #+html: