Skip to content

Commit

Permalink
Update setup.py to allow pip install . (#959)
Browse files Browse the repository at this point in the history
* Update setup.py

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Change BUILD to BUILD.bazel to avoid name collision on Windows

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix permission issue

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Updates README.md

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed May 11, 2020
1 parent 322b317 commit 6505a6e
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 258 deletions.
2 changes: 2 additions & 0 deletions .kokorun/io_cpu.sh
Expand Up @@ -56,6 +56,8 @@ docker run -i --rm -v $PWD:/v -w /v --net=host \
-e BAZEL_OPTIMIZATION="${BAZEL_OPTIMIZATION}" \
gcr.io/tensorflow-testing/nosla-ubuntu16.04-manylinux2010@sha256:3a9b4820021801b1fa7d0592c1738483ac7abc209fc6ee8c9ef06cf2eab2d170 /v/.github/workflows/build.bazel.sh

sudo chown -R $(id -nu):$(id -ng) .

docker run -i --rm --user $(id -u):$(id -g) -v /etc/password:/etc/password -v $PWD:/v -w /v --net=host \
python:${PYTHON_VERSION}-slim python setup.py --data build -q bdist_wheel

Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions README.md
Expand Up @@ -288,6 +288,34 @@ TFIO_DATAPATH=bazel-bin \
'python3 -m pytest -s -v tests/test_serialization_eager.py'
```

#### Python Wheels

It is possible to build python wheels after bazel build is complete with the following command:
```
python3 setup.py bdist_wheel --data bazel-bin
```
The whl file is will be available in dist directory. Note the bazel binary directory `bazel-bin`
has to be passed with `--data` args in order for setup.py to locate the necessary share objects,
as `bazel-bin` is outside of the `tensorflow_io` package directory.

Alternatively, source install could be done with:
```
TFIO_DATAPATH=bazel-bin python3 -m pip install .
```
with `TFIO_DATAPATH=bazel-bin` passed for the same readon.

Note installing with `-e` is different from the above. The
```
TFIO_DATAPATH=bazel-bin python3 -m pip install -e .
```
will not install shared object automatically even with `TFIO_DATAPATH=bazel-bin`. Instead,
`TFIO_DATAPATH=bazel-bin` has to be passed everytime the program is run after the install:
```
TFIO_DATAPATH=bazel-bin python3
# import tensorflow_io as tfio
# ...
```

#### Docker

For Python development, a reference Dockerfile [here](tools/dev/Dockerfile) can be
Expand Down

0 comments on commit 6505a6e

Please sign in to comment.