Repository for common code used in some of my other repos. Compatible with python 3.13.x
Currently ag95 has the following modules and utilities.:
| Module | Utility | Description |
|---|---|---|
| all | - | Will install all dependencies. |
| DecimalScripts | decimals_places | Returns the number of decimal places for a given float. |
| nr_normalisation | Normalizes a float to a specified number of decimal places without rounding. | |
| round_[up/down]_closer | Rounds a float up or down to its last decimal position. | |
| LoggingScripts | configure_[logger/loggers] | Provides a custom logging solution with numerous quality-of-life features. |
| Threading | ThreadMonitor | Monitors a list of threads until they complete, then notifies upon completion. |
| General | extract_filenames_from_folderpath | Recursively extracts filenames from a folder, filtering by file extension. |
| shorten_long_str | Shortens long strings by inserting an asterisk in the middle. | |
| Singleton_[with/without]_cache | Provides a metaclass for creating singleton classes with optional caching capabilities. | |
| stdin_watcher | Monitors standard input and triggers configurable actions based on specified keywords. | |
| TimeRelated | format_from_seconds | Formats elapsed time (in seconds) into a human-readable string with configurable granularity. |
| TimerContext | Context manager for measuring the execution time of code blocks. | |
| SqliteDatabase | SqLiteDbbackup | Creates backups of SQLite databases. |
| SqLiteDbMigration | Performs schema migrations on SQLite databases. | |
| SqLiteDbWrapper | Offers utilities for managing and manipulating SQLite databases. | |
| SqLiteDbWrapperService | SqLiteDbWrapperService | Flask service served by waitress that wraps all the SqliteDb methods in a highly efficient manner. |
| GenericDatabase | Dbbackup | Creates backups of generic databases (e.g., SQLite). |
| DbMigration | Performs schema migrations on generic databases (e.g., SQLite). | |
| DbWrapper | Provides utilities for managing and manipulating generic databases (e.g., SQLite). | |
| DuckDbDatabase | DuckDbbackup | Creates backups of DuckDB databases. |
| DuckDbMigration | Performs schema migrations on DuckDB databases. | |
| DuckDbWrapper | Offers utilities for managing and manipulating DuckDB databases. | |
| PlotlyRelated | SinglePlot | Constructs a Plotly figure featuring a single plot. |
| MultiRowPlot | Creates a Plotly figure with multiple subplots arranged in rows. | |
| BarPlotDef | Definition class for configuring bar plots in Plotly. | |
| HistogramPlotDef | Definition class for configuring histogram plots in Plotly. | |
| ScatterPlotDef | Definition class for configuring scatter plots in Plotly. | |
| TemplatesHtml | export_html_templates | Exports ready-to-use HTML templates, particularly useful for Django frameworks. |
| DataManipulation | datetime_lists_normalise | Normalizes multiple datetime lists into a unified list with configurable constraints. |
| TradingRelated | TrailingDecision | Implements a trailing mechanism to automate buy/sell decisions based on configurable thresholds. |
| WindowsCredentials | save_password | Saves passwords securely to the Windows Credential Manager. |
| get_password | Retrieves passwords from the Windows Credential Manager. | |
| delete_password | Deletes a specified password from the Windows Credential Manager. | |
| IoT | TuyaCloudControl | Wrapper for managing and reading Tuya devices via the Tuya Cloud. |
| SmartThingsControl | Wrapper for managing and reading SmartThings devices via the SmartThings Cloud. | |
| IO | single_file_transfer | Highly scalable utility for parallel file transfers using chunk segmentation. |
| Colors | red_green_from_range_value | Will output a rgb value between green and red based on a given value, a minimum and a maximum. |
| EmailHandler | send_mail_from_gmail | Will send an email using a gmail account. |
You can quickly access the stuff by
-
use this repo as a submodule (instructions on how to setup git sub-modules can be found here: https://git-scm.com/book/en/v2/Git-Tools-Submodules)
-
install this repo as a package with pip
-
to install the barebone package with no extra dependencies (not recommended as some stuff may not work in this way) you can use
python -m pip install git+https://github.com/ageorge95/ag95.git -
to install the package with extra dependencies specific to your usecase you can use a syntax like this (for older pip versions)
python -m pip install git+https://github.com/ageorge95/ag95.git#egg=ag95[DecimalScripts,SqliteDatabase]or (for newer pip versions)python -m pip install "ag95[DecimalScripts,SqliteDatabase] @ git+https://github.com/ageorge95/ag95.git" -
to upgrade the package you would simply have to use the commands above and add the
--upgradeflag, for example:python -m pip install --upgrade git+https://github.com/ageorge95/ag95.git -
NOTE1: the
extras_requiremechanism was recently introduced as ag95 has grown and contains lots of different parts and some of them do not even require an external dependency while some require multiple dependencies, which slowed time the installation of ag95 considerably. Now, withextras_require, you have to specify exactly which part/ parts of ag95 you will plan to use => the installation is as fast as possible for your particular use cases. -
NOTE2: in the future I might provide wheels for this package, but for now there is not a great need for them.
-
Found this project useful? Send your ❤ in any form you can 🙂. Please contact me if you donated and want to be added to the contributors list !
- chia XCH---xch1glz7ufrfw9xfp5rnlxxh9mt9vk9yc8yjseet5c6u0mmykq8cpseqna6494