Skip to content

Tags: bt-cryptomancer/python-helpers

Tags

1.3.3

Toggle 1.3.3's commit message
v1.3.3 - don't import RedisCache unless it's available

1.3.2

Toggle 1.3.2's commit message
v1.3.2 - r_cache now uses global cache, added unit tests for retry_on…

…_err

1.3.1

Toggle 1.3.1's commit message
v1.3.1 version bump - mostly caching + docs overhaul

1.3.0

Toggle 1.3.0's commit message
v1.3.0 - Added `async_sync`, `run_sync` + More

**asyncx.py**

 - Added `async_sync` decorator for easily running async functions/methods from
non-async functions/methods. Useful for unit tests.
 - Added `run_sync` function, mainly intended for running async functions from the REPL with ease

**common.py**

 - Added `dec_round` for rounding `Decimal` objects to arbitrary DP
 - Added `env_cast`, `env_int`, and `env_decimal`
 - Added `chunked` function for slicing a list into multiple equal sized lists
 - Added `Dictable` abstract class - eases creating Python 3.7 `dataclass` objects from `dict`'s
   as well as converting them back into `dict`'s

**tests.py**

 - Added new `TestGeneral` test case, for unit testing some of the new functions

**Documentation**

 - Added docs for `asyncx` module
 - Updated `common` module to include new functions/classes
 - Fixed docs for `tests`
 - Various cleanup to reduce warnings from Sphinx

1.2.3

Toggle 1.2.3's commit message
v1.2.3 - use info instead of warning when retrying

1.2.2

Toggle 1.2.2's commit message
v1.2.2 - r_cache now accepts a callable for the cache key

1.2.1

Toggle 1.2.1's commit message
v1.2.1 - check we have redis package before defining r_cache/FormatOpt

1.2.0

Toggle 1.2.0's commit message
v1.2.0 - Added r_cache decorator, plus settings/plugin module

 - Added `r_cache` decorator, for easily caching the output of any function/method in Redis
 - Created `plugins.py` module - for initialising and storing third party connection classes e.g. Redis
 - Created `settings.py` module - for dynamically setting certain global configuration options e.g. redis connection details
 - Added `redis` requirement to `docs/requirements.txt` and `README.md` (optional requirement)
 - Created new Test Case for `r_cache` called `TestRedisCache` - tests that caching works, as well as the dynamic cache key
   feature.

1.1.4

Toggle 1.1.4's commit message
v1.1.4 - Added `env_bool` function, csv/kval functions now allow sepa…

…rator to be overriden.

**New functions / code improvements**

 - Added `env_bool` function to `common.py` for loading an environment var as a boolean
 - Added `csvsplit` parameter to parse/env_csv and keyval, to allow changing the item separator from `,`
 - Added `valsplit` parameter to parse/env_keyval, to allow customising the separator between key's and value's from `:`

**Documentation**

 - Added PyDoc param's / return's for various functions, and fleshed out some others
 - Wrapped various docstring values such as ``True`` and ``0`` with backticks so they display better
 - Various small formatting improvements to existing docstrings
 - Added `PrivexBaseCase` and `env_bool` to the docs

**Unit Testing**

 - Refactored various attributes in `test.py` into the base class `PrivexBaseClass`
 - Added example to the PyDoc in `tests.py` showing how to run tests with `pytest`
 - Wrote new unit tests:
     - `test_kval_custom_clean` - Validates that `parse_keyval` works properly with custom `valsplit`/`csvsplit`
     - `test_kval_custom_spaced` - Validates that `parse_keyval` works properly with space padded values and custom `valsplit`/`csvsplit`
     - `test_env_nonexist_bool`, `test_env_bool_true`, `test_env_bool_false` - Validate that the new `env_bool` function returns the correct values.

1.1.2

Toggle 1.1.2's commit message
v1.1.2 - fix AppRegistryNotReady error with django