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

Breaking Change: Removed obsolete/duplicate setup.py from Python. #15708

Merged
merged 1 commit into from Feb 5, 2024

Conversation

zhangskz
Copy link
Member

@zhangskz zhangskz commented Feb 2, 2024

This copy of setup.py is obsolete, as it builds the old C++ backend for Protobuf, which has been deprecated and unused since 4.21.0 when
the backend was switch to upb.

The setup.py that we actually distribute in our source packages is located in python/dist/setup.py. It is not possible to build this setup.py directly from the GitHub repo or GitHub release tarball, because it depends on the file layout of our Python source package (as distributed on PyPI). The Python source package uses a layout that pulls together all of the things Python needs:

|Python Source Package Path|GitHub Repo Path|Description| |-----|-----|-----|
|setup.py|python/dist/setup.py|
|google/protobuf/*|python/google/protobuf/*|pure Python sources| |python/*|python/*|C extension sources|
|utf8_range/*|third_party/utf8_range|C UTF-8 Validation Library| |upb/*|upb/upb/*|C Protobuf Library|

Users who want to build their own Python packages should build from our source package on PyPI, not from our GitHub repo or our GitHub release tarball.

It is also possible to build our source package from GitHub using the following command (this requires Bazel):

$ bazel build //python/dist:source_wheel

PiperOrigin-RevId: 603162788

This copy of `setup.py` is obsolete, as it builds the old C++ backend for Protobuf, which has been deprecated and
unused since 4.21.0 when
[the backend was switch to upb](https://protobuf.dev/news/2022-05-06/#python-updates).

The `setup.py` that we actually distribute in our source packages is located in [`python/dist/setup.py`](https://github.com/protocolbuffers/protobuf/blob/main/python/dist/setup.py).  It is not possible to build this `setup.py` directly from the GitHub repo or GitHub release tarball, because it depends on the file layout of our Python source package ([as distributed on PyPI](https://pypi.org/project/protobuf/#files)).  The Python source package uses a layout that pulls together all of the things Python needs:

|Python Source Package Path|GitHub Repo Path|Description|
|-----|-----|-----|
|`setup.py`|`python/dist/setup.py`|
|`google/protobuf/*`|`python/google/protobuf/*`|pure Python sources|
|`python/*`|`python/*`|C extension sources|
|`utf8_range/*`|`third_party/utf8_range`|C UTF-8 Validation Library|
|`upb/*`|`upb/upb/*`|C Protobuf Library|

Users who want to build their own Python packages should build from our source package on PyPI, not from our GitHub repo or our GitHub release tarball.

It is also possible to build our source package from GitHub using the following command (this requires Bazel):

```
$ bazel build //python/dist:source_wheel
```

PiperOrigin-RevId: 603162788
@zhangskz zhangskz requested a review from a team as a code owner February 2, 2024 23:33
@zhangskz zhangskz requested review from ericsalo and haberman and removed request for a team and ericsalo February 2, 2024 23:33
@zhangskz zhangskz merged commit 5722aef into 26.x Feb 5, 2024
162 checks passed
@zhangskz zhangskz deleted the cp-setuppy branch February 5, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants