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

Enable alternative build system for Python in source builds #18935

Open
bkmgit opened this issue Oct 22, 2024 · 6 comments
Open

Enable alternative build system for Python in source builds #18935

bkmgit opened this issue Oct 22, 2024 · 6 comments
Assignees

Comments

@bkmgit
Copy link

bkmgit commented Oct 22, 2024

What language does this apply to?
Python bindings

Describe the problem you are trying to solve.
Bazel is not packaged in some Linux distributions because it bundles a number of jar files and binaries, as such cannot be used to build the Python bindings from source release.

Describe the solution you'd like
Enable CMake as an additional build system for the Python bindings.

Describe alternatives you've considered
Meson or Muon are other options, though this would add to the number of build systems already in use.

Additional context
Can make a pull request if this would be considered.

@bkmgit bkmgit added the untriaged auto added to all issues by default when created. label Oct 22, 2024
@anandolee anandolee added python bazel and removed untriaged auto added to all issues by default when created. labels Oct 23, 2024
@zhangskz
Copy link
Member

We generally lean towards supporting build-from-source through Bazel rather than per-language build systems to keep our support surfaces maintainable. For example, we recently dropped support for building Java from source via Maven accordingly.

Its unlikely we would be able to support this without substantial demand, esp. given CMake doesn't seem to be a commonly used build system for Python. We would likely only be able to accept this as a community-maintained contribution (if at all).

Could you instead simply install Bazel directly via Bazelisk, or request support for Bazel in these Linux distributions as-needed? I would like to understand if we could solve the usability of Bazel for Python Protobuf in these cases instead.

@bkmgit
Copy link
Author

bkmgit commented Oct 23, 2024

The points below apply to Fedora Linux

@zhangskz
Copy link
Member

I'm not familiar with the specifics of Fedora, but it looks like the recommended solution from Bazel is to use the unofficial vbatts/bazel package per https://docs.bazel.build/versions/5.4.1/install-redhat.html and https://docs.bazel.build/versions/5.4.1/install.html#community-supported-packages

Looks like there is community support that should allow Bazel to work with Fedora Linux, but Bazel folks may be able to better point you in the right direction: https://github.com/bazelbuild/bazel/issues

@bkmgit
Copy link
Author

bkmgit commented Oct 23, 2024

Copr is not reviewed so cannot be used to add official packages in the main distribution. As indicated in bazelbuild/bazel#18550 new releases on Copr are not forthcoming.

As many things depend on protobuf, this is holding up many updates. Fortunately there are other implementations, but patching to use ohter implementations would take some time.

Have not checked other build systems such as Pants, Buck2 or Please, but if one of these might be easier to support than CMake, that would be useful to know.

There was a previous thread on supporting Bazel in Fedora bazelbuild/bazel#18550

@zhangskz
Copy link
Member

Which protobuf python implementation (e.g. PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION) is your request to support building from CMake for? Is this specific to Protobuf-C++, or other implemetnations? Note that the default implementation is upb per https://protobuf.dev/news/2022-05-06/#python-updates

Realistically, I believe looking into improving Bazel support in Fedora is probably still the right way to proceed here feasibility may vary depending on which python implementation(s) this is for.

@bkmgit
Copy link
Author

bkmgit commented Nov 19, 2024

Adding Bazel support would take some time. There are many jar files bundled with Bazel that would need to be rebuilt. Bootstrapping Bazel would also take time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants