danielgtaylor / danielgtaylor/python-betterproto
Add option to turn off adding of empty __init__.py files
- Lenguaje dominante
- Python
- Estrellas
- 1.8k
- Forks
- 234
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Summary
Improve compatibility in monorepo/Bazel usages, so that package path can be treated as native namespace packages
### What is the feature request for?
The core library
### The Problem
When using two proto files that have a similar prefix such as `a.b.c` and `a.b.d`, when these are produced as two separate artifacts consuming both of these as libraries would cause a import path collision since they both share `__init__.py` files in `a` and `a/b` folders.
### The Ideal Solution
Add an option to skip creation of empty `__init__.py` files. Build tools treat the folders without `__init__.py` as namespace packages.
### The Current Solution
I made the change as a patch and applied the patch on the library to get this capability.
I can roll the change up as a PR if there's interest in this.
### Related Solution
A similar option called `legacy_create_init=False` was introduced on bazel to solve this exact issue with package names. See https://rules-proto-grpc.com/en/latest/lang/python.html#python-grpc-compile:~:text=legacy_create_init%3DFalse .
Guía de contribución
Línea de trabajo
El issue no especifica ningún archivo ni prueba; empieza por localizar el punto de entrada de generación de código Python de la biblioteca principal y el código que crea archivos __init__.py vacíos. Compara el comportamiento solicitado con la opción legacy_create_init=False de Bazel y, después, verifica que las rutas de paquetes de espacio de nombres generadas funcionen sin esos archivos y que el comportamiento predeterminado no cambie.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- build-system, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100