Skip to content

Consider type hints for user inputs #393

Open
@YPCrumble

Description

Thank you for maintaining this repo! It's been a fantastic resource for my sites.

I recently did a major upgrade and was bitten by a breaking change in v8, whereby SparkPost's esp_extra needed various settings to be nested inside of "options" instead of at the top level of the esp_extra dict. The issue was that this failed silently and I didn't read the changelog closely enough or pay close enough attention to the SparkPost esp_extra documentation.

Simple example:

# Old (now incorrect implementation:
esp_extra = {"transactional": True, ...}

# New (now correct) implementation
esp_extra = {"options": {"transactional": True, ...}, ...}

The issue I faced was that transactional and other settings as part of esp_extra were just ignored.

I'd love to implement type hints for the SparkPost backend (or other backends if that's helpful) and that would be welcomed by maintainers. My idea is that having a type hint using typing.TypedDict would have prevented me from inputting the wrong shape of data into my AnymailMessage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions