Jara means bear in Sesotho 🐻
I'm tired of writing same stuff in every project. In addition to this, to make unittests every time for them.
The package is available on pypi so you can install the project with pip install jara-utils
.
- Clone project locally and then:
- Install all dependencies including the test and the dev oanes:
poetry install -E test -D
; - Do changes in the project;
- Create unittests (please make sure you will keep coverage to 100%);
- Run all sanity commands (pytest, flake8, mypy, bandit);
- Check if there is any duplicated or dead fixtures by running
pytest
with--dead-fixtures
and--dup-fixtures
;
- Install all dependencies including the test and the dev oanes:
Note: Run commands using poetry: poetry run <command>
;
- All exceptions:
EnvironmentVariableNotFoundError
when you expect to found an environment variable.
A simple wrapper over os.environ.get(...)
to easy handling environment variables, we have support for types like: string, int, bool, list
Watch out get_list
support only List of str to convert to a list of int for example you should use parse_int
with a list comprehension.
A decorator named timeit
which can be used on sync and async methods to see execution time.
If execution time is below to 0.50 seconds
there will be no log.
Maybe add threshold as environment variable?
- boolean:
str_2_bool
,is_dunder
,is_email
; - datetime:
date_2_datetime
,str_2_datetime
; - integer:
'parse_int
,age_from
; - iterable:
grouper
,async_grouper
,aenumerate
; - string:
snake_to_camel
,camel_to_snake
;
Class used for output, which can be, console (by default), file or any buffer. Can be used for fancy outputs, like color text, highlight (bold) words. Color available and which method will produce the color:
- Cyan (debug)
- Light blue (info)
- Light green (success)
- Yellow (warning)
- Red (error/fail)