Add/Build type-hints for python package

Abierto
#1,702 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza examinando el paquete nativo de Python y la extensión compilada expuesta mediante el proceso de build/deploy del paquete. Compara las sugerencias de tipos inline con la salida de mypy stubgen, después define un enfoque completo para ambas partes y verifica que las sugerencias resultantes o los archivos .pyi estén incluidos en el paquete distribuido.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Feature Request

Add type hints to the python package, for both native python code and compiled code.

Description

Type hints are incredibly value in modern python, particularly for library code that may be unknown to developers! Type hints allow our IDEs to auto-complete, catch errors, and make simplify code discovery. I know not everybody loves type hints, but as a library, I believe OpenTimelineIO would benefit a lot from them in terms of automatic tooling integration and developer onboarding!

This is obviously pretty easy in the native python code, but in the pybind11 code it's slightly more tricky. Theoretically you can use mypy stubgen to do this with compiled modules? Is there a native pybind11 way of doing this? I'm not a C++ developer and have never touched pybind, so unfortunately I don't know for sure what the ideal workflow is here.

At my job, we have a mypy validated package that uses OpenTimelineIO, and I've spent a few hours trying to set up my own stub files for OTIO using mypy stubgen. It works fairly well, but it's not perfect. Possibly good enough for release though!

Perhaps this is a two parter -

  1. Add type hints to external facing python code (easy)
  2. At package build/deploy time, use a command like mypy stubgen -m opentimelineio to generate .pyi files to be included in the package.

Context

Add any other context here, such as simulated output, or screenshots, that might help clarify the request.

Lenguaje dominante
C++
Estrellas
2k
Forks
362
Merge medio
2 d 11 h
PR fusionados (30 d)
6

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AcademySoftwareFoundation/OpenTimelineIO

Todos los issues de AcademySoftwareFoundation/OpenTimelineIO

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.