danielgtaylor / danielgtaylor/python-betterproto

Make generated stubs import already existing stubs from another project

Ouverte
#425 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement
Langage dominant
Python
Étoiles
1.8k
Forks
234
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I currently have a project defining some common message types called common_proto and it is installed using git with pip into another project as a package.

Inside the package, the proto files are found inside the proto folder and are imported inside my other proto file where I wanna use them like import "common_proto/proto/common.proto". I have added my site_packages folder to --proto_path and generting everything works fine.

While the normal protobuf compiler for python correctly takes that proto and the already generated protobuf python when it imports it, betterproto generates the python files instead of using the ones available in the same folder which are available as common_proto/proto/csm/common/__init__.py where the package path is the one defined in common.proto like package csm.common.

I know this is probably not the most elegant setup for the folder structure, but it was the one we used with the old protobuf compiler.

Would it be possible for the betterproto compiler to look in the same folder with the proto file to search for the python module if it exists? Would help avoid regenerating the files and allow shipping proto files in other modules to be reused.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez la structure du package décrite par common_proto/proto/common.proto, le proto importateur, --proto_path et le common_proto/proto/csm/common/__init__.py existant. Commencez par suivre la manière dont les protos importés sont résolus, puis vérifiez qu’un module Python généré existant est réutilisé plutôt que régénéré et que les imports fonctionnent toujours entre les deux projets.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.