Before getting started, check out the #bentoml-contributors
channel in the BentoML community slack.
If you are interested in contributing to existing issues and feature requests, check out the good-first-issue and help-wanted issues list.
If you are interested in proposing a new feature, make sure to create a new feature request ticket here and share your proposal in the #bentoml-contributors
slack channel for feedback.
Make sure to have Git, pip, Python3.9+, and PDM installed.
Optionally, make sure to have GNU Make
available on your system if you aren't using a UNIX-based system for a better
developer experience. If you don't want to use make
then please refer to
the Makefile for specific commands on a given make target.
Fork the BentoML project on GitHub.
Clone the source code from your fork of BentoML's GitHub repository:
git clone git@github.com:username/BentoML.git && cd BentoML
Add the BentoML upstream remote to your local BentoML clone:
git remote add upstream git@github.com:bentoml/BentoML.git
Configure git to pull from the upstream remote:
git switch main # ensure you're on the main branch
git fetch upstream --tags
git branch --set-upstream-to=upstream/main
Install BentoML in editable and all development dependencies:
pdm install -G all
pre-commit install
This installs BentoML with editable mode via pdm
and development
dependencies in a isolated environment. If you wish not to setup within an
isolated environment, pass --no-isolation
to pdm
Note: Make sure to prepend
pdm run
to all commands within this guide if you are using isolated environment viapdm
.
Test the BentoML installation either with bash
:
bentoml --version
or in a Python session:
import bentoml
print(bentoml.__version__)
Confirm that you have the following installed:
Fork the BentoML project on GitHub.
Clone the GitHub repository:
Add an BentoML upstream remote:
Pull from the BentoML upstream remote to your main branch:
Open a new terminal by clicking the Terminal dropdown at the top of the window, followed by the 'New Terminal' option. Next, add a virtual environment with this command:
python -m venv .venv
Click yes if a popup suggests switching to the virtual environment. Otherwise, go through these steps:
Open any python file in the directory.
Select the interpreter selector on the blue status bar at the bottom of the editor.
Switch to the path that includes .venv from the dropdown at the top.
Update your PowerShell execution policies. Win+x followed by the 'a' key opens the admin Windows PowerShell. Enter the following command to allow the virtual environment activation script to run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Make sure you're on the main branch.
git switch main
Use the git pull command to retrieve content from the BentoML Github repository.
git pull
Create a new branch and switch to it.
git switch -c my-new-branch-name
Make your changes!
Use the git add command to save the state of files you have changed.
git add <names of the files you have changed>
Commit your changes.
git commit
Push all changes to your fork on GitHub.
git push
Switch to the main branch:
Pull from the upstream remote:
Create and change to a new branch:
Make your changes!
Stage all your changes:
Commit your changes:
Push your changes:
To view internal debug loggings for development, set the BENTOML_DEBUG
environment variable to TRUE
:
export BENTOML_DEBUG=TRUE
And/or use the --verbose
option when running bentoml
CLI command, e.g.:
bentoml get IrisClassifier --verbose
We are using pre-commit to manage our hooks, and
buf for formatting and linting of our proto
files. Configuration can be found here. Currently, we
are running buf
with docker, hence we kindly ask our developers to have docker
available. Docker installation can be found
here.
Run linter/format script:
pre-commit run --all-files
Run type checker:
make type
The proto files for the BentoML gRPC service are located under bentoml/grpc
.
The generated python files are not checked in the git repository, and are instead generated via this script
.
If you edit the proto files, make sure to run ./scripts/generate_grpc_stubs.sh
to
regenerate the proto stubs.
Test out your changes in an actual BentoML model deployment, you can create a new Bento with your custom BentoML source repo:
pip install -e PATH_TO_THE_FORK
export BENTOML_BUNDLE_LOCAL_BUILD=True
bentoml build
in your project directorybentoml containerize
will install it to override the default BentoML installation in base imageIf you want other team members to easily use your custom BentoML distribution, you may publish your branch to your fork of BentoML, and have your users install it this way:
pip install git+https://github.com/{YOUR_GITHUB_USERNAME}/bentoml@{YOUR_REVISION}
And in your BentoML projects' bentofile.yaml
, force the Bento to install this distribution, e.g.:
service: 'service:svc'
description: 'file: ./README.md'
include:
- '*.py'
python:
packages:
- pandas
- git+https://github.com/{YOUR_GITHUB_USERNAME}/bentoml@{YOUR_REVISION}
docker:
system_packages:
- git
Make sure to install all dev dependencies:
pdm install
BentoML tests come with a Pytest plugin. Export PYTEST_PLUGINS
:
export PYTEST_PLUGINS=bentoml.testing.pytest.plugin
To run all tests with PDM, do the following:
pdm run nox
If you are adding new ML framework support, it is recommended that you also add a separate test suite in our CI. Currently we are using GitHub Actions to manage our CI/CD workflow.
We recommend using nektos/act
to run and test Actions locally.
Add a new job for your new framework under framework.yml
Currently, BentoML is PEP518 compatible. We define package configuration via [pyproject.toml
][https://github.com/bentoml/bentoml/blob/main/pyproject.toml].
BentoML has moved its benchmark to bentoml/benchmark
.
Push changes to your fork and follow this article on how to create a pull request on github. Name your pull request with one of the following prefixes, e.g. "feat: add support for PyTorch". This is based on the Conventional Commits specification
Once your pull request is 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 a reviewer has signed off, we will merge your pull request.
Refer to BentoML Documentation Guide for how to build and write docs.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )