Skip to content

Commit dbb203a

Browse files
authored
build: improve packaging (#249)
PR to make to make packaging a little nicer, in line with how packaging works in `unstructured`. In particular, support for extras is added. This consists of: - Adding the file `sg.in` for dependencies related to `supergradients`. This file has been `pip-compile`d with output `sg.txt`. - All dependencies have been `pip-compile`d. - Adding the file `constraints.in` to add a `numpy` constraint that is required for compliance with `supergradients`. Dependencies that precede `sg.in` need to know about this to avoid conflicts. `constraints.in` is added as a constraints file for all other dependency files. - `make` targets are added for installing `supergradients` dependencies. - CI is updated to install `supergradients` dependencies. - `supergradients` extra is added to `setup.py` and `MANIFEST.in` so it can be picked up by PyPi. - To support the fact that the `supergradients` dependencies are not guaranteed to be installed, the way imports are handled in the `super_gradients.py` model file has been changed so imports are only attempted in the model constructor, in a module-level global variable. The constructor was used instead of doing the import in `initialize` due to an error that occurred during import when initiated from `initialize`.
1 parent f11559b commit dbb203a

File tree

15 files changed

+417
-312
lines changed

15 files changed

+417
-312
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.5
2+
3+
* Improved packaging
4+
15
## 0.7.4
26

37
* Dynamic beam search size has been implemented for Chipper, the decoding process starts with a size = 1 and changes to size = 3 if repetitions appear.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
include requirements/base.in
2+
include requirements/sg.in

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ install-base: install-base-pip-packages
1919

2020
## install: installs all test, dev, and experimental requirements
2121
.PHONY: install
22-
install: install-base-pip-packages install-dev install-detectron2
22+
install: install-base-pip-packages install-dev install-sg install-detectron2
2323

2424
.PHONY: install-ci
25-
install-ci: install-base-pip-packages install-test install-paddleocr
25+
install-ci: install-base-pip-packages install-test install-sg install-paddleocr
2626

2727
.PHONY: install-base-pip-packages
2828
install-base-pip-packages:
@@ -46,6 +46,10 @@ install-test: install-base
4646
install-dev: install-test
4747
pip install -r requirements/dev.txt
4848

49+
.PHONY: install-sg
50+
install-sg: install-base
51+
pip install -r requirements/sg.txt
52+
4953
## pip-compile: compiles all base/dev/test requirements
5054
.PHONY: pip-compile
5155
pip-compile:
@@ -56,6 +60,7 @@ pip-compile:
5660
sed 's/^detectron2 @/# detectron2 @/g' requirements/base.txt
5761
pip-compile --upgrade requirements/test.in
5862
pip-compile --upgrade requirements/dev.in
63+
pip-compile --upgrade requirements/sg.in
5964

6065

6166
#################

requirements/base.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
-c constraints.in
12
layoutparser[layoutmodels,tesseract]
23
python-multipart
34
huggingface-hub
45
opencv-python!=4.7.0.68
5-
super-gradients
6-
supervision
76
# NOTE(benjamin): Pinned because onnxruntime changed the way quantization is done, and we need to update our code to support it
87
onnxruntime<1.16
98
# NOTE(alan): Pinned because this is when the most recent module we import appeared

0 commit comments

Comments
 (0)