1*e7b1675dSTing-Kang Chang# Overview 2*e7b1675dSTing-Kang Chang 3*e7b1675dSTing-Kang ChangThis folder contains scripts to build binary and source wheels of the Tink 4*e7b1675dSTing-Kang ChangPython package. 5*e7b1675dSTing-Kang Chang 6*e7b1675dSTing-Kang Chang## Building the release 7*e7b1675dSTing-Kang Chang 8*e7b1675dSTing-Kang ChangIn order to generate a release run `./tools/distribution/create_release.sh` from 9*e7b1675dSTing-Kang Changthe `python/` folder. Note that this requires [Docker](https://www.docker.com) 10*e7b1675dSTing-Kang Changto be installed, as it makes use of the 11*e7b1675dSTing-Kang Chang[pypa images](https://github.com/pypa/manylinux) to build 12*e7b1675dSTing-Kang Chang[PEP 599](https://www.python.org/dev/peps/pep-0599/) conformant wheels. 13*e7b1675dSTing-Kang Chang 14*e7b1675dSTing-Kang ChangThis will carry out the following three steps: 15*e7b1675dSTing-Kang Chang 16*e7b1675dSTing-Kang Chang* Create binary wheels in a Docker container for Linux. 17*e7b1675dSTing-Kang Chang* Create a source distribution of the Python package. 18*e7b1675dSTing-Kang Chang* Run automatic tests against the packages created. 19*e7b1675dSTing-Kang Chang 20*e7b1675dSTing-Kang ChangThe resulting packages of this process will be stored in `python/release` and 21*e7b1675dSTing-Kang Changcan be distributed. The binary wheels can be installed on Linux without 22*e7b1675dSTing-Kang ChangBazel/protoc being available. Currently this supports building binary wheels 23*e7b1675dSTing-Kang Changfor: 24*e7b1675dSTing-Kang Chang 25*e7b1675dSTing-Kang Chang* manylinux2014_x86_64: Python 3.7, 3.8, 3.9, 3.10 26*e7b1675dSTing-Kang Chang 27*e7b1675dSTing-Kang ChangThe binary wheels are tested inside a Docker container with the corresponding 28*e7b1675dSTing-Kang ChangPython versions. 29*e7b1675dSTing-Kang Chang 30*e7b1675dSTing-Kang ChangThe source distribution still needs to compile the C++ bindings, which requires 31*e7b1675dSTing-Kang ChangBazel, protoc and the Tink repository to be available. The path to the Tink 32*e7b1675dSTing-Kang Changrepository can be set with `TINK_PYTHON_SETUPTOOLS_OVERRIDE_BASE_PATH`. The 33*e7b1675dSTing-Kang Changsource distribution is tested on the machine where the script is run. 34*e7b1675dSTing-Kang Chang 35*e7b1675dSTing-Kang Chang## Publishing the release 36*e7b1675dSTing-Kang Chang 37*e7b1675dSTing-Kang ChangThe output generated in the previous step can directly be used for upload to 38*e7b1675dSTing-Kang ChangPyPI. It is recommended to first upload it to the 39*e7b1675dSTing-Kang Chang[test repository](https://test.pypi.org): 40*e7b1675dSTing-Kang Chang 41*e7b1675dSTing-Kang Chang``` 42*e7b1675dSTing-Kang Changpython3 -m twine upload --repository testpypi release/* 43*e7b1675dSTing-Kang Chang``` 44*e7b1675dSTing-Kang Chang 45*e7b1675dSTing-Kang ChangThe package can then be installed using 46*e7b1675dSTing-Kang Chang 47*e7b1675dSTing-Kang Chang``` 48*e7b1675dSTing-Kang Changpip3 install -i https://test.pypi.org/simple/ tink 49*e7b1675dSTing-Kang Chang``` 50*e7b1675dSTing-Kang Chang 51*e7b1675dSTing-Kang ChangIn order to upload it to the PyPI repository run 52*e7b1675dSTing-Kang Chang 53*e7b1675dSTing-Kang Chang``` 54*e7b1675dSTing-Kang Changpython3 -m twine upload release/* 55*e7b1675dSTing-Kang Chang``` 56*e7b1675dSTing-Kang Chang 57