Skip to content

Commit 5419dbc

Browse files
authored
build: add ruff and format (#124)
1 parent 6494128 commit 5419dbc

33 files changed

+303
-217
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.2-dev0
2+
3+
* Add ruff to keep code consistent with unstructured
4+
15
## 0.5.1
26

37
* Add annotation for pages

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ check: check-src check-tests check-version
7575
## check-src: runs linters (source only, no tests)
7676
.PHONY: check-src
7777
check-src:
78+
ruff . --line-length 100 --select I,UP015,UP032,UP034,UP018,COM,C4,PT,SIM,PLR0402 --ignore PT011,PT012,SIM117
7879
black --line-length 100 ${PACKAGE_NAME} --check
7980
flake8 ${PACKAGE_NAME}
8081
mypy ${PACKAGE_NAME} --ignore-missing-imports
@@ -101,6 +102,7 @@ check-version:
101102
## tidy: run black
102103
.PHONY: tidy
103104
tidy:
105+
ruff . --fix --line-length 100 --select I,UP015,UP032,UP034,UP018,COM,C4,PT,SIM,PLR0402 --ignore PT011,PT012,SIM117
104106
black --line-length 100 ${PACKAGE_NAME}
105107
black --line-length 100 test_${PACKAGE_NAME}
106108

requirements/base.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ coloredlogs==15.0.1
1818
# via onnxruntime
1919
contourpy==1.0.7
2020
# via matplotlib
21-
cryptography==40.0.2
21+
cryptography==41.0.1
2222
# via pdfminer-six
2323
cycler==0.11.0
2424
# via matplotlib
25-
effdet==0.3.0
25+
effdet==0.4.1
2626
# via layoutparser
2727
filelock==3.12.0
2828
# via
2929
# huggingface-hub
3030
# torch
3131
# transformers
32-
flatbuffers==23.5.9
32+
flatbuffers==23.5.26
3333
# via onnxruntime
3434
fonttools==4.39.4
3535
# via matplotlib
3636
fsspec==2023.5.0
3737
# via huggingface-hub
38-
huggingface-hub==0.14.1
38+
huggingface-hub==0.15.1
3939
# via
4040
# -r requirements/base.in
4141
# timm
@@ -54,7 +54,7 @@ kiwisolver==1.4.4
5454
# via matplotlib
5555
layoutparser[layoutmodels,tesseract]==0.3.4
5656
# via -r requirements/base.in
57-
markupsafe==2.1.2
57+
markupsafe==2.1.3
5858
# via jinja2
5959
matplotlib==3.7.1
6060
# via pycocotools
@@ -76,7 +76,7 @@ numpy==1.24.3
7676
# transformers
7777
omegaconf==2.3.0
7878
# via effdet
79-
onnxruntime==1.14.1
79+
onnxruntime==1.15.0
8080
# via -r requirements/base.in
8181
opencv-python==4.7.0.72
8282
# via
@@ -89,7 +89,7 @@ packaging==23.1
8989
# onnxruntime
9090
# pytesseract
9191
# transformers
92-
pandas==2.0.1
92+
pandas==2.0.2
9393
# via layoutparser
9494
pdf2image==1.16.3
9595
# via layoutparser
@@ -107,7 +107,7 @@ pillow==9.5.0
107107
# torchvision
108108
portalocker==2.7.0
109109
# via iopath
110-
protobuf==4.23.1
110+
protobuf==4.23.2
111111
# via onnxruntime
112112
pycocotools==2.0.6
113113
# via effdet
@@ -132,9 +132,9 @@ pyyaml==6.0
132132
# omegaconf
133133
# timm
134134
# transformers
135-
regex==2023.5.5
135+
regex==2023.6.3
136136
# via transformers
137-
requests==2.30.0
137+
requests==2.31.0
138138
# via
139139
# huggingface-hub
140140
# torchvision
@@ -171,7 +171,7 @@ tqdm==4.65.0
171171
# transformers
172172
transformers==4.29.2
173173
# via -r requirements/base.in
174-
typing-extensions==4.5.0
174+
typing-extensions==4.6.3
175175
# via
176176
# huggingface-hub
177177
# iopath

requirements/dev.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile requirements/dev.in
66
#
7-
anyio==3.6.2
7+
anyio==3.7.0
88
# via
99
# -c requirements/test.txt
1010
# jupyter-server
@@ -49,9 +49,13 @@ defusedxml==0.7.1
4949
# via nbconvert
5050
entrypoints==0.4
5151
# via jupyter-client
52+
exceptiongroup==1.1.1
53+
# via
54+
# -c requirements/test.txt
55+
# anyio
5256
executing==1.2.0
5357
# via stack-data
54-
fastjsonschema==2.16.3
58+
fastjsonschema==2.17.1
5559
# via nbformat
5660
idna==3.4
5761
# via
@@ -131,7 +135,7 @@ jupyterlab-pygments==0.2.2
131135
# via nbconvert
132136
jupyterlab-widgets==3.0.7
133137
# via ipywidgets
134-
markupsafe==2.1.2
138+
markupsafe==2.1.3
135139
# via
136140
# -c requirements/base.txt
137141
# jinja2
@@ -144,15 +148,15 @@ mistune==2.0.5
144148
# via nbconvert
145149
nbclassic==1.0.0
146150
# via notebook
147-
nbclient==0.7.4
151+
nbclient==0.8.0
148152
# via nbconvert
149153
nbconvert==7.4.0
150154
# via
151155
# jupyter
152156
# jupyter-server
153157
# nbclassic
154158
# notebook
155-
nbformat==5.8.0
159+
nbformat==5.9.0
156160
# via
157161
# jupyter-server
158162
# nbclassic
@@ -195,7 +199,7 @@ platformdirs==3.5.1
195199
# via
196200
# -c requirements/test.txt
197201
# jupyter-core
198-
prometheus-client==0.16.0
202+
prometheus-client==0.17.0
199203
# via
200204
# jupyter-server
201205
# nbclassic
@@ -230,7 +234,7 @@ python-dateutil==2.8.2
230234
# via
231235
# -c requirements/base.txt
232236
# jupyter-client
233-
pyzmq==25.0.2
237+
pyzmq==25.1.0
234238
# via
235239
# ipykernel
236240
# jupyter-client
@@ -300,7 +304,7 @@ traitlets==5.9.0
300304
# nbformat
301305
# notebook
302306
# qtconsole
303-
typing-extensions==4.5.0
307+
typing-extensions==4.6.3
304308
# via
305309
# -c requirements/base.txt
306310
# -c requirements/test.txt
@@ -311,7 +315,7 @@ webencodings==0.5.1
311315
# via
312316
# bleach
313317
# tinycss2
314-
websocket-client==1.5.1
318+
websocket-client==1.5.2
315319
# via jupyter-server
316320
wheel==0.40.0
317321
# via pip-tools

requirements/test.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ mypy
1414
pytest-cov
1515
pdf2image>=1.16.2
1616
huggingface_hub>=0.11.1
17+
ruff

requirements/test.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile requirements/test.in
66
#
7-
anyio==3.6.2
7+
anyio==3.7.0
88
# via httpcore
99
black==23.3.0
1010
# via -r requirements/test.in
@@ -22,12 +22,14 @@ click==8.1.3
2222
# via
2323
# -r requirements/test.in
2424
# black
25-
coverage[toml]==7.2.5
25+
coverage[toml]==7.2.7
2626
# via
2727
# -r requirements/test.in
2828
# pytest-cov
2929
exceptiongroup==1.1.1
30-
# via pytest
30+
# via
31+
# anyio
32+
# pytest
3133
filelock==3.12.0
3234
# via
3335
# -c requirements/base.txt
@@ -44,11 +46,11 @@ fsspec==2023.5.0
4446
# huggingface-hub
4547
h11==0.14.0
4648
# via httpcore
47-
httpcore==0.17.1
49+
httpcore==0.17.2
4850
# via httpx
49-
httpx==0.24.0
51+
httpx==0.24.1
5052
# via -r requirements/test.in
51-
huggingface-hub==0.14.1
53+
huggingface-hub==0.15.1
5254
# via
5355
# -c requirements/base.txt
5456
# -r requirements/test.in
@@ -96,16 +98,18 @@ pyflakes==3.0.1
9698
# via flake8
9799
pytest==7.3.1
98100
# via pytest-cov
99-
pytest-cov==4.0.0
101+
pytest-cov==4.1.0
100102
# via -r requirements/test.in
101103
pyyaml==6.0
102104
# via
103105
# -c requirements/base.txt
104106
# huggingface-hub
105-
requests==2.30.0
107+
requests==2.31.0
106108
# via
107109
# -c requirements/base.txt
108110
# huggingface-hub
111+
ruff==0.0.270
112+
# via -r requirements/test.in
109113
sniffio==1.3.0
110114
# via
111115
# anyio
@@ -123,7 +127,7 @@ tqdm==4.65.0
123127
# via
124128
# -c requirements/base.txt
125129
# huggingface-hub
126-
typing-extensions==4.5.0
130+
typing-extensions==4.6.3
127131
# via
128132
# -c requirements/base.txt
129133
# black

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
See the License for the specific language governing permissions and
1818
limitations under the License.
1919
"""
20-
from setuptools import setup, find_packages
2120
from typing import List
2221

22+
from setuptools import find_packages, setup
23+
2324
from unstructured_inference.__version__ import __version__
2425

2526

@@ -36,10 +37,17 @@ def load_requirements(file_list=None):
3637
return requirements
3738

3839

40+
def load_text_from_file(filename: str):
41+
"""Retrieves text from a file."""
42+
with open(filename, encoding="utf-8") as fp:
43+
description = fp.read()
44+
return description
45+
46+
3947
setup(
4048
name="unstructured_inference",
4149
description="A library for performing inference using trained models.",
42-
long_description=open("README.md", "r", encoding="utf-8").read(),
50+
long_description=load_text_from_file("README.md"),
4351
long_description_content_type="text/markdown",
4452
keywords="NLP PDF HTML CV XML parsing preprocessing",
4553
url="https://github.com/Unstructured-IO/unstructured-inference",
@@ -78,6 +86,6 @@ def load_requirements(file_list=None):
7886
'protobuf<3.21 ; platform_machine=="x86_64"',
7987
# NOTE(alan): Pin to get around error: undefined symbol: _dl_sym, version GLIBC_PRIVATE
8088
'paddlepaddle>=2.4 ; platform_machine=="x86_64"',
81-
]
89+
],
8290
},
8391
)

0 commit comments

Comments
 (0)