danielgtaylor / danielgtaylor/python-betterproto
Add option to turn off adding of empty __init__.py files
- Lingua principale
- Python
- Stelle
- 1.8k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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 .
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
La issue non indica alcun file o test; inizia individuando il punto di ingresso per la generazione di codice Python della libreria principale e il codice che crea file __init__.py vuoti. Confronta il comportamento richiesto con l'opzione legacy_create_init=False di Bazel, quindi verifica che i percorsi dei namespace package generati funzionino senza questi file e che il comportamento predefinito rimanga invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- build-system, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100