Skip to content

Commit

Permalink
add build pip doc
Browse files Browse the repository at this point in the history
  • Loading branch information
applenob committed Oct 30, 2019
1 parent 4efc814 commit 792b633
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
71 changes: 71 additions & 0 deletions docs/installation/wheel_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# How to build the wheel file

## Intro

In order to provide users a simpler way to install `Delta`, we need to
build the Wheel file `.whl` and upload this wheel file to Pypi's
website. Once we uploaded the wheel file, all that users need to do is
typing `pip install delta-nlp`.

**Notice**: installation by pip only supports NLP tasks now. If you need the
full version of the Delta (with speech tasks), you should install the
platform from source.

## Prepare

Before build the wheel file, you need to install the `DELTA` before.

```bash
bash ./tools/install/install-delta.sh nlp gpu
```

For linux wheel building, you will need the docker image:

```bash
docker pull didi0speech0nlu/delta_pip:tf2_ub16
```

## Start to build

### MacOS

```bash
bash ./tools/install/build_pip_pkg.sh
```

The generated wheel will be under `dist` like
`delta_nlp-0.2-cp36-cp36m-macosx_10_7_x86_64.whl`

### Linux

Wheel building in linux is more complicated. You need to run a docker

```bash
docker run --name delta_pip_tf2_u16 -it -v $PWD:/delta tensorflow/tensorflow:custom-op-ubuntu16 /bin/bash
```

In the docker environment, run:

```bash
bash ./tools/install/build_pip_pkg.sh
```

The generated wheel will be under `dist` like
`delta_nlp-0.2-cp36-cp36m-linux_x86_64.whl`

Repair the wheel file for multiple linux platform support:

```bash
auditwheel repair dist/xxx.whl
```

The final wheel will be under `wheelhouse` like
`delta_nlp-0.2-cp36-cp36m-manylinux1_x86_64.whl`.

## Upload

After building the wheel file, upload these files to Pypi:

```
twine upload xxx.whl
```
3 changes: 3 additions & 0 deletions build_pip_pkg.sh → tools/install/build_pip_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ echo "Uninstall ${PIP_NAME} if exist ..."
pip3 uninstall -y ${PIP_NAME}

echo "Build binary distribution wheel file ..."
BASH_DIR=`dirname "$BASH_SOURCE"`

This comment has been minimized.

Copy link
@zh794390558

zh794390558 Oct 31, 2019

Collaborator

support build and clean command.

pushd ${BASH_DIR}/../..
rm -rf build/ ${PIP_NAME}.egg-info/ dist/
python3 setup.py bdist_wheel
popd

0 comments on commit 792b633

Please sign in to comment.