python / python/typing

TypedDict with patterns as key names

Open
#795 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: feature
Dominant language
Python
Stars
1.8k
Forks
302
Avg merge
23h
Merged PRs (30d)
8

Description

I'm not sure if I should open an issue here at typing, please let me know if there is something better.

WSGI type defines. https://gist.github.com/abersheeran/f3723029387fe7f6584c6b157b90a50a

When writing a more static WSGI definition based on PEP3333, I discovered such a problem. TypedDict cannot describe the HTTP_* keys in the WSGI specification. I know that one of the original intentions of TypedDict is to prevent typing the wrong keys. But can we add an option (for example: allow_undefined=True) to allow this actual problem?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing TypedDict behavior and the WSGI type definition in the linked gist, using PEP3333 as the requirements reference. Determine whether supporting HTTP_* key names needs a new option or another typing design, then confirm the proposal with the typing maintainers; done means an accepted approach with corresponding tests or documentation identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.