Commit graph

46 commits

Author SHA1 Message Date
Jason Aragorn Tobias Lunn
713b6a4a24 Add json_options.proto and json_enumvalue_options.proto and/or gencode derived from them to release artifacts
* `protoc`: Included in zips alongside binary
* Java: Generated classes have been added to the Maven `util` artifact
* Ruby: Generated classes have been added to gems
* CMake: `.proto` files are included in installation

PiperOrigin-RevId: 957382561
2026-07-31 16:20:59 -07:00
Tony Liao
8111a7473d json/upb: Implement json EnumValueName for upb
PiperOrigin-RevId: 956632937
2026-07-30 11:19:11 -07:00
Mitchell Allain
3aa022a269 Configure extra compile args in setup.py (#28264)
Fixes https://github.com/protocolbuffers/protobuf/issues/28261 by setting symbol visibility in `setup.py`, similar to `py_extension.bzl`, using the existing branching logic to bypass the flag on MSVC.

This issue manifests in the [NixOS/nixpkgs](https://github.com/NixOS/nixpkgs) build of the `protobuf` python package, which contains upb symbols, and causes fatal failures when loaded in a process that separately links/loads libprotobuf. We'll supply a patch there as well, until this can be backported or released in future protobuf versions.

Closes #28264

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/28264 from mitchallain:mallain/fix-python-upb-symbols 6e118a62bf
PiperOrigin-RevId: 942223178
2026-07-03 12:47:05 -07:00
Tobias Werth
337abe794b Automated Code Change
PiperOrigin-RevId: 941006052
2026-07-01 04:17:25 -07:00
Hong Shin
7800571253 json/python: add support for custom json strings for enum values
PiperOrigin-RevId: 922729754
2026-05-28 06:17:20 -07:00
Jie Luo
f9e028f29f bazel 9 tests for csharp, hpb, objc, php, python, rust and upb
PiperOrigin-RevId: 918164613
2026-05-19 19:58:47 -07:00
Protobuf Team Bot
6cd6ca4116 Auto-format Py Proto python files.
PiperOrigin-RevId: 907755617
2026-04-29 13:40:58 -07:00
Keith Smiley
f08d703292 Add support for bazel 9.x (#26201)
This doesn't flip the default bazel version, but instead makes this repo
compatible with the current version and bazel 9.x. The primary changes
for 9.x support are adding new load statements for things that were
previously built in. This cascaded into a few dep updates to pull in
their missing load statement fixes.

Closes #26201

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/26201 from keith:ks/add-support-for-bazel-9.x e8192d86b3c838f6c88d4a4adfebd07162debc0d
PiperOrigin-RevId: 878654773
2026-03-04 13:59:16 -08:00
Joshua Haberman
1ea2c4bab5 Updated release builds to use Bazel 8 and platforms.
Bazel 8 no longer supports legacy toolchains, so all of our release toolchains have been updated to use platforms.

#test-continuous

PiperOrigin-RevId: 870017275
2026-02-13 21:47:47 -08:00
Jie Luo
bbc9dd9e8a Drop Python 3.9 support
Python 3.9 reached its official End-of-Life (EOL) on October 31, 2025
https://devguide.python.org/versions/

PiperOrigin-RevId: 854341311
2026-01-09 14:20:23 -08:00
Jie Luo
8e3543177e Add Python 3.14 test coverage
#test-continuous

PiperOrigin-RevId: 829211258
2025-11-06 19:21:19 -08:00
Mike Kruskal
b4262af656 Add bzlmod support for python release
#test-continuous

PiperOrigin-RevId: 811607661
2025-09-25 20:03:17 -07:00
Mike Kruskal
fa9ceb3d4f Add bzlmod support for system_python.
#test-continuous

This creates a module extension for system python so that it can be used in bzlmod builds.  The pip_parse setup (dynamically building a new repo) doesn't work in the new bzlmod model, so we use the regular pip extension pointed at system_python's interpreter.

Remaining work to get off WORKSPACE:
* The pip extension quickly fails in the case where there's no python available, unlike our system_python setup
* Our windows upb tests were never actually running python, and system_python doesn't work (and breaks under bzlmod due to the above issue)
* Some of the upb wheel tests still don't work on bzlmod yet because they depend on some very custom http_archive dependencies.

Closes #18750
Closes #23313
Closes #23307

PiperOrigin-RevId: 810995270
2025-09-24 12:54:08 -07:00
Joshua Haberman
56b2b89e37 Publish s390x wheels for Python/upb.
PiperOrigin-RevId: 808302611
2025-09-17 15:50:14 -07:00
Zoey Greer
0f4aa11fde Add missing load for sh_binary in python/dist/BUILD.bazel (#23195)
This was causing a build failure, since `sh_binary` is referenced in `python/dist/BUILD.bazel`, but it was never initialized.

Closes #23195

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/23195 from tempoz:add-missing-load-sh-binary-to-python-dist e85d0323cf
PiperOrigin-RevId: 797114331
2025-08-19 19:30:27 -07:00
Adam Cozzette
20759b55fa Make protobuf codebase compatible with --incompatible_config_setting_private_default_visibility
This is necessary to get the BCR presubmit checks to pass.

PiperOrigin-RevId: 786432944
2025-07-23 14:54:29 -07:00
Aaron Levy
508aba1b50 Updating setuptools to patch CVE-2025-47273 (#22094)
Updating setuptools to patch CVE-2025-47273

Also updated Bazel to 7.4.0 due to https://github.com/bazelbuild/bazel/issues/4327

Fixes #22165

Closes #22094

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/22094 from aaronmaxlevy:aaron_update_setuptools e1278abf68
PiperOrigin-RevId: 780701752
2025-07-08 13:58:42 -07:00
Joshua Haberman
26cc90cd83 Load py_runtime_pair from rules_python for Bazel 8.
As suggested by @justinwon777 in https://github.com/protocolbuffers/protobuf/pull/20335

PiperOrigin-RevId: 757933716
2025-05-12 15:25:32 -07:00
Joshua Haberman
eccae51b66 Fixed Python source wheel breakage caused by https://github.com/protocolbuffers/protobuf/pull/21423
The Python source wheel is pulling in `decode_fast.c`, leading to compilation errors when it is not enabled.

While we could try to prevent this file from being in the source wheel at all, that is probably a short-term solution.  If fasttable support is ever ready for prime time, we will need to be able to decide at build time whether to enable it or not, because it's not supported on all platforms.

#test-continuous

PiperOrigin-RevId: 752479765
2025-04-28 16:06:17 -07:00
Protobuf Team Bot
32838e8c2c Rename bazel "pip_deps" hub_name.
rules_python recommends not using "pip_deps" as a hub name unless the module is guaranteed to always be the root module, as the name must be unique between modules.

PiperOrigin-RevId: 715435028
2025-01-14 10:37:26 -08:00
Tony Liao
39808bc55d Remove the entire pb_unit_tests/ directory with reflection_test_wrapper.
The test wrappers were another way to document nonconformant behaviour between
different python backends. We can achieve the same by removing the wrapper
script and adding an if-condition in the test itself based on
api_implementation.Type(). Since we already do that for nonconformance between
pure Python vs. C++ backends, this change makes it easier to look for UPB
nonconformance instead of going through another layer of indirection.

Since this is the last remaining test file in the pb_unit_tests directory, I
have removed the entire directory. Future UPB tests will be in the same
directory as C++ and pure python implementations, namely:
//python/google/protobuf/internal.

Temporarily, we will need to hardcode the migrated test name in test_upb.yml
because not all tests under google.protobuf.internal support UPB yet.
(UPB testing for selected tests are added in 21e9aa6cac).

The reflection_test is a slightly more complicated test. In this commit I've
removed exemption of testParsingNestedClass in reflection_test. A follow-up
commit will ensure further conformance within the reflection_test. There are
quite a few if-conditions that were added to skip certain checks due to
nonconformant behavior -- they seem to no longer apply.

PiperOrigin-RevId: 712943652
2025-01-07 09:52:04 -08:00
Mike Kruskal
aa4e50fe78 Replace old branch of absl-py parameterization with a dev dependency
#test-continuous

PiperOrigin-RevId: 706910739
2024-12-16 18:57:05 -08:00
Zoey Greer
3773feb2fc Fix deprecated use of namespace_packages in python/dist/setup.py (#18235)
Uses implicit namespaces instead of explicit, as per https://peps.python.org/pep-0420/

Fixes a warning otherwise output during build.

Closes #18235

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/18235 from tempoz:tempoz-fix-deprecated-use-of-namespace-packages 85067b6fa2
PiperOrigin-RevId: 700426731
2024-11-26 12:52:48 -08:00
gongsu832
15e7d71eac Building python binding with bazel on s390x (#19232)
Changes needed for building python binding with bazel on s390x.

Closes #19232

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/19232 from gongsu832:python_bazel_s390x 7ed0c486f9
PiperOrigin-RevId: 699209740
2024-11-22 10:13:07 -08:00
Protobuf Team Bot
f5a293768f Drop Python 3.8 support
This was previously announced in https://engdoc.corp.google.com/eng/doc/devguide/proto/news/2024-10-02.md#dropping-python-38-support per our support policies.

#test-continuous

PiperOrigin-RevId: 698398370
2024-11-20 08:41:33 -08:00
Protobuf Team Bot
7060d3d723 Add Python 3.13 test coverage
#test-continuous

PiperOrigin-RevId: 690740783
2024-10-28 14:01:44 -07:00
Protobuf Team Bot
13cf397e1a upgrade test images to bazel 6.4
PiperOrigin-RevId: 673392132
2024-09-11 08:06:35 -07:00
Joshua Haberman
8422e9795f Migrated upb to use Copybara-standard stripping.
This CL is mostly a no-op, except that now google3-only code is actually stripped from OSS, instead of being preserved in `# begin:google_only` blocks.

This follows the conventions of the greater Copybara ecosystem.

PiperOrigin-RevId: 669513564
2024-08-30 18:34:23 -07:00
Joshua Haberman
983910fa1a Removed aliases for the boostrap proto libraries.
These should only be used by bootstrapping. Users should be using the regular upb_proto_library() targets instead.

PiperOrigin-RevId: 666007278
2024-08-21 13:29:39 -07:00
Protobuf Team Bot
4a5660c889 Automated rollback of commit 4dc164884c.
PiperOrigin-RevId: 642058565
2024-06-10 16:32:18 -07:00
Mike Kruskal
4dc164884c Automated rollback of commit e1bf1f048e.
PiperOrigin-RevId: 640697358
2024-06-05 17:09:51 -07:00
Protobuf Team Bot
e1bf1f048e Update rules_python to 0.28.0
Closes #15849

PiperOrigin-RevId: 640633756
2024-06-05 13:42:55 -07:00
Protobuf Team Bot
21d75f861c Remove references to rules_proto
They are not needed after the rules are move into protobuf repo.
Except for the reference to toolchain type, which is currently in rules_proto and can be moved after the implementation is moved into protobuf repo.

PiperOrigin-RevId: 622176865
2024-04-05 07:50:25 -07:00
Sandy Zhang
ed965bd140 Update python_tag select to include python limited_api
This is needed after python/dist:dist's limited_api_wheels was updated from 3.7->3.8 and was causing us to mislabel the python_tag for our 3.8 limited api wheels as the system python version of 3.7.

Also:
* Add LINT to prevent next time
* Clean up some documentation
PiperOrigin-RevId: 621915013
2024-04-04 11:20:37 -07:00
Protobuf Team Bot
d7f032ad15 Move private definitions out of //bazel
This is needed to make protobuf/bazel package minimal for other proto rules.

Keep 4 public bzl files in upb/bazel. They end up under protobuf/bazel, and they are legitimately used by other repositories.

Move upb_proto_library_internal/* under bazel/private. Those are utilities used in the rules. Moving them one level deeper makes protobuf/bazel package clean for other rules.

Move build_defs.bzl and amalgamation under /upb/bazel. Those are utilities used in the build.

Move lua.BUILD and python* uner /python/dist. Those are used in the WORKSPACE dependency setup.

PiperOrigin-RevId: 621442236
2024-04-03 01:37:51 -07:00
Protobuf Team Bot
83ec410d30 Internal change
PiperOrigin-RevId: 619377672
2024-03-27 05:50:55 -07:00
Tiago Quelhas
774627235e Automated Code Change
PiperOrigin-RevId: 617586334
2024-03-20 12:09:39 -07:00
aiuto
3ab1276bbb Update Bazel references to rules_pkg to the supported file locations. (#15780)
WIP:  I want to see this pass CI first.

Fixes: #15779

3 scripted transforms:
```
  -load("@rules_pkg//:mappings.bzl", ...)
  +load("@rules_pkg//pkg:mappings.bzl", ...)
```
```
  -load("@rules_pkg//:pkg.bzl", "pkg_tar")
  +load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
```
```
  -load("@rules_pkg//:pkg.bzl", "pkg_zip")
  +load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
```

Closes #15780

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15780 from aiuto:rules_pkg a630276341
PiperOrigin-RevId: 606641398
2024-02-13 09:08:42 -08:00
Joshua Haberman
776d072fa1 Removed obsolete TODO.
PiperOrigin-RevId: 606317655
2024-02-12 11:48:35 -08:00
Eric Salo
8d0bfb0a5a upb: delete upb:upb, upb:collections, upb/upb.hpp, upb/collections/
PiperOrigin-RevId: 597923328
2024-01-12 12:44:04 -08:00
Adam Cozzette
5ca84008fc Move utf8_range into the protobuf repo
This makes third_party/utf8_range no longer a Git subtree, but instead the
permanent location and source of truth for utf8_range. It is also now
incorporated into the @com_google_protobuf Bazel repo. Utf8_range still has its
own separate CMake build for now, though.

PiperOrigin-RevId: 580682733
2023-11-08 15:43:35 -08:00
Adam Cozzette
24fef03259 Add support and partial CI coverage for Python 3.12
There's a test run in test_python.yml that is non-trivial to get working with
Python 3.12 due to some refactoring of our Docker images that would be needed.
But this change updates everything else to add coverage for Python 3.12.

The main changes necessary to get the builds working were to upgrade some Pip
packages via requirements.txt, including in a patch to `rules_fuzzing` that I
plan to upstream soon. I also had to take an explicit dependency on
`setuptools`.

I removed tox.ini, since it was outdated and we have not been actively
maintaining it.

PiperOrigin-RevId: 580548224
2023-11-08 08:53:27 -08:00
Eric Salo
8d67a40d30 upb: fix wheels build errors
PiperOrigin-RevId: 576925248
2023-10-26 10:59:04 -07:00
Adam Cozzette
8970072608 Migrate away from distutils
Python 3.12 has removed the `distutils` module, so we need to stop relying on
it. Most of the parts we were using had a straightforward replacement in
`setuptools` or elsewhere in the Python standard library. I couldn't find a
good replacement for `distutils.command.clean`, though. We were only using it
to enable `python setup.py clean`, so I just removed that functionality since
directly invoking setup.py is deprecated anyway.

While I was looking at this I realized that our python/release.sh script is
unused, so I also removed that.

PiperOrigin-RevId: 571035275
2023-10-05 09:08:21 -07:00
Adam Cozzette
8f831e973a Update Python versions to reflect that we now support 3.8 through 3.11
PiperOrigin-RevId: 569317472
2023-09-28 16:12:04 -07:00
Adam Cozzette
501ececd39 Reorganize upb file structure
This change moves almost everything in the `upb/` directory up one level, so
that for example `upb/upb/generated_code_support.h` becomes just
`upb/generated_code_support.h`. The only exceptions I made to this were that I
left `upb/cmake` and `upb/BUILD` where they are, mostly because that avoids
conflict with other files and the current locations seem reasonable for now.

The `python/` directory is a little bit of a challenge because we had to merge
the existing directory there with `upb/python/`. I made `upb/python/BUILD` into
the BUILD file for the merged directory, and it effectively loads the contents
of the other BUILD file via `python/build_targets.bzl`, but I plan to clean
this up soon.

PiperOrigin-RevId: 568651768
2023-09-26 14:38:35 -07:00