Skip to content

Commit 35cd25c

Browse files
authored
chore: using src-layout (bentoml#3011)
1 parent 1b2d9fa commit 35cd25c

File tree

247 files changed

+322
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+322
-294
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ jobs:
4141
- scripts/ci/run_tests.sh
4242
- requirements/tests-requirements.txt
4343
protos: &protos
44-
- "bentoml/grpc/**/*.proto"
44+
- "src/bentoml/grpc/**/*.proto"
4545
bentoml:
4646
- *protos
4747
- *related
48-
- "bentoml/**"
48+
- "src/bentoml/**"
49+
- "src/bentoml_cli/**"
4950
- "tests/**"
5051
- "examples/**"
5152
docs:
@@ -106,7 +107,7 @@ jobs:
106107
run: make ci-pyright
107108
- name: Proto check
108109
if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.protos == 'true') || github.event_name == 'push' }}
109-
run: buf lint --config "bentoml/grpc/buf.yaml" --error-format msvs --path "bentoml/grpc"
110+
run: buf lint --config "src/bentoml/grpc/buf.yaml" --error-format msvs --path "src/bentoml/grpc"
110111

111112
documentation_spelling_check:
112113
runs-on: ubuntu-latest

.github/workflows/frameworks.yml

Lines changed: 67 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
pull_request:
88
branches:
99
- main
10-
- runners-1.0
1110
schedule:
1211
- cron: "0 0 * * 1/2"
1312

@@ -67,156 +66,156 @@ jobs:
6766
- tests/integration/frameworks/test_frameworks.py
6867
runner: &runner
6968
- *related
70-
- bentoml/_internal/runner/**
71-
- bentoml/_internal/models/**
69+
- src/bentoml/_internal/runner/**
70+
- src/bentoml/_internal/models/**
7271
catboost:
7372
- *runner
74-
- bentoml/catboost.py
75-
- bentoml/_internal/frameworks/catboost.py
73+
- src/bentoml/catboost.py
74+
- src/bentoml/_internal/frameworks/catboost.py
7675
- tests/integration/frameworks/models/catboost.py
7776
- tests/integration/frameworks/test_frameworks.py
7877
detectron2:
7978
- *runner
80-
- bentoml/detectron.py
81-
- bentoml/_internal/frameworks/detectron.py
79+
- src/bentoml/detectron.py
80+
- src/bentoml/_internal/frameworks/detectron.py
8281
- tests/integration/frameworks/test_detectron2_impl.py
8382
easyocr:
8483
- *runner
85-
- bentoml/easyocr.py
86-
- bentoml/_internal/frameworks/easyocr.py
84+
- src/bentoml/easyocr.py
85+
- src/bentoml/_internal/frameworks/easyocr.py
8786
- tests/integration/frameworks/test_easyocr_impl.py
8887
evalml:
8988
- *runner
90-
- bentoml/evalml.py
91-
- bentoml/_internal/frameworks/evalml.py
89+
- src/bentoml/evalml.py
90+
- src/bentoml/_internal/frameworks/evalml.py
9291
- tests/integration/frameworks/test_evalml_impl.py
9392
fasttext:
9493
- *runner
95-
- bentoml/fasttext.py
96-
- bentoml/_internal/frameworks/fasttext.py
94+
- src/bentoml/fasttext.py
95+
- src/bentoml/_internal/frameworks/fasttext.py
9796
- tests/integration/frameworks/test_fasttext_impl.py
9897
gluon:
9998
- *runner
100-
- bentoml/gluon.py
101-
- bentoml/_internal/frameworks/gluon.py
99+
- src/bentoml/gluon.py
100+
- src/bentoml/_internal/frameworks/gluon.py
102101
- tests/integration/frameworks/test_gluon_impl.py
103102
h2o:
104103
- *runner
105-
- bentoml/h2o.py
106-
- bentoml/_internal/frameworks/h2o.py
104+
- src/bentoml/h2o.py
105+
- src/bentoml/_internal/frameworks/h2o.py
107106
- tests/integration/frameworks/test_h2o_impl.py
108107
lightgbm:
109108
- *runner
110-
- bentoml/lightgbm.py
111-
- bentoml/_internal/frameworks/lightgbm.py
109+
- src/bentoml/lightgbm.py
110+
- src/bentoml/_internal/frameworks/lightgbm.py
112111
- tests/integration/frameworks/models/lightgbm.py
113112
- tests/integration/frameworks/test_frameworks.py
114113
mlflow:
115114
- *runner
116-
- bentoml/mlflow.py
117-
- bentoml/_internal/frameworks/mlflow.py
115+
- src/bentoml/mlflow.py
116+
- src/bentoml/_internal/frameworks/mlflow.py
118117
- tests/integration/frameworks/mlflow
119118
fastai:
120119
- *runner
121-
- bentoml/fastai.py
122-
- bentoml/_internal/frameworks/fastai.py
123-
- bentoml/_internal/frameworks/common/pytorch.py
120+
- src/bentoml/fastai.py
121+
- src/bentoml/_internal/frameworks/fastai.py
122+
- src/bentoml/_internal/frameworks/common/pytorch.py
124123
- tests/integration/frameworks/test_frameworks.py
125124
- tests/integration/frameworks/test_fastai_unit.py
126125
onnx:
127126
- *runner
128-
- bentoml/onnx.py
129-
- bentoml/_internal/frameworks/onnx.py
127+
- src/bentoml/onnx.py
128+
- src/bentoml/_internal/frameworks/onnx.py
130129
- tests/integration/frameworks/models/onnx.py
131130
- tests/integration/frameworks/test_frameworks.py
132131
onnxmlir:
133132
- *runner
134-
- bentoml/onnxmlir.py
135-
- bentoml/_internal/frameworks/onnxmlir.py
133+
- src/bentoml/onnxmlir.py
134+
- src/bentoml/_internal/frameworks/onnxmlir.py
136135
- tests/integration/frameworks/test_onnxmlir_impl.py
137136
paddle:
138137
- *runner
139-
- bentoml/paddle.py
140-
- bentoml/_internal/frameworks/paddle.py
138+
- src/bentoml/paddle.py
139+
- src/bentoml/_internal/frameworks/paddle.py
141140
- tests/integration/frameworks/paddle
142141
picklable_model:
143142
- *runner
144-
- bentoml/picklable_model.py
145-
- bentoml/_internal/frameworks/picklable_model.py
143+
- src/bentoml/picklable_model.py
144+
- src/bentoml/_internal/frameworks/picklable_model.py
146145
- tests/integration/frameworks/picklable_model
147146
pycaret:
148147
- *runner
149-
- bentoml/pycaret.py
150-
- bentoml/_internal/frameworks/pycaret.py
148+
- src/bentoml/pycaret.py
149+
- src/bentoml/_internal/frameworks/pycaret.py
151150
- tests/integration/frameworks/test_pycaret_impl.py
152151
pyspark_mllib:
153152
- *runner
154-
- bentoml/pyspark.py
155-
- bentoml/_internal/frameworks/pyspark.py
153+
- src/bentoml/pyspark.py
154+
- src/bentoml/_internal/frameworks/pyspark.py
156155
- tests/integration/frameworks/test_pyspark_impl.py
157156
pytorch:
158157
- *runner
159-
- bentoml/pytorch.py
160-
- bentoml/_internal/frameworks/common/pytorch.py
161-
- bentoml/_internal/frameworks/pytorch.py
158+
- src/bentoml/pytorch.py
159+
- src/bentoml/_internal/frameworks/common/pytorch.py
160+
- src/bentoml/_internal/frameworks/pytorch.py
162161
- tests/integration/frameworks/test_pytorch_unit.py
163162
- tests/integration/frameworks/test_frameworks.py
164163
torchscript:
165164
- *runner
166-
- bentoml/torchscript.py
167-
- bentoml/_internal/frameworks/common/pytorch.py
168-
- bentoml/_internal/frameworks/torchscript.py
165+
- src/bentoml/torchscript.py
166+
- src/bentoml/_internal/frameworks/common/pytorch.py
167+
- src/bentoml/_internal/frameworks/torchscript.py
169168
- tests/integration/frameworks/test_torchscript_impl.py
170169
pytorch_lightning:
171170
- *runner
172-
- bentoml/pytorch.py
173-
- bentoml/pytorch_lightning.py
174-
- bentoml/_internal/frameworks/common/pytorch.py
175-
- bentoml/_internal/frameworks/torchscript.py
176-
- bentoml/_internal/frameworks/pytorch_lightning.py
171+
- src/bentoml/pytorch.py
172+
- src/bentoml/pytorch_lightning.py
173+
- src/bentoml/_internal/frameworks/common/pytorch.py
174+
- src/bentoml/_internal/frameworks/torchscript.py
175+
- src/bentoml/_internal/frameworks/pytorch_lightning.py
177176
- tests/integration/frameworks/test_pytorch_lightning_impl.py
178177
sklearn:
179178
- *runner
180-
- bentoml/sklearn.py
181-
- bentoml/_internal/frameworks/sklearn.py
179+
- src/bentoml/sklearn.py
180+
- src/bentoml/_internal/frameworks/sklearn.py
182181
- tests/integration/frameworks/test_sklearn_impl.py
183182
spacy:
184183
- *runner
185-
- bentoml/spacy.py
186-
- bentoml/_internal/frameworks/spacy.py
184+
- src/bentoml/spacy.py
185+
- src/bentoml/_internal/frameworks/spacy.py
187186
- tests/integration/frameworks/spacy
188187
statsmodels:
189188
- *runner
190-
- bentoml/statsmodels.py
191-
- bentoml/_internal/frameworks/statsmodels.py
189+
- src/bentoml/statsmodels.py
190+
- src/bentoml/_internal/frameworks/statsmodels.py
192191
- tests/integration/frameworks/test_statsmodels_impl.py
193192
tf1: &tf1
194193
- *runner
195-
- bentoml/tensorflow.py
196-
- bentoml/_internal/frameworks/tensorflow_v1.py
194+
- src/bentoml/tensorflow.py
195+
- src/bentoml/_internal/frameworks/tensorflow_v1.py
197196
- tests/integration/frameworks/test_tensorflow_v1_impl.py
198197
tf2: &tf2
199198
- *runner
200-
- bentoml/tensorflow.py
201-
- bentoml/_internal/frameworks/tensorflow_v2.py
199+
- src/bentoml/tensorflow.py
200+
- src/bentoml/_internal/frameworks/tensorflow_v2.py
202201
- tests/integration/frameworks/models/tensorflow_v2.py
203202
- tests/integration/frameworks/tensorflow_v2_unit.py
204203
keras_tf2:
205204
- *runner
206205
- *tf2
207-
- bentoml/keras.py
208-
- bentoml/_internal/frameworks/keras.py
206+
- src/bentoml/keras.py
207+
- src/bentoml/_internal/frameworks/keras.py
209208
- tests/integration/frameworks/models/keras.py
210209
- tests/integration/frameworks/test_frameworks.py
211210
transformers:
212211
- *runner
213-
- bentoml/transformers.py
214-
- bentoml/_internal/frameworks/transformers.py
212+
- src/bentoml/transformers.py
213+
- src/bentoml/_internal/frameworks/transformers.py
215214
- tests/integration/frameworks/test_transformers_impl.py
216215
xgboost:
217216
- *runner
218-
- bentoml/xgboost.py
219-
- bentoml/_internal/frameworks/xgboost.py
217+
- src/bentoml/xgboost.py
218+
- src/bentoml/_internal/frameworks/xgboost.py
220219
- tests/integration/frameworks/models/xgboost.py
221220
- tests/integration/frameworks/test_frameworks.py
222221
@@ -393,7 +392,7 @@ jobs:
393392
- name: Run unit test for fastai
394393
shell: bash
395394
run: |
396-
OPTS=(--cov=bentoml --cov-config=./pyproject.toml --cov-report=xml:"fastai.unit.xml" --cov-report term-missing:skip-covered)
395+
OPTS=(--cov=src/bentoml --cov-config=./pyproject.toml --cov-report=xml:"fastai.unit.xml" --cov-report term-missing:skip-covered)
397396
python -m pytest ./tests/integration/frameworks/test_fastai_unit.py "${OPTS[@]}" || ERR=1
398397
if [ $ERR -eq 1 ]; then
399398
echo "unit tests for fastai failed!"
@@ -884,7 +883,7 @@ jobs:
884883
- name: Run unit test for pytorch
885884
shell: bash
886885
run: |
887-
OPTS=(--cov=bentoml --cov-config=./pyproject.toml --cov-report=xml:"pytorch.unit.xml" --cov-report term-missing:skip-covered)
886+
OPTS=(--cov=src/bentoml --cov-config=./pyproject.toml --cov-report=xml:"pytorch.unit.xml" --cov-report term-missing:skip-covered)
888887
python -m pytest ./tests/integration/frameworks/test_pytorch_unit.py "${OPTS[@]}" || ERR=1
889888
if [ $ERR -eq 1 ]; then
890889
echo "unit tests for pytorch failed!"
@@ -1198,7 +1197,7 @@ jobs:
11981197
- name: Run unit test for tensorflow_v2
11991198
shell: bash
12001199
run: |
1201-
OPTS=(--cov=bentoml --cov-config=./pyproject.toml --cov-report=xml:"tf2.unit.xml" --cov-report term-missing:skip-covered)
1200+
OPTS=(--cov=src/bentoml --cov-config=./pyproject.toml --cov-report=xml:"tf2.unit.xml" --cov-report term-missing:skip-covered)
12021201
python -m pytest ./tests/integration/frameworks/test_tensorflow_v2_unit.py "${OPTS[@]}" || ERR=1
12031202
if [ $ERR -eq 1 ]; then
12041203
echo "unit tests for tensorflow_v2 failed!"
@@ -1208,7 +1207,7 @@ jobs:
12081207
- name: Run tensorflow_v2 without eager execution
12091208
shell: bash
12101209
run: |
1211-
OPTS=(--cov=bentoml --cov-config=./pyproject.toml --cov-report=xml:"tf2.unit.no_eager.xml" --cov-report term-missing:skip-covered --disable-tf-eager-execution)
1210+
OPTS=(--cov=src/bentoml --cov-config=./pyproject.toml --cov-report=xml:"tf2.unit.no_eager.xml" --cov-report term-missing:skip-covered --disable-tf-eager-execution)
12121211
python -m pytest ./tests/integration/frameworks/test_tensorflow_v2_unit.py "${OPTS[@]}" || ERR=1
12131212
if [ $ERR -eq 1 ]; then
12141213
echo "unit tests for tensorflow_v2 failed!"
@@ -1261,7 +1260,7 @@ jobs:
12611260
- name: Run unit test for transformers
12621261
shell: bash
12631262
run: |
1264-
OPTS=(--cov=bentoml --cov-config=./pyproject.toml --cov-report=xml:"transformers.unit.xml" --cov-report term-missing:skip-covered)
1263+
OPTS=(--cov=src/bentoml --cov-config=./pyproject.toml --cov-report=xml:"transformers.unit.xml" --cov-report term-missing:skip-covered)
12651264
python -m pytest ./tests/integration/frameworks/test_transformers_unit.py "${OPTS[@]}" || ERR=1
12661265
if [ $ERR -eq 1 ]; then
12671266
echo "unit tests for transformers failed!"

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ tests/integration/data
109109

110110
# setuptools_scm generated version file
111111
typings
112-
bentoml/_version.py
112+
**/*/_version.py
113113
typings
114114

115115
# test files
@@ -120,16 +120,16 @@ pyvenv.cfg
120120

121121
# bazel generated files
122122
bazel-*
123-
cpp/bentoml
124-
go/bentoml
125-
node/bentoml
123+
grpc-client/cpp/bentoml
124+
grpc-client/go/bentoml
125+
grpc-client/node/bentoml
126126
node_modules
127127
thirdparty
128128

129129
# Swift-related
130-
swift/**/*/bentoml
130+
**/*/Sources/bentoml
131131
.DS_Store
132-
/.build
132+
**/*/.build
133133
/Packages
134134
/*.xcodeproj
135135
xcuserdata/

.pep8speaks.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ flake8:
1010
- W503
1111
- E501
1212
exclude:
13-
- bentoml/_version.py
14-
- guides
13+
- src/bentoml/_version.py
14+
- src/bentoml/metrics.pyi
15+
- examples
1516

1617

1718
only_mention_files_with_errors: True

MANIFEST.in

Lines changed: 0 additions & 31 deletions
This file was deleted.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ format: ## Running code formatter: black and isort
1414
@./scripts/tools/formatter.sh
1515
format-proto: ## Running proto formatter: buf
1616
@echo "Formatting proto files..."
17-
docker run --init --rm --volume $(GIT_ROOT):/workspace --workdir /workspace bufbuild/buf format --config "/workspace/bentoml/grpc/buf.yaml" -w --path "bentoml/grpc"
17+
docker run --init --rm --volume $(GIT_ROOT)/src:/workspace --workdir /workspace bufbuild/buf format --config "/workspace/bentoml/grpc/buf.yaml" -w --path "bentoml/grpc"
1818
lint: ## Running lint checker: pylint
1919
@./scripts/tools/linter.sh
2020
lint-proto: ## Running proto lint checker: buf
2121
@echo "Linting proto files..."
22-
docker run --init --rm --volume $(GIT_ROOT):/workspace --workdir /workspace bufbuild/buf lint --config "/workspace/bentoml/grpc/buf.yaml" --error-format msvs --path "bentoml/grpc"
22+
docker run --init --rm --volume $(GIT_ROOT)/src:/workspace --workdir /workspace bufbuild/buf lint --config "/workspace/bentoml/grpc/buf.yaml" --error-format msvs --path "bentoml/grpc"
2323
type: ## Running type checker: pyright
2424
@./scripts/tools/type_checker.sh
2525
style: format lint format-proto lint-proto ## Running formatter and linter

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Thanks to all of our amazing contributors!
159159
BentoML collects usage data that helps our team to improve the product.
160160
Only BentoML's internal API calls are being reported. We strip out as much potentially
161161
sensitive information as possible, and we will never collect user code, model data, model names, or stack traces.
162-
Here's the [code](./bentoml/_internal/utils/analytics/usage_stats.py) for usage tracking.
162+
Here's the [code](./src/bentoml/_internal/utils/analytics/usage_stats.py) for usage tracking.
163163
You can opt-out of usage tracking by the `--do-not-track` CLI option:
164164

165165
```bash

0 commit comments

Comments
 (0)