Metadata-Version: 2.1
Name: cz-common-python
Version: 4.3.6rc1
Summary: Useful utility functions; remove all the boilerplate
Home-page: https://github.com/Cloudzero/cz-common-python
Author: CloudZero
Author-email: support@cloudzero.com
License: UNLICENSED
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3>=1.14.62
Requires-Dist: boto3-stubs[stepfunctions]
Requires-Dist: botocore>=1.17.62
Requires-Dist: cachetools>=4.1.1
Requires-Dist: simplejson>=3.17.2
Requires-Dist: sentry-sdk>=1.5.11
Requires-Dist: typing-extensions>=3.7.4.3
Requires-Dist: toolz>=0.10.0
Requires-Dist: voluptuous>=0.12.0
Requires-Dist: deprecated>=1.2.10
Requires-Dist: retrying>=1.3.3
Requires-Dist: pydantic<2.0.0
Requires-Dist: pyfaaster>=0.2.0
Requires-Dist: aws-lambda-powertools>=2.9.1
Requires-Dist: aws-xray-sdk>=2.11.0
Requires-Dist: msal>=1.18.0


[![Build Status](https://cloudzero.semaphoreci.com/badges/cz-common-python/branches/master.svg?key=1fb0a22b-ab5c-46d9-a0d4-4afa93bcde1a)](https://cloudzero.semaphoreci.com/projects/cz-common-python)

# Overview

`cz-common-python` provides the `czc` python package that contains useful feature modules like:

- `czc.authorization`: check the request parameters and token against role
- `czc.constants`: `FEATURE_NAME` and `PROJECT_NAME`
- `czc.concurrency`: `aync_map` function to turn a blocking function into async function
- `czc.concurrency_36`: `aync_map` function to turn a blocking function into async function (Python 3.6 version)
- `czc.date`: convert to/from iso and timestamp formats ... always in UTC
- `czc.domain_events`: create a schema or domain event
- `czc.json`: encode dictionaries with non-serializable elements, e.g. dates
- `czc.schema_validators`: validate common CZ values, e.g. `ORGANIZATION_ID`
- `czc.string`: convert between camel and snake; vacuum pack an unpack
- `czc.token`: decode and check JWTs, can still be referenced as `czc.jwt` for backwards compatibility
- `czc.unittest`: help write unit tests
    - `MockEx` class decorates mocks, adding assertable chainable methods, e.g. `MockEx(mock).was_called_once_with(*args, **kwargs)` does all of the nasty argument unpacking and comparison and compares call count.
    
# 2.0 Breaking Changes:
We upgraded AWS Lambda Powertools to 2.0.0+ (>=2.9.1 to be exact). Honestly, we don't know if this _will_ break you, but since we can't be sure based on your usage of Powertools, we bumped our major version.

# 1.0 Breaking Changes:

## Test Key Forwarding Support
In this version, when test keys are specified on any incoming API (web, iapi, domain events) that are test key aware, 
they will automatically be forwarded on to any other IAPI or domain event that is sent out due to the handler. If the 
receiving side of the IAPI validates the incoming parameters and DOES NOT ALLOW extra parameters, then the IAPI will fail. 

If this happens there are three possible remedies:

1. Fix the IAPI handler (in the server side repo) so that it handles test keys. If the IAPI adds/modifies any database records
than this would be the preferred remedy as it will ensure that those downstream changes are added via test keys and not visible
outside of the test
2. Modify the smoke test in the client repo to not use a test key (not preferred)
3. Use a test key value that ends with `-do-not-forward`. By adding this suffix, the test key will only be used internally and will
not be forwarded to any external calls or events.
