Skip to main content

Common utils for Digital Marketplace apps.

Project description

Digital Marketplace utils

Python 3.11 Python 3.12 Python 3.13 Python 3.14 PyPI version

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 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.

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, 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 to do some general file checks and check the pyproject.toml. Follow the 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. This covers both the codebase and any sample code in the documentation.

The documentation is © Crown copyright and available under the terms of the Open Government 3.0 licence.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccs_digitalmarketplace_utils-81.0.0.tar.gz (85.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccs_digitalmarketplace_utils-81.0.0-py3-none-any.whl (103.7 kB view details)

Uploaded Python 3

File details

Details for the file ccs_digitalmarketplace_utils-81.0.0.tar.gz.

File metadata

File hashes

Hashes for ccs_digitalmarketplace_utils-81.0.0.tar.gz
Algorithm Hash digest
SHA256 c0aababcf62bce2e4528079dd22c86fd4aa05d83a56c2379d57070fbc8a402bc
MD5 e87d9887664b91df345bbb34cf46eab2
BLAKE2b-256 c73a1e6cc67637f0f02e317c8b7e206203262e144966da30ac7491f2c0a03753

See more details on using hashes here.

File details

Details for the file ccs_digitalmarketplace_utils-81.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ccs_digitalmarketplace_utils-81.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c27ee360d2466464fbb4b82ec63af8addbff19665b37e3da3a9dbef59d5934ca
MD5 5f9f4506e028209e63c1961474dab77e
BLAKE2b-256 3d8cb14bdfa7c64872e55d8058a7cdf7a9f4579d551f975102bdd9f01ac6704b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page