Metadata-Version: 2.4
Name: ccs-digitalmarketplace-utils
Version: 80.0.0
Summary: Common utils for Digital Marketplace apps.
Author: GDS Developers, CCS Developers
Project-URL: Homepage, https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-utils
Project-URL: Repository, https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-utils.git
Project-URL: Issues, https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-utils/issues
Project-URL: Changelog, https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-utils/CHANGELOG.md
Requires-Python: <3.15,>=3.11
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: Flask-WTF>=1.2.1
Requires-Dist: Flask<3.2,>=3.0
Requires-Dist: Flask-gzip>=0.2
Requires-Dist: Flask-Login>=0.6.3
Requires-Dist: Flask-Session<0.9.0,>=0.6.0
Requires-Dist: boto3<2,>=1.7.83
Requires-Dist: contextlib2>=21.6.0
Requires-Dist: cryptography>=41.0.4
Requires-Dist: ccs-digitalmarketplace-apiclient>=37.4.1
Requires-Dist: mailchimp3==3.0.21
Requires-Dist: requests<3,>=2.22.0
Requires-Dist: redis>=5.0.1
Requires-Dist: filetype<2,>=1.2.0
Requires-Dist: notifications-python-client<11.0.0,>=8.1.0
Requires-Dist: odfpy>=1.4.1
Requires-Dist: python-json-logger<5.0.0,>=4.0.0
Requires-Dist: pytz
Requires-Dist: unicodecsv>=0.14.1
Requires-Dist: urllib3<3
Requires-Dist: werkzeug<3.2,>=3.0
Requires-Dist: workdays>=1.4
Provides-Extra: dev
Requires-Dist: ruff==0.15.5; extra == "dev"
Requires-Dist: freezegun==1.5.5; extra == "dev"
Requires-Dist: hypothesis==6.151.9; extra == "dev"
Requires-Dist: moto==5.1.22; extra == "dev"
Requires-Dist: mypy==1.19.1; extra == "dev"
Requires-Dist: pytest==9.0.2; extra == "dev"
Requires-Dist: pytest-cov==7.0.0; extra == "dev"
Requires-Dist: pytest-datadir==1.8.0; extra == "dev"
Requires-Dist: requests-mock==1.12.1; extra == "dev"
Requires-Dist: testfixtures==10.0.0; extra == "dev"
Requires-Dist: ccs-digitalmarketplace-test-utils==7.7.0; extra == "dev"
Requires-Dist: types-python-dateutil; extra == "dev"
Requires-Dist: types-pytz; extra == "dev"
Requires-Dist: types-redis; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: pre-commit==4.5.1; extra == "dev"
Dynamic: license-file

Digital Marketplace utils
=========================

![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)
![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)
![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)
![Python 3.14](https://img.shields.io/badge/python-3.14-blue.svg)
[![PyPI version](https://badge.fury.io/py/ccs-digitalmarketplace-utils.svg)](https://badge.fury.io/py/ccs-digitalmarketplace-utils)

## What's in here?

* Digital Marketplace API clients
* Formatting utilities for Digital Marketplace
* Digital Marketplace logging for Flask using JSON Logging
* Utility functions/libraries for Amazon S3, Mailchimp, Notify, Cloudwatch
* Helper code for Flask configuration
* A formed version of Flask Feature Flags

## Logging from applications

When logging from applications you should write your message as a [format
string](https://docs.python.org/2/library/string.html#format-string-syntax) and pass any required
arguments to the log method in the `extra` named argument. This allows our logging to use them as
separate fields in our JSON logs making it much easier to search and aggregate on them.

```python
logger.info("the user {user_id} did the thing '{thing}'", extra={
    'user_id': user_id, 'thing': thing
})
```

Note that apart from not getting the benefit, passing the formatted message can be dangerous. User
generated content may be passed, unescaped to the `.format` method.

## Versioning

Releases of this project follow [semantic versioning](http://semver.org/), ie
> Given a version number MAJOR.MINOR.PATCH, increment the:
>
> - MAJOR version when you make incompatible API changes,
> - MINOR version when you add functionality in a backwards-compatible manner, and
> - PATCH version when you make backwards-compatible bug fixes.

To make a new version:
- update the version in the `dmutils/__init__.py` file
- if you are making a major change, also update the change log;

When the pull request is merged a GitHub Action will tag the new version.

## Pre-commit hooks

This project has a [pre-commit hook][pre-commit hook] to do some general file checks and check the `pyproject.toml`.
Follow the [Quick start][pre-commit quick start] to see how to set this up in your local checkout of this project.

## Licence

Unless stated otherwise, the codebase is released under [the MIT License][mit].
This covers both the codebase and any sample code in the documentation.

The documentation is [&copy; Crown copyright][copyright] and available under the terms
of the [Open Government 3.0][ogl] licence.

[mit]: LICENCE
[copyright]: http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
[ogl]: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/

[pre-commit hook]: https://pre-commit.com/
[pre-commit quick start]: https://pre-commit.com/#quick-start
