This is an automated email from the ASF dual-hosted git repository.
kojiromike pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new 39c0069 AVRO-3007: Standardize Building Python Packages (#1239)
39c0069 is described below
commit 39c0069521015537d976786cf57b6b4990b1a8c1
Author: Michael A. Smith <[email protected]>
AuthorDate: Tue Aug 31 06:54:08 2021 -0400
AVRO-3007: Standardize Building Python Packages (#1239)
---
lang/py/build.sh | 21 +++++++++++++++------
lang/py/pyproject.toml | 7 +++++++
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/lang/py/build.sh b/lang/py/build.sh
index eaf5aaa..7412889 100755
--- a/lang/py/build.sh
+++ b/lang/py/build.sh
@@ -35,12 +35,21 @@ clean() {
'userlogs'
}
-dist() {
- python3 setup.py sdist
- python3 setup.py bdist_wheel
- mkdir -p ../../dist/py
- cp dist/*.{tar.gz,whl} ../../dist/py
-}
+dist() (
+ ##
+ # Use https://pypa-build.readthedocs.io to create the build artifacts.
+ local destination virtualenv
+ destination=$(
+ d=../../dist/py
+ mkdir -p "$d"
+ cd -P "$d"
+ pwd
+ )
+ virtualenv="$(mktemp -d)"
+ python3 -m venv "$virtualenv"
+ "$virtualenv/bin/python3" -m pip install build
+ "$virtualenv/bin/python3" -m build --outdir "$destination"
+)
interop-data-generate() {
./setup.py generate_interop_data
diff --git a/lang/py/pyproject.toml b/lang/py/pyproject.toml
index 74c70fc..675e976 100644
--- a/lang/py/pyproject.toml
+++ b/lang/py/pyproject.toml
@@ -13,6 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+##
+# Minimal pip build requirements:
+# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
+[build-system]
+requires = ["setuptools>=40.8.0", "wheel"]
+build-backend = "setuptools.build_meta"
+
[tool.black]
line-length = 150