Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to turn off adding of empty __init__.py files #579

Open
chrisirhc opened this issue Jun 6, 2024 · 0 comments
Open

Add option to turn off adding of empty __init__.py files #579

chrisirhc opened this issue Jun 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@chrisirhc
Copy link

chrisirhc commented Jun 6, 2024

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 .

@chrisirhc chrisirhc added the enhancement New feature or request label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant