python / python/typeshed

Consistency with `Final` usage in Standard Library Stubs

Open
#12,311 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

Currently usage of typing.Final to indicate constants is mixed throughout the standard library (e.g. some newer stubs will utilize it potentially, but it's left out in other places) Has there been any discussion in the past of experimenting with applying Final to all UPPER_UNDER module stdlib constants?

I think class var constants would require a bit more context on usage, as it might be expected for subclasses to override them, but it could be worth starting with modules and gauging the impact from MyPy primer.

Contributor guide

Open the contributing guide

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 existing typing.Final usage across the standard library stubs and any prior discussion referenced by the issue. Use the MyPy primer to assess the impact of applying Final to module-level UPPER_UNDER constants; the work is done when a clear policy and implementation scope are agreed.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.