diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb39a2db..79bc9d9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest] - python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: [ 3.9, "3.10", "3.11", "3.12"] exclude: [ { platform: macos-latest, python-version: "3.8" }, @@ -24,17 +24,17 @@ jobs: steps: - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 # nicer to have all git history when debugging/for tests - run: ./install - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: .coverage.mypy-${{ matrix.platform }}_${{ matrix.python-version }} path: .coverage.mypy/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 28a0cfc6..2cc029e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,29 @@ ### 2022-03-20 -See [#33](https://github.com/seanbreckenridge/HPI/pull/33) +See [#33](https://github.com/purarue/HPI/pull/33) -Replaced `file_backups` modules with `git_history`, using [`git_doc_history`](https://github.com/seanbreckenridge/git_doc_history) +Replaced `file_backups` modules with `git_history`, using [`git_doc_history`](https://github.com/purarue/git_doc_history) -I don't expect anyone else was using these modules, but there's a script [here](https://github.com/seanbreckenridge/git_doc_history/blob/master/bin/file_backups_to_doc_history) to convert from the old format to new. Feel free to open an issue if you were using these -- could maintain them in a separate HPI repo as old repositories +I don't expect anyone else was using these modules, but there's a script [here](https://github.com/purarue/git_doc_history/blob/master/bin/file_backups_to_doc_history) to convert from the old format to new. Feel free to open an issue if you were using these -- could maintain them in a separate HPI repo as old repositories ### 2022-01-30 -[Relevant PR](https://github.com/seanbreckenridge/HPI/pull/18); If you're having issues with the `my.config` blocks, compare yours to [mine](https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py) +[Relevant PR](https://github.com/purarue/HPI/pull/18); If you're having issues with the `my.config` blocks, compare yours to [mine](https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py) Renamed some modules to allow for future extension, and less possibilities for conflicts with other related HPI modules under a particular company/service/source -For reference, [here is the current directory structure](https://github.com/seanbreckenridge/HPI/tree/eb425e653918d68eb9d41da29e791fe1ba554dc7/my) as of this commit +For reference, [here is the current directory structure](https://github.com/purarue/HPI/tree/eb425e653918d68eb9d41da29e791fe1ba554dc7/my) as of this commit In particular, anything with a `gdpr`/`data_export`/`privacy_export` is named to be that, instead of globally squashing the namespace module to the single `modulename.py` file Converting a single-file module to a namespace module [is always a breaking change](https://github.com/karlicoss/promnesia/pull/225#issuecomment-819773697), and though [one can do hacky traceback introspection](https://github.com/karlicoss/HPI/blob/master/my/reddit/__init__.py) (to possible delay the change from a non-namespace package to a namespace package. However, if anyone else is using this code, its likely in the background through promnesia, so most likely situation is that they don't see that till I deprecate it anyways), but its only a temporary solution until the `__init__.py`/`module.py` file is eventually removed -- so better to do them all now instead of waiting till it becomes 'too late' -A user (or me) may want to write their own module with the same name, meaning they can't use both at the same time if mine is just `my.module_name.py`, since my module existing means any other namespace packages can't have the same base name (see [reorder_editable](https://github.com/seanbreckenridge/reorder_editable) for an explanation) +A user (or me) may want to write their own module with the same name, meaning they can't use both at the same time if mine is just `my.module_name.py`, since my module existing means any other namespace packages can't have the same base name (see [reorder_editable](https://github.com/purarue/reorder_editable) for an explanation) -The one motivating this change is `apple.py`, since the old `apple.py` was parsing the privacy export, but I wanted to add something to parse [`imessage`](https://github.com/seanbreckenridge/HPI/commit/e361ce8182d8be8b331875078ad17605d3f80a50) files. Someone else may want to add other `apple/file.py` files to parse other parts of apple/mac behaviour, but me having the single `apple.py` either means they have to have their repo before mine on their path (but doing so means they overwrite the current `apple.py` file, so they can't use that to parse their privacy export, even if they were trying to do something else entirely), or they have to rename their code to something like `my_apple/file.py` to create a new namespace module +The one motivating this change is `apple.py`, since the old `apple.py` was parsing the privacy export, but I wanted to add something to parse [`imessage`](https://github.com/purarue/HPI/commit/e361ce8182d8be8b331875078ad17605d3f80a50) files. Someone else may want to add other `apple/file.py` files to parse other parts of apple/mac behaviour, but me having the single `apple.py` either means they have to have their repo before mine on their path (but doing so means they overwrite the current `apple.py` file, so they can't use that to parse their privacy export, even if they were trying to do something else entirely), or they have to rename their code to something like `my_apple/file.py` to create a new namespace module Possible 'Exceptions' to this: - For some files, if the possibility for conflict is low (I can't imagine anyone exporting data from the source in any other way, e.g., `ipython`, `project_euler`) or the name is so specific to the source that its not needed (e.g. `ttt`, `window_watcher`) - For files where I can't imagine you'd want both mine and your/custom implementation the same time, e.g. if you override `bash`, `zsh`, you're probably creating your own solution to parse that source, and don't need mine (If that's not the case, feel free to open an issue) -- For some of my modules, I've renamed them from what they do to their service/project names instead (`albums` to `nextalbums`; `money` to `mint`), so I'm not holding the generic name of some function when I don't really need to (have since moved those to [HPI-personal](https://github.com/seanbreckenridge/HPI-personal)) +- For some of my modules, I've renamed them from what they do to their service/project names instead (`albums` to `nextalbums`; `money` to `mint`), so I'm not holding the generic name of some function when I don't really need to (have since moved those to [HPI-personal](https://github.com/purarue/HPI-personal)) diff --git a/LICENSE b/LICENSE index 5437fb92..bdd50a20 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2021 Sean Breckenridge +Copyright (c) 2020-2024 purarue Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 0c60643f..6af2d704 100644 --- a/README.md +++ b/README.md @@ -16,24 +16,24 @@ This is built on top of [`karlicoss/HPI`](https://github.com/karlicoss/HPI). It - `my.zsh` and `my.bash`, access to my shell history w/ timestamps - `my.mail.imap` and `my.mail.mbox` to parse local IMAP sync's of my mail/mbox files -- see [doc/MAIL_SETUP.md](doc/MAIL_SETUP.md) -- `my.mpv.history_daemon`, accesses movies/music w/ activity/metadata that have played on my machine, facilitated by a [mpv history daemon](https://github.com/seanbreckenridge/mpv-history-daemon) -- `my.discord.data_export`, parses ~1,000,000 messages/events from the discord data export, parser [here](https://github.com/seanbreckenridge/discord_data) -- `my.todotxt.active` to parse my current [todo.txt](https://github.com/todotxt/todo.txt-cli) file; `my.todotxt.git_history` tracks my history using backups of those files in [`git_doc_history`](https://github.com/seanbreckenridge/git_doc_history) +- `my.mpv.history_daemon`, accesses movies/music w/ activity/metadata that have played on my machine, facilitated by a [mpv history daemon](https://github.com/purarue/mpv-history-daemon) +- `my.discord.data_export`, parses ~1,000,000 messages/events from the discord data export, parser [here](https://github.com/purarue/discord_data) +- `my.todotxt.active` to parse my current [todo.txt](https://github.com/todotxt/todo.txt-cli) file; `my.todotxt.git_history` tracks my history using backups of those files in [`git_doc_history`](https://github.com/purarue/git_doc_history) - `my.rss.newsboat`, keeps track of when I added/removed RSS feeds (for [`newsboat`](https://newsboat.org/)) - `my.ipython`, for timestamped python REPL history -- `my.ttt`, to parse shell/system history tracked by [`ttt`](https://github.com/seanbreckenridge/ttt) -- `my.activitywatch.active_window`, to parse active window events (what application I'm using/what the window title is) using [`window_watcher`](https://github.com/seanbreckenridge/aw-watcher-window) and [activitywatch](https://activitywatch.net/) on android -- `my.chess.export`, to track my [chess.com](https://www.chess.com)/[lichess.org](https://lichess.org/) games, using [`chess_export`](https://github.com/seanbreckenridge/chess_export) -- `my.trakt.export`, providing me a history/my ratings for Movies/TV Show (episodes) using [`traktexport`](https://github.com/seanbreckenridge/traktexport) -- `my.listenbrainz.export`, exporting my music listening history from [ListenBrainz](https://listenbrainz.org/) (open-source Last.fm) using [`listenbrainz_export`](https://github.com/seanbreckenridge/listenbrainz_export) -- `my.offline.listens`, for offline music listen history, using [offline_listens](https://github.com/seanbreckenridge/offline_listens) -- `my.mal.export`, for anime/manga history using [`malexport`](https://github.com/seanbreckenridge/malexport) -- `my.grouvee.export`, for my video game history/backlog using [`grouvee_export`](https://github.com/seanbreckenridge/grouvee_export) +- `my.ttt`, to parse shell/system history tracked by [`ttt`](https://github.com/purarue/ttt) +- `my.activitywatch.active_window`, to parse active window events (what application I'm using/what the window title is) using [`window_watcher`](https://github.com/purarue/aw-watcher-window) and [activitywatch](https://activitywatch.net/) on android +- `my.chess.export`, to track my [chess.com](https://www.chess.com)/[lichess.org](https://lichess.org/) games, using [`chess_export`](https://github.com/purarue/chess_export) +- `my.trakt.export`, providing me a history/my ratings for Movies/TV Show (episodes) using [`traktexport`](https://github.com/purarue/traktexport) +- `my.listenbrainz.export`, exporting my music listening history from [ListenBrainz](https://listenbrainz.org/) (open-source Last.fm) using [`listenbrainz_export`](https://github.com/purarue/listenbrainz_export) +- `my.offline.listens`, for offline music listen history, using [offline_listens](https://github.com/purarue/offline_listens) +- `my.mal.export`, for anime/manga history using [`malexport`](https://github.com/purarue/malexport) +- `my.grouvee.export`, for my video game history/backlog using [`grouvee_export`](https://github.com/purarue/grouvee_export) - `my.runelite.screenshots`, parses data from the [automatic runelite screenshots](https://github.com/runelite/runelite/wiki/Screenshot) - `my.minecraft.advancements`, parses advancement (local achievement data) from the `~/.minecraft` directory - `my.project_euler`, when I solved [Project Euler](https://projecteuler.net/) problems - `my.linkedin.privacy_export`, to parse the [privacy export](https://www.linkedin.com/help/linkedin/answer/50191/downloading-your-account-data?lang=en) from linkedin -- `my.scramble.history` for merged (timed) rubiks cube solves from multiple sources, using [scramble_history](https://github.com/seanbreckenridge/scramble-history) +- `my.scramble.history` for merged (timed) rubiks cube solves from multiple sources, using [scramble_history](https://github.com/purarue/scramble-history) #### 'Historical' Modules @@ -41,53 +41,53 @@ These are modules to parse GDPR exports/data from services I used to use, but do - `my.apple.privacy_export`, parses Game Center and location data from the [apple privacy export](https://privacy.apple.com/) - `my.facebook.gdpr`, to parse the GDPR export from Facebook -- `my.league.export`, gives League of Legends game history using [`lolexport`](https://github.com/seanbreckenridge/lolexport) -- `my.steam.scraper`, for steam achievement data and game playtime using [`steamscraper`](https://github.com/seanbreckenridge/steamscraper) -- `my.piazza.scraper`, parsing [piazza](https://piazza.com/) (university forum) posts using [`piazza-scraper`](https://github.com/seanbreckenridge/piazza-scraper) -- `my.blizzard.gdpr`, for general battle.net event data [parsed from a GDPR export](https://github.com/seanbreckenridge/blizzard_gdpr_parser) +- `my.league.export`, gives League of Legends game history using [`lolexport`](https://github.com/purarue/lolexport) +- `my.steam.scraper`, for steam achievement data and game playtime using [`steamscraper`](https://github.com/purarue/steamscraper) +- `my.piazza.scraper`, parsing [piazza](https://piazza.com/) (university forum) posts using [`piazza-scraper`](https://github.com/purarue/piazza-scraper) +- `my.blizzard.gdpr`, for general battle.net event data [parsed from a GDPR export](https://github.com/purarue/blizzard_gdpr_parser) - `my.skype.gdpr` to parse a couple datetimes from the Skype GDPR export (seems all my data from years ago is long gone) - `my.spotify.gdpr`, to parse the GDPR export from Spotify, mostly to access songs from my playlists from years ago -- `my.twitch`, merging the [data export](https://www.twitch.tv/p/en/legal/privacy-choices/#user-privacy-requests) and my messages parsed from the [overrustle logs dump](https://github.com/seanbreckenridge/overrustle_parser) +- `my.twitch`, merging the [data export](https://www.twitch.tv/p/en/legal/privacy-choices/#user-privacy-requests) and my messages parsed from the [overrustle logs dump](https://github.com/purarue/overrustle_parser) -See [here](https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py) for my `HPI` config +See [here](https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py) for my `HPI` config -[Promnesia `Source`s for these `HPI` modules](https://github.com/seanbreckenridge/promnesia) +[Promnesia `Source`s for these `HPI` modules](https://github.com/purarue/promnesia) -I also have some more personal scripts/modules in a separate repo; [`HPI-personal`](https://github.com/seanbreckenridge/HPI-personal) +I also have some more personal scripts/modules in a separate repo; [`HPI-personal`](https://github.com/purarue/HPI-personal) ### In-use from [karlicoss/HPI](https://github.com/karlicoss/HPI) -- `my.browser`, to parse browser history using [`browserexport`](https://github.com/seanbreckenridge/browserexport) -- `my.google.takeout.parser`, parses lots of (~500,000) events (youtube, searches, phone usage, comments, location history) from [google takeouts](https://takeout.google.com/), using [`google_takeout_parser`](https://github.com/seanbreckenridge/google_takeout_parser) +- `my.browser`, to parse browser history using [`browserexport`](https://github.com/purarue/browserexport) +- `my.google.takeout.parser`, parses lots of (~500,000) events (youtube, searches, phone usage, comments, location history) from [google takeouts](https://takeout.google.com/), using [`google_takeout_parser`](https://github.com/purarue/google_takeout_parser) - `my.coding.commits` to track git commits across the system - `my.github` to track github events/commits and parse the GDPR export, using [`ghexport`](https://github.com/karlicoss/ghexport) -- `my.reddit`, get saved posts, comments. Uses [`rexport`](https://github.com/karlicoss/rexport) to create backups of recent activity periodically, and [`pushshift`](https://github.com/seanbreckenridge/pushshift_comment_export) to get old comments. +- `my.reddit`, get saved posts, comments. Uses [`rexport`](https://github.com/karlicoss/rexport) to create backups of recent activity periodically, and [`pushshift`](https://github.com/purarue/pushshift_comment_export) to get old comments. - `my.smscalls`, exports call/sms history using [SMS Backup & Restore](https://play.google.com/store/apps/details?id=com.riteshsahu.SMSBackupRestore&hl=en_US) - `my.stackexchange.stexport`, for stackexchange data using [`stexport`](https://github.com/karlicoss/stexport) #### Partially in-use/with overrides: -- `my.location`, though since I also have some locations from `apple.privacy_export`, I have a [`my.location.apple`](./my/location/apple.py) which I then merge into `my.location.all` in my overridden [`all.py`](https://github.com/seanbreckenridge/HPI-personal/blob/master/my/location/all.py) file on my personal repo -- similarly, I do use `my.ip` and `my.location.via_ip` from upstream, but I have [overridden `all.py` and module files here](https://github.com/seanbreckenridge/HPI/tree/master/my/ip) +- `my.location`, though since I also have some locations from `apple.privacy_export`, I have a [`my.location.apple`](./my/location/apple.py) which I then merge into `my.location.all` in my overridden [`all.py`](https://github.com/purarue/HPI-personal/blob/master/my/location/all.py) file on my personal repo +- similarly, I do use `my.ip` and `my.location.via_ip` from upstream, but I have [overridden `all.py` and module files here](https://github.com/purarue/HPI/tree/master/my/ip) -'Overriding' an `all.py` file means replacing the `all.py` from upstream repo (this means it can use my sources here to grab more locations/ips, since those don't exist in the upstream). For more info see [reorder_editable](https://github.com/seanbreckenridge/reorder_editable#editable-namespace-packages), and the [module design](https://github.com/karlicoss/HPI/blob/master/doc/MODULE_DESIGN.org#adding-new-modules) docs for HPI, but you might be able to get the gist by comparing: +'Overriding' an `all.py` file means replacing the `all.py` from upstream repo (this means it can use my sources here to grab more locations/ips, since those don't exist in the upstream). For more info see [reorder_editable](https://github.com/purarue/reorder_editable#editable-namespace-packages), and the [module design](https://github.com/karlicoss/HPI/blob/master/doc/MODULE_DESIGN.org#adding-new-modules) docs for HPI, but you might be able to get the gist by comparing: - [my.location.all](https://github.com/karlicoss/HPI/blob/master/my/location/all.py) in `karlicoss/HPI` -- [my.location.all](https://github.com/seanbreckenridge/HPI-personal/blob/master/my/location/all.py) in `seanbreckenridge/HPI-personal` +- [my.location.all](https://github.com/purarue/HPI-personal/blob/master/my/location/all.py) in `purarue/HPI-personal` -Since I've mangled my `PYTHONPATH` (see [reorder_editable](https://github.com/seanbreckenridge/reorder_editable#editable-namespace-packages)), it imports from my repo instead of `karlicoss/HPI`. `all.py` files tend to pretty small -- so overriding/changing a line to add a source is the whole point. +Since I've mangled my `PYTHONPATH` (see [reorder_editable](https://github.com/purarue/reorder_editable#editable-namespace-packages)), it imports from my repo instead of `karlicoss/HPI`. `all.py` files tend to pretty small -- so overriding/changing a line to add a source is the whole point. ### Companion Tools/Libraries -Disregarding tools which actively collect data (like [`ttt`](https://github.com/seanbreckenridge/ttt)/[`window_watcher`](https://github.com/seanbreckenridge/aw-watcher-window)) or repositories which have their own exporter/parsers which are used here, there are a couple other tools/libraries I've created for this project: +Disregarding tools which actively collect data (like [`ttt`](https://github.com/purarue/ttt)/[`window_watcher`](https://github.com/purarue/aw-watcher-window)) or repositories which have their own exporter/parsers which are used here, there are a couple other tools/libraries I've created for this project: -- [`ipgeocache`](https://github.com/seanbreckenridge/ipgeocache) - for any IPs gathered from data exports, provides geolocation info, so I have partial location info going back to 2013 -- [`sqlite_backup`](https://github.com/seanbreckenridge/sqlite_backup) - to safely copy/backup application sqlite databases that may currently be in use -- [`git_doc_history`](https://github.com/seanbreckenridge/git_doc_history) - a bash script to copy/backup files into git history, with a python library to help traverse and create a history/parse diffs between commits -- [`HPI_API`](https://github.com/seanbreckenridge/HPI_API) - automatically creates a JSON API/server for HPI modules -- [`url_metadata`](https://github.com/seanbreckenridge/url_metadata) - caches youtube subtitles, url metadata (title, description, image links), and a html/plaintext summary for any URL +- [`ipgeocache`](https://github.com/purarue/ipgeocache) - for any IPs gathered from data exports, provides geolocation info, so I have partial location info going back to 2013 +- [`sqlite_backup`](https://github.com/purarue/sqlite_backup) - to safely copy/backup application sqlite databases that may currently be in use +- [`git_doc_history`](https://github.com/purarue/git_doc_history) - a bash script to copy/backup files into git history, with a python library to help traverse and create a history/parse diffs between commits +- [`HPI_API`](https://github.com/purarue/HPI_API) - automatically creates a JSON API/server for HPI modules +- [`url_metadata`](https://github.com/purarue/url_metadata) - caches youtube subtitles, url metadata (title, description, image links), and a html/plaintext summary for any URL -I also use this in [`my_feed`](https://github.com/seanbreckenridge/my_feed), which creates a feed of media/data using `HPI`, live at +I also use this in [`my_feed`](https://github.com/purarue/my_feed), which creates a feed of media/data using `HPI`, live at ### Ad-hoc and interactive @@ -142,7 +142,7 @@ Song I've listened to most? ```python >>> import collections, my.mpv.history_daemon >>> collections.Counter([m.path for m in my.mpv.history_daemon.history()]).most_common(1)[0][0] -'/home/sean/Music/JPEFMAFIA/JPEGMAFIA - LP! - 2021 - V0/JPEGMAFIA - LP! - 05 HAZARD DUTY PAY!.mp3' +'/home/username/Music/JPEFMAFIA/JPEGMAFIA - LP! - 2021 - V0/JPEGMAFIA - LP! - 05 HAZARD DUTY PAY!.mp3' ``` Movie I've watched most? @@ -156,7 +156,7 @@ Movie I've watched most? `hpi` also has a JSON query interface, so I can do quick computations using shell tools like: ```bash -# how many calories have I eaten today (from https://github.com/seanbreckenridge/ttally) +# how many calories have I eaten today (from https://github.com/purarue/ttally) $ hpi query ttally.__main__.food --recent 1d -s | jq -r '(.quantity)*(.calories)' | datamash sum 1 2258.5 ``` @@ -171,28 +171,28 @@ git clone https://github.com/karlicoss/HPI ./HPI-karlicoss python3 -m pip install --user -e ./HPI-karlicoss # clone and install my repository as an editable package -git clone https://github.com/seanbreckenridge/HPI ./HPI-seanb -python3 -m pip install --user -e ./HPI-seanb +git clone https://github.com/purarue/HPI ./HPI-pura +python3 -m pip install --user -e ./HPI-pura ``` Editable install means any changes to python files reflect immediately, which is very convenient for debugging and developing new modules. To update, you can just `git pull` in those directories. -If you care about [overriding modules](https://github.com/seanbreckenridge/HPI#partially-in-usewith-overrides), to make sure your `easy-install.pth` is ordered correctly: +If you care about [overriding modules](https://github.com/purarue/HPI#partially-in-usewith-overrides), to make sure your `easy-install.pth` is ordered correctly: ```bash python3 -m pip install --user reorder_editable -python3 -m reorder_editable reorder ./HPI-seanb ./HPI-karlicoss +python3 -m reorder_editable reorder ./HPI-pura ./HPI-karlicoss ``` Then, you likely need to run `hpi module install` for any modules you plan on using -- this can be done incrementally as you setup new modules. E.g.: - `hpi module install my.trakt.export` to install dependencies -- Check the [stub config](./tests/my/my/config/__init__.py) or [my config](https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py) and setup the config block in your HPI configuration file +- Check the [stub config](./tests/my/my/config/__init__.py) or [my config](https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py) and setup the config block in your HPI configuration file - Run `hpi doctor my.trakt.export` to check for any possible config issues/if your data is being loaded properly (The [install](./install) script does that for all my modules, but you likely don't want to do that) -Its possible to install both `my` packages because `HPI` is a namespace package. For more information on that, and some of the complications one can run into, see [reorder_editable](https://github.com/seanbreckenridge/reorder_editable#editable-namespace-packages), and the [module design](https://github.com/karlicoss/HPI/blob/master/doc/MODULE_DESIGN.org#adding-new-modules) docs for HPI. +Its possible to install both `my` packages because `HPI` is a namespace package. For more information on that, and some of the complications one can run into, see [reorder_editable](https://github.com/purarue/reorder_editable#editable-namespace-packages), and the [module design](https://github.com/karlicoss/HPI/blob/master/doc/MODULE_DESIGN.org#adding-new-modules) docs for HPI. If you're having issues installing/re-installing, check the [TROUBLESHOOTING_INSTALLS.md](doc/TROUBLESHOOTING_INSTALLS.md) file. diff --git a/doc/MAIL_SETUP.md b/doc/MAIL_SETUP.md index 20a795b7..2c0e0266 100644 --- a/doc/MAIL_SETUP.md +++ b/doc/MAIL_SETUP.md @@ -1,4 +1,4 @@ -This is a distillation of the steps described in [this issue](https://github.com/seanbreckenridge/HPI/issues/15) +This is a distillation of the steps described in [this issue](https://github.com/purarue/HPI/issues/15) There are two mail parsing modules here -- `my.mail.imap` and `my.mail.mbox`. An [`mbox` file](https://docs.python.org/3/library/mailbox.html) is just a collection of email messages in a single text file @@ -10,9 +10,9 @@ Note: There are _lots of_ different ways email clients/websites will export mess ## `my.mail.imap` -Personally, I use `my.mail.imap`. To sync my mail, I use [`mutt-wizard`](https://github.com/LukeSmithxyz/mutt-wizard/), which uses `mbsync` under the hood to saves a bunch of individual mail files in `~/.local/share/mail` -- updating every 5 minutes. As a visual comparison to any files you may be trying to parse, [this is what one of those files looks like](https://gist.github.com/seanbreckenridge/5a629efacd72e7c28de0930f7e3ed8cf) +Personally, I use `my.mail.imap`. To sync my mail, I use [`mutt-wizard`](https://github.com/LukeSmithxyz/mutt-wizard/), which uses `mbsync` under the hood to saves a bunch of individual mail files in `~/.local/share/mail` -- updating every 5 minutes. As a visual comparison to any files you may be trying to parse, [this is what one of those files looks like](https://gist.github.com/purarue/5a629efacd72e7c28de0930f7e3ed8cf) -There are, of course, hundreds of ways to save your mail locally. Lets take [the ImportTools thunderbird add-on](https://addons.thunderbird.net/en-US/thunderbird/addon/importexporttools-ng/) as an example (since its the one we did troubleshooting on in the [issue](https://github.com/seanbreckenridge/HPI/issues/15)). To match the format `my.mail.imap` expects, select the folder you want to export, then use `Tools > ImportExportToolsNg > Export all messages in the Folder > Plain Text Format`, and export it to a folder somewhere. Then, in your config file, setup the block to point it at that path: +There are, of course, hundreds of ways to save your mail locally. Lets take [the ImportTools thunderbird add-on](https://addons.thunderbird.net/en-US/thunderbird/addon/importexporttools-ng/) as an example (since its the one we did troubleshooting on in the [issue](https://github.com/purarue/HPI/issues/15)). To match the format `my.mail.imap` expects, select the folder you want to export, then use `Tools > ImportExportToolsNg > Export all messages in the Folder > Plain Text Format`, and export it to a folder somewhere. Then, in your config file, setup the block to point it at that path: ```python class mail: @@ -89,4 +89,4 @@ hpi --debug query my.mail.mbox --stream --- -If you use a different format and aren't able to figure out how to parse it, [create an issue](https://github.com/seanbreckenridge/HPI/issues/new) +If you use a different format and aren't able to figure out how to parse it, [create an issue](https://github.com/purarue/HPI/issues/new) diff --git a/doc/TROUBLESHOOTING_INSTALLS.md b/doc/TROUBLESHOOTING_INSTALLS.md index 2eb699f4..49b4d66c 100644 --- a/doc/TROUBLESHOOTING_INSTALLS.md +++ b/doc/TROUBLESHOOTING_INSTALLS.md @@ -2,27 +2,27 @@ It seems that sometimes installing from git has weird side effects with upgradin If you're having issues -- try doing the following -I'll use my promnesia modules (at ) as an example. +I'll use my promnesia modules (at ) as an example. -Note: though the repository is `promnesia`, the module it installs is `promnesia_sean`. In python packages in general, its not necessary for the module name to match the repository (that's just where its hosted). To figure out what the name of the package is, use `python3 -m pip list`. For this HPI repository, it installs as `HPI-seanbreckenridge`, so its possible to differentiate between this and upstream HPI. +Note: though the repository is `promnesia`, the module it installs is `promnesia_pura`. In python packages in general, its not necessary for the module name to match the repository (that's just where its hosted). To figure out what the name of the package is, use `python3 -m pip list`. For this HPI repository, it installs as `HPI-purarue`, so its possible to differentiate between this and upstream HPI. -These are directions for installing a package as non-editable (into your python `site-packages`), though it covers uninstalling editable packages -- in case your path is misconfigured in some way. If you want to install as editable, see [reorder_editable](https://github.com/seanbreckenridge/reorder_editable) and the [install section](https://github.com/seanbreckenridge/HPI#install) of the README for issues you may run into, or see the [editable](#editable) section of this doc +These are directions for installing a package as non-editable (into your python `site-packages`), though it covers uninstalling editable packages -- in case your path is misconfigured in some way. If you want to install as editable, see [reorder_editable](https://github.com/purarue/reorder_editable) and the [install section](https://github.com/purarue/HPI#install) of the README for issues you may run into, or see the [editable](#editable) section of this doc Whenever there are directions to use `pip` to do something -- its safer to do `python3 -m pip` (unless you know exactly what you're doing with managing multiple python installs on your system). That makes sure the `pip` that is being used is the same version as when you use `python3` Uninstall the package you're using: ```bash -python3 -m pip uninstall -y promnesia_sean +python3 -m pip uninstall -y promnesia_pura ``` Make sure its actually uninstalled -- this should error: ```bash -$ python3 -c "import promnesia_sean" +$ python3 -c "import promnesia_pura" Traceback (most recent call last): File "", line 1, in -ModuleNotFoundError: No module named 'promnesia_sean' +ModuleNotFoundError: No module named 'promnesia_pura' ``` Note: For `HPI` in particular (since its a namespace package), if you're trying to uninstall my modules but leaves `karlicoss`'s (the core) modules installed, `import my` won't error. Instead, try something like `import my.trakt.export`, since that would only appear in my modules. @@ -32,31 +32,30 @@ If that still imports, you likely have files leftover in your site packages. To ```bash $ python3 -m site sys.path = [ - '/home/sean', + '/home/username', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', - '/home/sean/.local/lib/python3.10/site-packages', - '/home/sean/Repos/my_feed/src', - '/home/sean/Repos/albums', - '/home/sean/Repos/mint/budget', - '/home/sean/.config/seanb', - '/home/sean/Repos/HPI-personal', - '/home/sean/Repos/HPI', - '/home/sean/Repos/HPI-karlicoss', - '/home/sean/Repos/promnesia-fork/src', + '/home/username/.local/lib/python3.10/site-packages', + '/home/username/Repos/my_feed/src', + '/home/username/Repos/albums', + '/home/username/Repos/mint/budget', + '/home/username/Repos/HPI-personal', + '/home/username/Repos/HPI', + '/home/username/Repos/HPI-karlicoss', + '/home/username/Repos/promnesia-fork/src', '/usr/lib/python3.10/site-packages', ] -USER_BASE: '/home/sean/.local' (exists) -USER_SITE: '/home/sean/.local/lib/python3.10/site-packages' (exists) +USER_BASE: '/home/username/.local' (exists) +USER_SITE: '/home/username/.local/lib/python3.10/site-packages' (exists) ENABLE_USER_SITE: True ``` That should let you which directories python is scanning for imports. Check any of the `site-packages` directories, for files like: ``` -promnesia_sean -promnesia_sean-0.0.0.dist-info +promnesia_prua +promnesia_pura-0.0.0.dist-info ``` and remove those (this is essentially a 'manually uninstall' of a broken package) @@ -69,15 +68,15 @@ python3 -m reorder_editable locate # should show you where which editable insta python3 -m reorder_editable cat ``` -Refer to the [reorder_editable](https://github.com/seanbreckenridge/reorder_editable) README for more info on that. +Refer to the [reorder_editable](https://github.com/purarue/reorder_editable) README for more info on that. You should now be able to confirm it errors, like: ```bash -$ python3 -c "import promnesia_sean" +$ python3 -c "import promnesia_pura" Traceback (most recent call last): File "", line 1, in -ModuleNotFoundError: No module named 'promnesia_sean' +ModuleNotFoundError: No module named 'promnesia_pura' ``` Now -- to install it again! @@ -85,15 +84,15 @@ Now -- to install it again! Instead of installing from git (since that can sometimes cache the result and run into other issues), clone it to some local directory: ```bash -git clone https://github.com/seanbreckenridge/promnesia ./promnesia_sean +git clone https://github.com/purarue/promnesia ./promnesia_pura ``` -Then, you can install it by pointing it at the directory with includes the `setup.py` file, like: `python3 -m pip install --user ./promnesia_sean` +Then, you can install it by pointing it at the directory with includes the `setup.py` file, like: `python3 -m pip install --user ./promnesia_pura` You should now be able to confirm it imports properly: ```python3 -python3 -c "import promnesia_sean" +python3 -c "import promnesia_pura" ``` ### Editable @@ -101,14 +100,14 @@ python3 -c "import promnesia_sean" Alternatively, since you already have it locally, you can install it as editable: ```bash -python3 -m pip install --user -e ./promnesia_sean +python3 -m pip install --user -e ./promnesia_pura ``` That should modify your `sys.path` (run `python3 -m site`; and you'll see that directory appear on your path) -That has the added benefit that whenever you want to update `promnesia_sean`, you can just: +That has the added benefit that whenever you want to update `promnesia_pura`, you can just: ```bash -cd /path/to/promnesia_sean +cd /path/to/promnesia_pura git pull ``` diff --git a/install b/install index cff46587..62895a5b 100755 --- a/install +++ b/install @@ -190,7 +190,7 @@ ci_config() { ci_tests() { echo 'Running tests' | maybe_boxes - ci && unset HPI_TESTS_SEANB + ci && unset HPI_TESTS_PURA python3 -m pytest ./tests || return $? } diff --git a/my/activitywatch/active_window.py b/my/activitywatch/active_window.py index b30a5067..4570d53a 100644 --- a/my/activitywatch/active_window.py +++ b/my/activitywatch/active_window.py @@ -1,14 +1,14 @@ """ -Parses history from https://github.com/seanbreckenridge/aw-watcher-window -using https://github.com/seanbreckenridge/active_window +Parses history from https://github.com/purarue/aw-watcher-window +using https://github.com/purarue/active_window """ REQUIRES = [ - "git+https://github.com/seanbreckenridge/aw-watcher-window", - "git+https://github.com/seanbreckenridge/active_window", + "git+https://github.com/purarue/aw-watcher-window", + "git+https://github.com/purarue/active_window", ] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import activitywatch as user_config # type: ignore[attr-defined] from pathlib import Path @@ -16,7 +16,8 @@ from functools import partial from itertools import chain -from my.core import get_files, Stats, Paths, dataclass, make_logger, make_config +from dataclasses import dataclass +from my.core import get_files, Stats, Paths, make_logger, make_config from my.utils.input_source import InputSource from more_itertools import unique_everseen diff --git a/my/apple/privacy_export.py b/my/apple/privacy_export.py index 0ba5cc66..fa1bb1c4 100644 --- a/my/apple/privacy_export.py +++ b/my/apple/privacy_export.py @@ -5,9 +5,10 @@ REQUIRES = ["lxml"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import apple as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass +from dataclasses import dataclass +from my.core import PathIsh @dataclass @@ -29,7 +30,7 @@ class config(user_config.privacy_export): Element = Union[_Element, None] from my.core import Stats, Res, make_logger -from my.core.common import mcachew +from my.core.cachew import mcachew logger = make_logger(__name__) diff --git a/my/bash.py b/my/bash.py index 4d8f098b..4b297793 100644 --- a/my/bash.py +++ b/my/bash.py @@ -1,7 +1,7 @@ """ Parses bash history (mostly from servers/vps I run) using the following bootstrap script: -https://github.com/seanbreckenridge/bootstrap/ +https://github.com/purarue/bootstrap/ This parses bash history with the following configuration: @@ -22,7 +22,7 @@ which ls """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import bash as user_config # type: ignore[attr-defined] from pathlib import Path @@ -33,8 +33,9 @@ from more_itertools import unique_everseen -from my.core import get_files, Stats, make_logger, Paths, dataclass -from my.core.common import mcachew +from dataclasses import dataclass +from my.core import get_files, Stats, make_logger, Paths +from my.core.cachew import mcachew from my.utils.time import parse_datetime_sec from my.utils.input_source import InputSource diff --git a/my/blizzard/gdpr.py b/my/blizzard/gdpr.py index 39f27004..f7d6d6ca 100644 --- a/my/blizzard/gdpr.py +++ b/my/blizzard/gdpr.py @@ -1,12 +1,13 @@ """ Parses generic event data from my parsed GDPR data -from: https://github.com/seanbreckenridge/blizzard_gdpr_parser +from: https://github.com/purarue/blizzard_gdpr_parser """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import blizzard as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass, make_logger -from my.core.common import mcachew +from dataclasses import dataclass +from my.core import PathIsh, make_logger +from my.core.cachew import mcachew @dataclass diff --git a/my/chess/export.py b/my/chess/export.py index e4bdaaad..3617eca0 100644 --- a/my/chess/export.py +++ b/my/chess/export.py @@ -1,11 +1,11 @@ """ Parses chess games from chess.com/lichess.org using -https://github.com/seanbreckenridge/chess_export +https://github.com/purarue/chess_export """ -REQUIRES = ["git+https://github.com/seanbreckenridge/chess_export"] +REQUIRES = ["git+https://github.com/purarue/chess_export"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import chess as user_config # type: ignore[attr-defined] @@ -17,8 +17,9 @@ import chess_export.lichess.model as lmodel from more_itertools import unique_everseen -from my.core import get_files, Stats, make_logger, Paths, dataclass -from my.core.common import mcachew +from dataclasses import dataclass +from my.core import get_files, Stats, make_logger, Paths +from my.core.cachew import mcachew from my.utils.input_source import InputSource diff --git a/my/discord/data_export.py b/my/discord/data_export.py index a840e34a..00a8265e 100644 --- a/my/discord/data_export.py +++ b/my/discord/data_export.py @@ -3,23 +3,24 @@ """ REQUIRES = [ - "git+https://github.com/seanbreckenridge/discord_data", + "git+https://github.com/purarue/discord_data", "urlextract", ] from pathlib import Path from typing import List +from dataclasses import dataclass from my.config import discord as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass, make_config -from my.core.common import mcachew +from my.core import PathIsh, make_config +from my.core.cachew import mcachew @dataclass class discord_config(user_config.data_export): # path to the top level discord export directory - # see https://github.com/seanbreckenridge/discord_data for more info + # see https://github.com/purarue/discord_data for more info export_path: PathIsh # whether to guess the compression of the files in the export_path @@ -107,12 +108,16 @@ def test_remove_link_suppression() -> None: expected = "text https://urlextract.readthedocs.io other text" assert _remove_link_suppression(content) == expected - content = "t other f " - expected = "t https://urlextract.readthedocs.io other github.com f sean.fish" + content = ( + "t other f " + ) + expected = ( + "t https://urlextract.readthedocs.io other github.com f other.website" + ) assert _remove_link_suppression(content) == expected - content = "t " - expected = "t https://urlextract.readthedocs.io sean.fish" + content = "t " + expected = "t https://urlextract.readthedocs.io other.website" assert _remove_link_suppression(content) == expected diff --git a/my/facebook/gdpr.py b/my/facebook/gdpr.py index efcf9ce0..7604c939 100644 --- a/my/facebook/gdpr.py +++ b/my/facebook/gdpr.py @@ -2,9 +2,10 @@ Parses the facebook GPDR Export """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import facebook as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass +from dataclasses import dataclass +from my.core import PathIsh @dataclass @@ -502,7 +503,7 @@ def _parse_posts(d: FacebookJson) -> Iterator[Res[Union[Post, Action]]]: ) else: yield RuntimeError("No known way to parse basic post {}".format(post)) - # post without any actual content (e.g. {'timestamp': 1334515711, 'title': 'Sean Breckenridge posted in club'}) + # post without any actual content (e.g. {'timestamp': 1334515711, 'title': 'purarue posted in club'}) # treat this as an action since I have no content here elif set(("timestamp", "title")) == set(post.keys()): yield Action( diff --git a/my/grouvee/export.py b/my/grouvee/export.py index ecb07494..99c60f49 100644 --- a/my/grouvee/export.py +++ b/my/grouvee/export.py @@ -2,9 +2,9 @@ Parses the CSV export from https://www.grouvee.com/ """ -REQUIRES = ["git+https://github.com/seanbreckenridge/grouvee_export"] +REQUIRES = ["git+https://github.com/purarue/grouvee_export"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import grouvee as user_config # type: ignore[attr-defined] from pathlib import Path @@ -14,7 +14,8 @@ from more_itertools import last import grouvee_export.dal as G -from my.core import get_files, Stats, Paths, dataclass +from dataclasses import dataclass +from my.core import get_files, Stats, Paths @dataclass diff --git a/my/ip/all.py b/my/ip/all.py index 2fe93c1d..c587ec6d 100644 --- a/my/ip/all.py +++ b/my/ip/all.py @@ -2,7 +2,7 @@ Combines IPs from data exports which include IP addresses """ -REQUIRES = ["git+https://github.com/seanbreckenridge/ipgeocache"] +REQUIRES = ["git+https://github.com/purarue/ipgeocache"] from typing import Iterator diff --git a/my/ip/discord.py b/my/ip/discord.py index a606c95d..069fffc8 100644 --- a/my/ip/discord.py +++ b/my/ip/discord.py @@ -4,7 +4,7 @@ from my.core import make_logger, Stats -from my.core.common import mcachew +from my.core.cachew import mcachew from my.core.source import import_source logger = make_logger(__name__) diff --git a/my/ip/facebook.py b/my/ip/facebook.py index c612b7bd..d02226eb 100644 --- a/my/ip/facebook.py +++ b/my/ip/facebook.py @@ -5,7 +5,7 @@ from my.core import make_logger, Stats from my.core.source import import_source -from my.core.common import mcachew +from my.core.cachew import mcachew logger = make_logger(__name__) diff --git a/my/ipython.py b/my/ipython.py index 57aca509..93364f6a 100644 --- a/my/ipython.py +++ b/my/ipython.py @@ -19,10 +19,11 @@ REQUIRES = ["ipython>=8.5.0"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import ipython as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/league/export.py b/my/league/export.py index 34073fd3..ca897b7d 100644 --- a/my/league/export.py +++ b/my/league/export.py @@ -1,13 +1,14 @@ """ -Parses league of legend history from https://github.com/seanbreckenridge/lolexport +Parses league of legend history from https://github.com/purarue/lolexport """ -REQUIRES = ["git+https://github.com/seanbreckenridge/lolexport"] +REQUIRES = ["git+https://github.com/purarue/lolexport"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import league as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/linkedin/privacy_export.py b/my/linkedin/privacy_export.py index 8a2a407f..5767f680 100644 --- a/my/linkedin/privacy_export.py +++ b/my/linkedin/privacy_export.py @@ -5,10 +5,11 @@ REQUIRES = ["dateparser"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import linkedin as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass +from dataclasses import dataclass +from my.core import PathIsh @dataclass diff --git a/my/listenbrainz/export.py b/my/listenbrainz/export.py index b72fb5f5..58c6bbd5 100644 --- a/my/listenbrainz/export.py +++ b/my/listenbrainz/export.py @@ -1,11 +1,11 @@ """ Parses scrobbles from https://listenbrainz.org/ using -https://github.com/seanbreckenridge/listenbrainz_export +https://github.com/purarue/listenbrainz_export """ -REQUIRES = ["git+https://github.com/seanbreckenridge/listenbrainz_export"] +REQUIRES = ["git+https://github.com/purarue/listenbrainz_export"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import listenbrainz as user_config # type: ignore[attr-defined] @@ -16,7 +16,8 @@ from listenbrainz_export.parse import Listen, iter_listens from more_itertools import unique_everseen -from my.core import get_files, Stats, make_logger, Paths, dataclass +from dataclasses import dataclass +from my.core import get_files, Stats, make_logger, Paths from my.utils.input_source import InputSource diff --git a/my/location/apple.py b/my/location/apple.py index 71409546..4946bbad 100644 --- a/my/location/apple.py +++ b/my/location/apple.py @@ -1,6 +1,5 @@ from typing import Iterator -from my.core.common import Stats from my.core.source import import_source from my.location.common import Location # type: ignore[import] @@ -19,9 +18,3 @@ def locations() -> Iterator[Location]: elevation=None, datasource="apple", ) - - -def stats() -> Stats: - from my.core import stat - - return {**stat(locations)} diff --git a/my/mail/all.py b/my/mail/all.py index be84128e..226c9657 100644 --- a/my/mail/all.py +++ b/my/mail/all.py @@ -6,7 +6,7 @@ REQUIRES = ["mail-parser", "dateparser"] -MAIL_HELP = "https://github.com/seanbreckenridge/HPI/blob/master/doc/MAIL_SETUP.md" +MAIL_HELP = "https://github.com/purarue/HPI/blob/master/doc/MAIL_SETUP.md" src_imap = import_source(module_name="my.mail.imap", help_url=MAIL_HELP) src_mbox = import_source(module_name="my.mail.mbox", help_url=MAIL_HELP) diff --git a/my/mail/imap.py b/my/mail/imap.py index a27fc95e..e3e1581b 100644 --- a/my/mail/imap.py +++ b/my/mail/imap.py @@ -6,7 +6,7 @@ REQUIRES = ["mail-parser", "dateparser"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import mail as user_config # type: ignore[attr-defined] from pathlib import Path @@ -18,7 +18,8 @@ ) -from my.core import Stats, Paths, dataclass, get_files, make_config +from dataclasses import dataclass +from my.core import Stats, Paths, get_files, make_config from .common import Email, unique_mail diff --git a/my/mail/mbox.py b/my/mail/mbox.py index 26755654..347ba5cf 100644 --- a/my/mail/mbox.py +++ b/my/mail/mbox.py @@ -4,14 +4,15 @@ REQUIRES = ["mail-parser", "dateparser"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import mail as user_config # type: ignore[attr-defined] import mailbox from pathlib import Path from typing import List, Iterator, Optional, Sequence, IO, Any -from my.core import Stats, Paths, dataclass, get_files +from dataclasses import dataclass +from my.core import Stats, Paths, get_files from my.core import make_logger from .common import Email, unique_mail, try_decode_buf diff --git a/my/mal/export.py b/my/mal/export.py index a372d9c6..3921677b 100644 --- a/my/mal/export.py +++ b/my/mal/export.py @@ -1,11 +1,11 @@ """ Parses the data directory for my MAL export -Uses https://github.com/seanbreckenridge/malexport/ +Uses https://github.com/purarue/malexport/ """ -REQUIRES = ["git+https://github.com/seanbreckenridge/malexport"] +REQUIRES = ["git+https://github.com/purarue/malexport"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import mal as user_config # type: ignore[attr-defined] from pathlib import Path @@ -13,7 +13,8 @@ from typing import Iterator, List, Tuple, NamedTuple, Optional from functools import lru_cache -from my.core import Stats, make_logger, PathIsh, dataclass, make_config, get_files +from dataclasses import dataclass +from my.core import Stats, make_logger, PathIsh, make_config, get_files from my.core.structure import match_structure from malexport.paths import LocalDir @@ -30,7 +31,7 @@ class mal_config(user_config.export): export_path: PathIsh # this should be the top level directory, not the zip files or username directories - # see https://github.com/seanbreckenridge/malexport/#recover_deleted + # see https://github.com/purarue/malexport/#recover_deleted zip_backup_path: Optional[PathIsh] = None diff --git a/my/minecraft/advancements.py b/my/minecraft/advancements.py index 8faeadaf..90525494 100644 --- a/my/minecraft/advancements.py +++ b/my/minecraft/advancements.py @@ -2,13 +2,14 @@ Parses achievement data/timestamps from local minecraft worlds Copied from the ~/.minecraft directory, one for each world Backed up with: -https://github.com/seanbreckenridge/HPI-personal/blob/master/scripts/backup_minecraft_advancements +https://github.com/purarue/HPI-personal/blob/master/scripts/backup_minecraft_advancements """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import minecraft as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/mpv/history_daemon.py b/my/mpv/history_daemon.py index 798bb7b1..679313b9 100644 --- a/my/mpv/history_daemon.py +++ b/my/mpv/history_daemon.py @@ -1,16 +1,17 @@ """ Any Media being played on my computer with mpv Uses my mpv-history-daemon -https://github.com/seanbreckenridge/mpv-history-daemon +https://github.com/purarue/mpv-history-daemon """ -REQUIRES = ["git+https://github.com/seanbreckenridge/mpv-history-daemon"] +REQUIRES = ["git+https://github.com/purarue/mpv-history-daemon"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import mpv as user_config # type: ignore[attr-defined] from typing import Iterator, Sequence, Optional -from my.core import Paths, dataclass, make_config +from dataclasses import dataclass +from my.core import Paths, make_config @dataclass diff --git a/my/offline/listens.py b/my/offline/listens.py index b407a024..1f9a6b0e 100644 --- a/my/offline/listens.py +++ b/my/offline/listens.py @@ -1,10 +1,10 @@ """ -Parses scrobbles from https://github.com/seanbreckenridge/offline_listens +Parses scrobbles from https://github.com/purarue/offline_listens """ -REQUIRES = ["git+https://github.com/seanbreckenridge/offline_listens"] +REQUIRES = ["git+https://github.com/purarue/offline_listens"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import offline as user_config # type: ignore[attr-defined] @@ -14,7 +14,8 @@ from offline_listens.listens import Listen from offline_listens.parse import iter_dir, parse_file -from my.core import get_files, Stats, Paths, dataclass +from dataclasses import dataclass +from my.core import get_files, Stats, Paths from my.utils.input_source import InputSource diff --git a/my/piazza/scraper.py b/my/piazza/scraper.py index 8dfd4cb5..cde4f946 100644 --- a/my/piazza/scraper.py +++ b/my/piazza/scraper.py @@ -1,13 +1,14 @@ """ Parses piazza posts scraped by -https://github.com/seanbreckenridge/piazza-scraper +https://github.com/purarue/piazza-scraper """ -REQUIRES = ["git+https://github.com/seanbreckenridge/piazza-scraper"] +REQUIRES = ["git+https://github.com/purarue/piazza-scraper"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import piazza as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/project_euler.py b/my/project_euler.py index cbf46fb9..1a981810 100644 --- a/my/project_euler.py +++ b/my/project_euler.py @@ -12,10 +12,11 @@ That txt file is what this accepts as input (can accept multiple) """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import project_euler as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/rss/newsboat/git_history.py b/my/rss/newsboat/git_history.py index b7e9ba4d..950a8254 100644 --- a/my/rss/newsboat/git_history.py +++ b/my/rss/newsboat/git_history.py @@ -2,10 +2,10 @@ Parses when I added/removed newsboat subscriptions """ -REQUIRES = ["git+https://github.com/seanbreckenridge/git_doc_history"] +REQUIRES = ["git+https://github.com/purarue/git_doc_history"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import rss as user_config # type: ignore[attr-defined] @@ -22,7 +22,8 @@ Diff, ) -from my.core import Stats, PathIsh, dataclass +from dataclasses import dataclass +from my.core import Stats, PathIsh @dataclass diff --git a/my/runelite/screenshots.py b/my/runelite/screenshots.py index 0112b36e..e5b1c5ca 100644 --- a/my/runelite/screenshots.py +++ b/my/runelite/screenshots.py @@ -4,10 +4,11 @@ https://github.com/runelite/runelite/wiki/Screenshot """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import runelite as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/scramble/history.py b/my/scramble/history.py index 019cf04d..362e600c 100644 --- a/my/scramble/history.py +++ b/my/scramble/history.py @@ -1,13 +1,14 @@ """ Timed Rubiks Cube Solve History from multiple sources using -https://github.com/seanbreckenridge/scramble-history +https://github.com/purarue/scramble-history """ -REQUIRES = ["git+https://github.com/seanbreckenridge/scramble-history"] +REQUIRES = ["git+https://github.com/purarue/scramble-history"] from pathlib import Path from typing import Optional -from my.core import dataclass, PathIsh, make_config +from dataclasses import dataclass +from my.core import PathIsh, make_config from my.config import scramble as user_config # type: ignore[attr-defined] diff --git a/my/skype/gdpr.py b/my/skype/gdpr.py index e54c6a38..c53fc6eb 100644 --- a/my/skype/gdpr.py +++ b/my/skype/gdpr.py @@ -9,10 +9,11 @@ # as well use the datetimes for context on when I # was using skype -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import skype as user_config # type: ignore[attr-defined] -from my.core import Paths, Stats, dataclass +from dataclasses import dataclass +from my.core import Paths, Stats @dataclass diff --git a/my/spotify/gdpr.py b/my/spotify/gdpr.py index 735743a5..482e6f8c 100644 --- a/my/spotify/gdpr.py +++ b/my/spotify/gdpr.py @@ -2,10 +2,11 @@ Parses the spotify GPDR Export """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import spotify as user_config # type: ignore[attr-defined] -from my.core import PathIsh, Stats, dataclass +from dataclasses import dataclass +from my.core import PathIsh, Stats @dataclass diff --git a/my/steam/scraper.py b/my/steam/scraper.py index bad2c3d8..3f7179bd 100644 --- a/my/steam/scraper.py +++ b/my/steam/scraper.py @@ -1,11 +1,12 @@ """ Parses steam game/achievement data scraped with -https://github.com/seanbreckenridge/steamscraper +https://github.com/purarue/steamscraper """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import steam as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass diff --git a/my/todotxt/active.py b/my/todotxt/active.py index 6b8a0f05..e417e3ec 100644 --- a/my/todotxt/active.py +++ b/my/todotxt/active.py @@ -5,7 +5,7 @@ REQUIRES = ["pytodotxt>=1.5.0"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import todotxt as user_config # type: ignore[attr-defined] @@ -15,7 +15,8 @@ Iterator, ) -from my.core import Stats, PathIsh, dataclass +from dataclasses import dataclass +from my.core import Stats, PathIsh from .common import Todo, TODOTXT_FILES, parse_todotxt_buffer diff --git a/my/todotxt/common.py b/my/todotxt/common.py index 56667d3e..49374528 100644 --- a/my/todotxt/common.py +++ b/my/todotxt/common.py @@ -28,7 +28,7 @@ def _serialize(self) -> Dict[str, Any]: def bare(self) -> str: return cast(str, self.bare_description()) - # parse the deadline created by https://github.com/seanbreckenridge/full_todotxt + # parse the deadline created by https://github.com/purarue/full_todotxt # this is optional, so if it fails, just return None @property def deadline(self) -> Optional[datetime]: diff --git a/my/todotxt/git_history.py b/my/todotxt/git_history.py index 9eeac3d6..14b8f672 100644 --- a/my/todotxt/git_history.py +++ b/my/todotxt/git_history.py @@ -1,15 +1,15 @@ """ Parses todotxt (http://todotxt.org/) done.txt and todo.txt history -from https://github.com/seanbreckenridge/git_doc_history backups +from https://github.com/purarue/git_doc_history backups """ REQUIRES = [ "pytodotxt>=1.5.0", - "git+https://github.com/seanbreckenridge/git_doc_history", + "git+https://github.com/purarue/git_doc_history", ] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import todotxt as user_config # type: ignore[attr-defined] @@ -19,7 +19,8 @@ from git_doc_history import DocHistory, parse_snapshot_diffs, Action -from my.core import Stats, PathIsh, dataclass +from dataclasses import dataclass +from my.core import Stats, PathIsh from .common import Todo, TODOTXT_FILES, parse_todotxt_buffer diff --git a/my/trakt/export.py b/my/trakt/export.py index 09265243..4fe4dcde 100644 --- a/my/trakt/export.py +++ b/my/trakt/export.py @@ -1,11 +1,11 @@ """ Parses the dump of my movies/tv shows history and watchlist from https://trakt.tv/ -Uses https://github.com/seanbreckenridge/traktexport +Uses https://github.com/purarue/traktexport """ -REQUIRES = ["git+https://github.com/seanbreckenridge/traktexport"] +REQUIRES = ["git+https://github.com/purarue/traktexport"] -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import trakt as user_config # type: ignore[attr-defined] from pathlib import Path @@ -15,8 +15,9 @@ import traktexport.dal as D from traktexport.merge import read_and_merge_exports -from my.core import get_files, Stats, make_logger, Paths, dataclass -from my.core.common import mcachew +from dataclasses import dataclass +from my.core import get_files, Stats, make_logger, Paths +from my.core.cachew import mcachew @dataclass diff --git a/my/ttt.py b/my/ttt.py index 346529bb..bcf2ced0 100644 --- a/my/ttt.py +++ b/my/ttt.py @@ -1,8 +1,8 @@ """ -Parses history from https://github.com/seanbreckenridge/ttt +Parses history from https://github.com/purarue/ttt """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import ttt as user_config # type: ignore[attr-defined] import csv @@ -13,7 +13,8 @@ from more_itertools import unique_everseen -from my.core import get_files, Stats, Paths, dataclass +from dataclasses import dataclass +from my.core import get_files, Stats, Paths from my.utils.time import parse_datetime_sec from my.utils.input_source import InputSource diff --git a/my/twitch/gdpr.py b/my/twitch/gdpr.py index 818c9db2..8b02e209 100644 --- a/my/twitch/gdpr.py +++ b/my/twitch/gdpr.py @@ -3,10 +3,11 @@ https://www.twitch.tv/p/en/legal/privacy-choices/#user-privacy-requests """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import twitch as user_config # type: ignore[attr-defined] -from my.core import PathIsh, dataclass +from dataclasses import dataclass +from my.core import PathIsh @dataclass @@ -22,7 +23,8 @@ class config(user_config.gdpr): from .common import Event, Results from my.core import make_logger -from my.core.common import get_files, mcachew, Stats +from my.core.cachew import mcachew +from my.core.common import get_files from my.utils.input_source import InputSource logger = make_logger(__name__) @@ -57,9 +59,3 @@ def _parse_csv_file(p: Path) -> Iterator[Event]: channel=line[5], context=context, ) - - -def stats() -> Stats: - from my.core import stat - - return {**stat(events)} diff --git a/my/twitch/overrustle_logs.py b/my/twitch/overrustle_logs.py index 5315b581..d776fc3e 100644 --- a/my/twitch/overrustle_logs.py +++ b/my/twitch/overrustle_logs.py @@ -1,12 +1,13 @@ """ Reads parsed information from the overrustle logs dump -https://github.com/seanbreckenridge/overrustle_parser +https://github.com/purarue/overrustle_parser """ -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import twitch as user_config # type: ignore[attr-defined] -from my.core import Paths, dataclass +from dataclasses import dataclass +from my.core import Paths @dataclass @@ -19,7 +20,8 @@ class config(user_config.overrustle): from typing import Sequence, List from my.core import make_logger -from my.core.common import get_files, mcachew, Stats +from my.core.cachew import mcachew +from my.core.common import get_files from my.utils.time import parse_datetime_sec from my.utils.input_source import InputSource @@ -50,9 +52,3 @@ def _parse_json_dump(p: Path) -> Results: channel=blob["channel"], context=blob["message"], ) - - -def stats() -> Stats: - from my.core import stat - - return {**stat(events)} diff --git a/my/zsh.py b/my/zsh.py index b542e499..dbe993b3 100644 --- a/my/zsh.py +++ b/my/zsh.py @@ -21,13 +21,14 @@ # if on multiple computers, the zsh histories can be copied into the zsh.export_path # and it will merge everything without duplicates -# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example +# see https://github.com/purarue/dotfiles/blob/master/.config/my/my/config/__init__.py for an example from my.config import zsh as user_config # type: ignore[attr-defined] from pathlib import Path from typing import Sequence, Optional from functools import lru_cache +from dataclasses import dataclass from my.core import ( get_files, warn_if_empty, @@ -35,9 +36,8 @@ make_logger, PathIsh, Paths, - dataclass, ) -from my.core.common import mcachew +from my.core.cachew import mcachew from my.core.warnings import low from my.utils.time import parse_datetime_sec from my.utils.input_source import InputSource diff --git a/scripts/functions.sh b/scripts/functions.sh index c742d3e9..5324555b 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -43,7 +43,7 @@ mpv-recent-path() { mpv-recent "$1" | jq -r .path } alias replay='mpv-recent-path 1 | mpv-from-stdin' -# requires https://github.com/seanbreckenridge/exists, https://github.com/seanbreckenridge/seanb-utils +# requires https://github.com/purarue/exists, https://github.com/purarue/pura-utils replay-recent() { mpv-recent-path "$1" | exists | head -n "${1:-$LINES}" | unique | fzf | mpv-from-stdin } diff --git a/scripts/lint b/scripts/lint index 9cfbad70..4444239d 100755 --- a/scripts/lint +++ b/scripts/lint @@ -30,8 +30,8 @@ havecmd() { set -e havecmd shellcheck -havecmd exists 'See https://github.com/seanbreckenridge/exists' -havecmd rifleman 'See https://github.com/seanbreckenridge/rifleman' +havecmd exists 'See https://github.com/purarue/exists' +havecmd rifleman 'See https://github.com/purarue/rifleman' havecmd pytest havecmd jq havecmd tput diff --git a/setup.cfg b/setup.cfg index 94704d7e..ade3fd61 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,11 @@ [metadata] -name = HPI_seanbreckenridge +name = HPI_purarue version = 0.0.1 description = "A Python interface to my life" long_description = file: README.md long_description_content_type = text/markdown -url = https://github.com/seanbreckenridge/HPI -author = "Sean Breckenridge" -author_email = "seanbrecke@gmail.com" +url = https://github.com/purarue/HPI +author = "purarue" license = MIT license_files = LICENSE classifiers = diff --git a/tests/common.py b/tests/common.py index 71731218..c679aaa5 100644 --- a/tests/common.py +++ b/tests/common.py @@ -4,11 +4,11 @@ import pytest -V = "HPI_TESTS_SEANB" +V = "HPI_TESTS_PURA" -skip_if_not_seanb = pytest.mark.skipif( +skip_if_not_pura = pytest.mark.skipif( V not in os.environ, - reason=f"test on runs on @seanbreckenridge data for now. Set envvar {V}=true to override", + reason=f"test on runs on @purarue data for now. Set envvar {V}=true to override", ) diff --git a/tests/test_apple.py b/tests/test_apple.py index 37f057a9..6ffcb94c 100644 --- a/tests/test_apple.py +++ b/tests/test_apple.py @@ -1,10 +1,10 @@ from more_itertools import ilen -from .common import skip_if_not_seanb +from .common import skip_if_not_pura -@skip_if_not_seanb +@skip_if_not_pura def test_apple_types() -> None: from my.apple.privacy_export import ( events, diff --git a/tests/test_commits.py b/tests/test_commits.py index 876bd45c..ec411245 100644 --- a/tests/test_commits.py +++ b/tests/test_commits.py @@ -2,14 +2,14 @@ from more_itertools import ilen -from .common import skip_if_not_seanb +from .common import skip_if_not_pura def file_count(dir_name: Path) -> int: return ilen(dir_name.rglob("*")) -@skip_if_not_seanb +@skip_if_not_pura def test_commits() -> None: from my.coding.commits import repos, _cached_commits, Commit diff --git a/tests/test_games.py b/tests/test_games.py index a4702168..3fb1ca82 100644 --- a/tests/test_games.py +++ b/tests/test_games.py @@ -3,10 +3,10 @@ from more_itertools import ilen from my.core.error import raise_exceptions -from .common import skip_if_not_seanb +from .common import skip_if_not_pura -@skip_if_not_seanb +@skip_if_not_pura def test_league() -> None: from my.league.export import history, Game @@ -14,7 +14,7 @@ def test_league() -> None: assert len(gs) > 50 -@skip_if_not_seanb +@skip_if_not_pura def test_steam() -> None: from my.steam.scraper import games, achievements, Achievement