Download the source code to local file system:
$ git clone https://github.com/bentoml/BentoML.git
$ cd BentoML
Ensure you have python and pip installed, BentoML supports python 3.6, and 3.7
$ python --version
$ pip --version
And install BentoML with pip in editable
mode:
pip install --editable .
This will make bentoml
available on your system which links to the sources of
your local clone and pick up changes you made locally.
Now you can test your BentoML installation by running the following in terminal:
$ bentoml --version
- Install all test dependencies:
pip install .[test]
# For zsh users, use:
$ pip install -e .\[test\]
- Run all unit tests with current python version and environment
$ pytest tests
Make sure you have conda installed:
$ conda --version
Bentoml tox file is configured to run in muiltple python versions:
$ tox
If you want to run tests under conda for specific version, use -e
option:
$ tox -e py37
// or
$ tox -e py36
Add the following lines to the Python code that invokes BentoML:
import bentoml
import logging
bentoml.config().set('core', 'debug', 'true')
bentoml.utils.log.configure_logging(logging.DEBUG)
And/or use the --verbose
option when running bentoml
CLI command, e.g.:
bentoml get IrisClassifier --verbose
When trying new BentoML feature that has not been released, testing a fork of
BentoML on Google Colab or trying out changes in a pull request, an easy way of
doing so is to use pip install git+...
command, for example to install BentoML
from its master branch with all latest changes:
pip install git+https://github.com/bentoml/BentoML.git
Or to install from your own fork of BentoML:
pip install git+https://github.com/{your_github_username}/BentoML.git
You can also specify what branch to install from:
pip install git+https://github.com/{your_github_username}/BentoML.git@{branch_name}
Make sure to install all dev dependencies:
$ pip install -e .[dev]
# For zsh users, use:
$ pip install -e .\[dev\]
Run linter/format script:
./dev/format.sh
./dev/lint.sh
Install all dev dependencies:
$ pip install -e .[dev]
To build documentation for locally:
$ ./docs/build.sh
Modify *.rst files inside the docs
folder to update content, and to
view your changes, run the following command:
$ python -m http.server --directory ./docs/build/html
And go to your browser at http://localhost:8000
If you are developing under macOS
, we also made a script that watches docs
file changes, automatically rebuild the docs html files, and refresh the browser
tab to show the change:
Make sure you have fswatch command installed:
brew install fswatch
Run the watch.sh
script to start watching docs changes:
$ ./docs/watch.sh
Instll all dev dependenci:
$ pip install -e .[dev]
Install grpcui:
$ go get github.com/fullstorydev/grpcui
$ go install github.com/fullstorydev/grpcui/cmd/grpcui
Start Yatai server in debug mode:
$ bentoml yatai-service-start --debug
In another terminal session run grpcui:
$ grpcui -plain text localhost:50051
gRPC Web UI available at http://127.0.0.1:60551/...
Navigate to the URL from above
Make sure you have yarn
installed: https://classic.yarnpkg.com/en/docs/install
Install all npm packages required by BentoML Web UI:
# install npm packages required by BentoML's Node.js Web Server
cd {PROJECT_ROOT}/bentoml/yatai/web/
yarn
# install npm packages required by BentoML web frontend
cd {PROJECT_ROOT}/bentoml/yatai/web/client/
yarn
Build the Web Server and frontend UI code:
cd {PROJECT_ROOT}/bentoml/yatai/web/
npm run build
- Fork BentoML project on github and add upstream to local BentoML clone:
$ git remote add upstream [email protected]:YOUR_USER_NAME/BentoML.git
-
Make the changes either to fix a known issue or adding new feature
-
Push changes to your fork and follow this article on how to create a pull request on github
-
Once your pull request created, an automated test run will be triggered on your branch and the BentoML authors will be notified to review your code changes. Once tests are passed and reviewer has signed off, we will merge your pull request.