Add Typelets, a utility types library for Python and Django.

Review Request #14029 — Created July 11, 2024 and submitted

Information

typelets
main

Reviewers

Typelets is a collection of types useful for working with Python
projects generally, and Django projects specifically. It's largely a
compilation of types that we've introduced in our other projects,
available in one place.

The following modules are currently provided:

  • typelets.funcs: Typing for general keyword arguments in functions.
  • typelets.json: Typing for JSON structures, and for application-defined
    data that can be serialized to JSON.
  • typelets.symbols: Symbols for marking types as unset/unsettable.

  • typelets.django.auth: Types for accepting users.

  • typelets.django.forms: Types for forms and form fields.
  • typelets.django.json: Types for Django's JSON serialization.
  • typelets.django.models: Types for working with Django models.
  • typelets.django.strings: Types for localized strings.
  • typelets.django.urls: Types for URL management.

It's built to have very light-weight dependencies, and to be purely
opt-in. If a project doesn't use Django, it simply doesn't need to
import any of the Django libraries, for example.

Over time, we may add more to this module, covering Python, Django, and
perhaps other modules. The hope is that eventually we'll be able to
deprecate more of these as Python and Django's typing improve.

Tested all the types with some local dummy code, using reveal_type()
and assignments to make sure the examples worked as expected.

Summary ID
Add Typelets, a utility types library for Python and Django.
Typelets is a collection of types useful for working with Python projects generally, and Django projects specifically. It's largely a compilation of types that we've introduced in our other projects, available in one place. The following modules are currently provided: * `typelets.funcs`: Typing for general keyword arguments in functions. * `typelets.json`: Typing for JSON structures, and for application-defined data that can be serialized to JSON. * `typelets.symbols`: Symbols for marking types as unset/unsettable. * `typelets.django.auth`: Types for accepting users. * `typelets.django.forms`: Types for forms and form fields. * `typelets.django.json`: Types for Django's JSON serialization. * `typelets.django.models`: Types for working with Django models. * `typelets.django.strings`: Types for localized strings. * `typelets.django.urls`: Types for URL management. It's built to have very light-weight dependencies, and to be purely opt-in. If a project doesn't use Django, it simply doesn't need to import any of the Django libraries, for example. Over time, we may add more to this module, covering Python, Django, and perhaps other modules. The hope is that eventually we'll be able to deprecate more of these as Python and Django's typing improve.
77260e7c774e4721806670c754b34f484434b34a
chipx86
david
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to main (0be9de6)