tfjs-converter/DEVELOPMENT.md
There are some Python libraries, binary and tests in the python/ directory.
It is recommended to do your Python development and testing in a virtualenv or pipenv.
As a prerequisite, install the following dependencies for python testing
cd python
pip install -r requirements.txt
For Python linter, install pylint, e.g.,
apt-get install -y pylintTo run the Python linter:
cd python
pylint tensorflowjs
To run the python unit tests, there are two options. You can choose the one that you prefer.
Run the tests using the run-python-tests.sh script:
cd python
./run-python-tests.sh
Run the tests using Bazel. See bazel installation guide here. Once bazel is installed, do:
cd python
bazel test tensorflowjs/...
Be sure to run the tests under both Python 2 and Python 3.
cd python
# You need to specify a folder where the pip wheel file will be stored, e.g.,
./build-pip-package.sh /tmp/my_tensorflowjs_pip
# If the script succeeds, you can use `pip install` to install the pip package:
pip install --force-reinstall \
/tmp/my_tensorflowjs_pip/tensorflowjs-0.0.1-py2-none-any.whl
build-pip-package.sh provides a flag (--test) with which you can run a
test-on-install after building the pip package. Make sure you are using a
virutalenv or pipenv to avoid changing your base environmnet.
./build-pip-package.sh --test /tmp/my_tensorflowjs_pip