Skip to content

Commit 0155515

Browse files
authored
Merge pull request #5 from KernelA/fix-build
Use cibuildwheel instead build
2 parents ecf2b3d + b2c2b3e commit 0155515

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

.github/workflows/build-and-publihs.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ on:
1616

1717
jobs:
1818
build:
19-
runs-on: ubuntu-latest
20-
2119
strategy:
2220
fail-fast: false
2321
matrix:
2422
python-version: ["3.9"]
25-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
23+
os: ["ubuntu-20.04", "windows-2019", "macos-11"]
24+
25+
runs-on: ${{ matrix.os }}
2626

2727
steps:
2828
- uses: actions/checkout@v3
@@ -35,24 +35,17 @@ jobs:
3535
cache-dependency-path: 'requirements.*.txt'
3636

3737
- name: Install dependencies
38-
run: pip install -r ./requirements.cpu.txt -r ./requirements.dev.txt
38+
run: pip install -r ./requirements.dev.txt
3939

40-
- name: Build package
41-
run: python -m build --no-isolation -w
40+
- name: Build wheels
41+
run: python -m cibuildwheel --output-dir wheelhouse
4242

43-
- name: Install package
44-
run: pip install ./dist/*.whl
45-
46-
- name: Run tests
47-
run: |
48-
pytest ./tests
49-
5043
- name: Upload to PyPi
5144
if: ${{ github.ref_name == 'master' }}
5245
env:
5346
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
5447
TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }}
55-
run: twine upload --skip-existing --non-interactive ./dist/*.whl
48+
run: twine upload --skip-existing --non-interactive ./wheelhouse/*.whl
5649

5750
release:
5851
runs-on: "ubuntu-latest"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,5 @@ cython_debug/
139139
.vscode/
140140
*.jpg
141141
test.ipynb
142-
**/nms/*.c
142+
**/nms/*.c
143+
wheelhouse/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pip install -r ./requirements.dev.txt
3131
You need C compiler to compile extension. [See](https://docs.cython.org/en/latest/src/quickstart/install.html#installing-cython)
3232

3333
```
34-
python -m build --no-isolation -w
34+
python -m cibuildwheel --platform <your_platform>
3535
```
3636

3737
Install binary distribution:

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=63.0", "wheel>=0.40"]
2+
requires = [
3+
"setuptools>=63.0",
4+
"wheel>=0.40",
5+
"cython~=3.0.0",
6+
"numpy>=1.20.0"
7+
]
38
build-backend = "setuptools.build_meta"
49

510
[tool.isort]
@@ -76,3 +81,11 @@ env = "GH_TOKEN"
7681
[tool.semantic_release.publish]
7782
dist_glob_patterns = ["dist/*"]
7883
upload_to_vcs_release = false
84+
85+
86+
[tool.cibuildwheel]
87+
test-requires = "pytest"
88+
test-command = "pytest {project}/tests"
89+
before-test = "pip install -r ./requirements.inference.txt -r ./requirements.torch.cpu.txt"
90+
build = "cp39-*"
91+
skip = ["*-win32", "*-manylinux_i686", "pp*", '*_arm64', "*-musllinux_*"]

requirements.dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ pylint
33
pytest
44
setuptools>=63.0
55
wheel>=0.40
6-
build~=0.10.0
76
twine~=4.0.2
7+
cibuildwheel~=2.15.0
88
python-semantic-release~=8.0.7

requirements.inference.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
opencv-python-headless~=4.8.0.76
2-
onnxruntime-gpu~=1.15.1
3-
matplotlib~=3.7.2
1+
opencv-python-headless>=4.7.0.0
2+
onnxruntime>=1.11.0
3+
matplotlib~=3.7

0 commit comments

Comments
 (0)