Spaces:
Configuration error
Configuration error
Eugene
commited on
ci: Speed up python linting (#64)
Browse filesSigned-off-by: Eugene <[email protected]>
- .flake8 +0 -7
- .github/workflows/job-checks.yml +11 -2
- CONTRIBUTING.md +2 -3
- pyproject.toml +1 -1
- uv.lock +40 -2
.flake8
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
[flake8]
|
2 |
-
max-line-length = 88
|
3 |
-
exclude = test/*
|
4 |
-
max-complexity = 18
|
5 |
-
docstring-convention = google
|
6 |
-
ignore = W503,E203
|
7 |
-
classmethod-decorators = classmethod,validator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/job-checks.yml
CHANGED
@@ -16,10 +16,19 @@ jobs:
|
|
16 |
with:
|
17 |
python-version: ${{ matrix.python-version }}
|
18 |
enable-cache: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
- name: Install dependencies
|
20 |
-
run: uv sync --all-extras --no-extra cu124
|
|
|
21 |
- name: Run styling check
|
22 |
-
run:
|
23 |
|
24 |
build-package:
|
25 |
uses: ./.github/workflows/job-build.yml
|
|
|
16 |
with:
|
17 |
python-version: ${{ matrix.python-version }}
|
18 |
enable-cache: true
|
19 |
+
|
20 |
+
- name: pre-commit cache key
|
21 |
+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
|
22 |
+
- uses: actions/cache@v4
|
23 |
+
with:
|
24 |
+
path: ~/.cache/pre-commit
|
25 |
+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
26 |
+
|
27 |
- name: Install dependencies
|
28 |
+
run: uv sync --frozen --all-extras --no-extra cu124
|
29 |
+
|
30 |
- name: Run styling check
|
31 |
+
run: pre-commit run --all-files
|
32 |
|
33 |
build-package:
|
34 |
uses: ./.github/workflows/job-build.yml
|
CONTRIBUTING.md
CHANGED
@@ -142,8 +142,7 @@ poetry add NAME
|
|
142 |
|
143 |
We use the following tools to enforce code style:
|
144 |
|
145 |
-
-
|
146 |
-
- Black, to format code
|
147 |
|
148 |
We run a series of checks on the code base on every commit, using `pre-commit`. To install the hooks, run:
|
149 |
|
@@ -157,4 +156,4 @@ To run the checks on-demand, run:
|
|
157 |
pre-commit run --all-files
|
158 |
```
|
159 |
|
160 |
-
Note:
|
|
|
142 |
|
143 |
We use the following tools to enforce code style:
|
144 |
|
145 |
+
- ruff, to sort imports and format code
|
|
|
146 |
|
147 |
We run a series of checks on the code base on every commit, using `pre-commit`. To install the hooks, run:
|
148 |
|
|
|
156 |
pre-commit run --all-files
|
157 |
```
|
158 |
|
159 |
+
Note: Formatting checks like `ruff` will "fail" if they modify files. This is because `pre-commit` doesn't like to see files modified by their Hooks. In these cases, `git add` the modified files and `git commit` again.
|
pyproject.toml
CHANGED
@@ -64,7 +64,7 @@ cu124 = [
|
|
64 |
[dependency-groups]
|
65 |
dev = [
|
66 |
"mypy~=1.11",
|
67 |
-
"pre-commit~=
|
68 |
"pytest~=8.3",
|
69 |
"pytest-asyncio~=0.24",
|
70 |
"pytest-check~=2.4",
|
|
|
64 |
[dependency-groups]
|
65 |
dev = [
|
66 |
"mypy~=1.11",
|
67 |
+
"pre-commit-uv~=4.1",
|
68 |
"pytest~=8.3",
|
69 |
"pytest-asyncio~=0.24",
|
70 |
"pytest-check~=2.4",
|
uv.lock
CHANGED
@@ -543,7 +543,7 @@ ui = [
|
|
543 |
[package.dev-dependencies]
|
544 |
dev = [
|
545 |
{ name = "mypy" },
|
546 |
-
{ name = "pre-commit" },
|
547 |
{ name = "pytest" },
|
548 |
{ name = "pytest-asyncio" },
|
549 |
{ name = "pytest-check" },
|
@@ -576,7 +576,7 @@ provides-extras = ["ui", "tesserocr", "rapidocr", "cpu", "cu124"]
|
|
576 |
[package.metadata.requires-dev]
|
577 |
dev = [
|
578 |
{ name = "mypy", specifier = "~=1.11" },
|
579 |
-
{ name = "pre-commit", specifier = "~=
|
580 |
{ name = "pytest", specifier = "~=8.3" },
|
581 |
{ name = "pytest-asyncio", specifier = "~=0.24" },
|
582 |
{ name = "pytest-check", specifier = "~=2.4" },
|
@@ -1945,6 +1945,19 @@ wheels = [
|
|
1945 |
{ url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643 },
|
1946 |
]
|
1947 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1948 |
[[package]]
|
1949 |
name = "protobuf"
|
1950 |
version = "5.29.3"
|
@@ -3637,6 +3650,31 @@ wheels = [
|
|
3637 |
{ url = "https://files.pythonhosted.org/packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", size = 128369 },
|
3638 |
]
|
3639 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3640 |
[[package]]
|
3641 |
name = "uvicorn"
|
3642 |
version = "0.34.0"
|
|
|
543 |
[package.dev-dependencies]
|
544 |
dev = [
|
545 |
{ name = "mypy" },
|
546 |
+
{ name = "pre-commit-uv" },
|
547 |
{ name = "pytest" },
|
548 |
{ name = "pytest-asyncio" },
|
549 |
{ name = "pytest-check" },
|
|
|
576 |
[package.metadata.requires-dev]
|
577 |
dev = [
|
578 |
{ name = "mypy", specifier = "~=1.11" },
|
579 |
+
{ name = "pre-commit-uv", specifier = "~=4.1" },
|
580 |
{ name = "pytest", specifier = "~=8.3" },
|
581 |
{ name = "pytest-asyncio", specifier = "~=0.24" },
|
582 |
{ name = "pytest-check", specifier = "~=2.4" },
|
|
|
1945 |
{ url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643 },
|
1946 |
]
|
1947 |
|
1948 |
+
[[package]]
|
1949 |
+
name = "pre-commit-uv"
|
1950 |
+
version = "4.1.4"
|
1951 |
+
source = { registry = "https://pypi.org/simple" }
|
1952 |
+
dependencies = [
|
1953 |
+
{ name = "pre-commit" },
|
1954 |
+
{ name = "uv" },
|
1955 |
+
]
|
1956 |
+
sdist = { url = "https://files.pythonhosted.org/packages/b1/6c/c3c1d01698c8abb0b546defc0304971fa7fb2ba84ad35587b9dad095d73f/pre_commit_uv-4.1.4.tar.gz", hash = "sha256:3db606a79b226127b27dbbd8381b78c0e30de3ac775a8492c576a68e9250535c", size = 6493 }
|
1957 |
+
wheels = [
|
1958 |
+
{ url = "https://files.pythonhosted.org/packages/f1/70/1b65f9118ef64f6ffe5d57a67170bbff25d4f4a3d1cb78e8ed3392e16114/pre_commit_uv-4.1.4-py3-none-any.whl", hash = "sha256:7f01fb494fa1caa5097d20a38f71df7cea0209197b2564699cef9b3f3aa9d135", size = 5578 },
|
1959 |
+
]
|
1960 |
+
|
1961 |
[[package]]
|
1962 |
name = "protobuf"
|
1963 |
version = "5.29.3"
|
|
|
3650 |
{ url = "https://files.pythonhosted.org/packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", size = 128369 },
|
3651 |
]
|
3652 |
|
3653 |
+
[[package]]
|
3654 |
+
name = "uv"
|
3655 |
+
version = "0.6.2"
|
3656 |
+
source = { registry = "https://pypi.org/simple" }
|
3657 |
+
sdist = { url = "https://files.pythonhosted.org/packages/6d/05/118e10d91981b85f47b27d089782a6598a9584ff607bffb8e2f6be1f1245/uv-0.6.2.tar.gz", hash = "sha256:d696a4f3d4a3ac1b305255e8814ae3a147ea3428a977bb3b4335a339941799bc", size = 3066291 }
|
3658 |
+
wheels = [
|
3659 |
+
{ url = "https://files.pythonhosted.org/packages/a1/cf/9c3c9a427c7ecc37be238c4433188614b3d342191c0299c632f512d493ff/uv-0.6.2-py3-none-linux_armv6l.whl", hash = "sha256:d501ae16fb33969b12a64ac7b9c49d672b8c3964026c5dcaee3b1dcd50a6a22c", size = 15513992 },
|
3660 |
+
{ url = "https://files.pythonhosted.org/packages/86/01/1e1f88826d92d11f2232f96eef190574a4edb470546a141bba652cd37240/uv-0.6.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:2c13ca920d87dc00721a86ac3d19667cff5435b369d21e3d6df76b373d8fa8df", size = 15659547 },
|
3661 |
+
{ url = "https://files.pythonhosted.org/packages/ee/40/59e9c03431d4c82420e081f92719e5784db8f1c92a25b2abdfe6ac645b7e/uv-0.6.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f24e119d338bae32b5a604585b7b518036fba556e2c2d9dbd2d7cf1411213b57", size = 14589044 },
|
3662 |
+
{ url = "https://files.pythonhosted.org/packages/11/8b/5d9f9f4e3969d6a2c9ce9a0b4a85ecb8ca89bf5c00e9ec097cf472abb2a2/uv-0.6.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:1db90b728a173926e2018b89df776a373b1e50520466f61e0dbf05f9a64a6db5", size = 15034328 },
|
3663 |
+
{ url = "https://files.pythonhosted.org/packages/f3/ba/f31fd6af8f70b21d9e0b7cca0241a8f10e03d24862f49f93fbc5ff1e4fce/uv-0.6.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d23fb9cd41aecb31845e884d0bfde243e04e763abeab3532138321b4ebe7437c", size = 15275180 },
|
3664 |
+
{ url = "https://files.pythonhosted.org/packages/aa/3b/358cfea4265a0966fafa7934ed0f9f1fb031d7ebbe8a15e02a308afff6ad/uv-0.6.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:df0a1d95fd1539c05de434259fafcee0b6852900d4178e94b3b6b6b06438b60c", size = 15969503 },
|
3665 |
+
{ url = "https://files.pythonhosted.org/packages/57/f5/840d8fb46c1cf723e1b7168832de52e58d86764aa625c2100b35a27261af/uv-0.6.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f2f0dc9a0564b31d4efdee317c176a23bbe7e61aec6d281a331ba6ae32f828ff", size = 16950563 },
|
3666 |
+
{ url = "https://files.pythonhosted.org/packages/f6/37/75c5ff09db56c34f0f5d3d55dd4188e52d09219ef76bfe176dae58ed5f4a/uv-0.6.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:326aff8c4fb8153e2384e79904c27b1c9d4c3a5879b53a6fbc2da3283fda321d", size = 16631562 },
|
3667 |
+
{ url = "https://files.pythonhosted.org/packages/9d/5f/91bfae5ecf9f6c5f4754aa794159acc77245a53233a966865ae4974e5cdf/uv-0.6.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b8763f310a473f46c0226f5e08a876bd34de121ac370cc7294a5397a13a18d8a", size = 20994598 },
|
3668 |
+
{ url = "https://files.pythonhosted.org/packages/8d/39/17f77b4b5f1a1e579d9ce94859aada9418c9ebcaa227b54b10648218bafa/uv-0.6.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e2e421947ef889e6c8913992c560d611826464eabc78f8f702a5eff824aabc7", size = 16367280 },
|
3669 |
+
{ url = "https://files.pythonhosted.org/packages/a7/6b/fbd9794e1344b299e02993322f44b500f4d66ecdb83860e2fcf35d8cac2c/uv-0.6.2-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:7dd26dabd918e5648ecf94fb7c0787db954237e34ea3bdd944b98d007b44c3a5", size = 15317824 },
|
3670 |
+
{ url = "https://files.pythonhosted.org/packages/51/a0/9249a55365c2f9781243a7f35c3a01864b19aa9a62b1fc50b7231793346e/uv-0.6.2-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:f3719da2e59403783eab634a6238b90051fc65379e02c10b9ca1b32b26d35f77", size = 15228644 },
|
3671 |
+
{ url = "https://files.pythonhosted.org/packages/27/76/790b3d9c0b9ecd9ab6c1b7e904c36d470685c70d0b21a134b026452e0fcc/uv-0.6.2-py3-none-musllinux_1_1_i686.whl", hash = "sha256:b435687e5c26a64858ea842fbb4b35ced8e8741a99d1b75d0c0143462e956db9", size = 15608612 },
|
3672 |
+
{ url = "https://files.pythonhosted.org/packages/05/b6/79961374b2318461b4dfc0e565d63281bf788fea93fc81b2d1738847aec2/uv-0.6.2-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:0f1e8e15c92607862e72e0467a31947af7b9aef93924072e9b4d5dcb5633d374", size = 16480962 },
|
3673 |
+
{ url = "https://files.pythonhosted.org/packages/68/20/df7788bde9d114c501cd8ebb60235be07ff0fb0dc26fa1e7e99ada251d73/uv-0.6.2-py3-none-win32.whl", hash = "sha256:52b7452f4c523b9875de53ba73df87acd1cdea36640281d0d80c8074eda42f16", size = 15717804 },
|
3674 |
+
{ url = "https://files.pythonhosted.org/packages/e1/0a/fc966f859b6252050c71e1afcdce116c8ef3513f8b423bb3ca05fb13485d/uv-0.6.2-py3-none-win_amd64.whl", hash = "sha256:5337cdb6ecc604d0cf36fe6799dd0479111b606009e6c29685d213c74eb40373", size = 17017798 },
|
3675 |
+
{ url = "https://files.pythonhosted.org/packages/03/82/4318c4874c8dd59a0386e2bf0f4d09fc5bb4900349238828153235d387eb/uv-0.6.2-py3-none-win_arm64.whl", hash = "sha256:27ecb8f6ef796220062f31a12e2dc5dc7a14704aa1df0da2dfa3530346c7e3cc", size = 15923484 },
|
3676 |
+
]
|
3677 |
+
|
3678 |
[[package]]
|
3679 |
name = "uvicorn"
|
3680 |
version = "0.34.0"
|