Skip to content

Commit 7ca5b98

Browse files
Initial commit
0 parents  commit 7ca5b98

File tree

174 files changed

+119902
-0
lines changed

Some content is hidden

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

174 files changed

+119902
-0
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401, B905, E402
3+
max-line-length = 79
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: vietanhdev

.github/workflows/python-publish.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
id-token: write
10+
11+
jobs:
12+
build-n-publish:
13+
if: startsWith(github.ref, 'refs/tags/')
14+
15+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.x"
23+
- name: Install pypa/build
24+
run: >-
25+
python -m
26+
pip install
27+
build
28+
--user
29+
- name: Set preferred device to CPU
30+
run: >-
31+
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "CPU"/g' anylabeling/app_info.py
32+
- name: Build a binary wheel and a source tarball
33+
run: >-
34+
python -m
35+
build
36+
--sdist
37+
--wheel
38+
--outdir dist/
39+
.
40+
- name: Publish distribution 📦 to Test PyPI
41+
uses: pypa/[email protected]
42+
with:
43+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
44+
repository-url: https://test.pypi.org/legacy/
45+
skip_existing: true
46+
- name: Publish distribution 📦 to PyPI
47+
if: startsWith(github.ref, 'refs/tags')
48+
uses: pypa/[email protected]
49+
with:
50+
password: ${{ secrets.PYPI_API_TOKEN }}
51+
skip_existing: true
52+
53+
build-n-publish-gpu:
54+
if: startsWith(github.ref, 'refs/tags/')
55+
56+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v3
60+
- name: Set up Python
61+
uses: actions/setup-python@v4
62+
with:
63+
python-version: "3.x"
64+
- name: Install pypa/build
65+
run: >-
66+
python -m
67+
pip install
68+
build
69+
--user
70+
- name: Set preferred device to GPU
71+
run: >-
72+
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py
73+
- name: Build a binary wheel and a source tarball
74+
run: >-
75+
python -m
76+
build
77+
--wheel
78+
--outdir dist/
79+
.
80+
- name: Publish distribution 📦 to Test PyPI
81+
uses: pypa/[email protected]
82+
with:
83+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
84+
repository-url: https://test.pypi.org/legacy/
85+
skip_existing: true
86+
- name: Publish distribution 📦 to PyPI
87+
if: startsWith(github.ref, 'refs/tags')
88+
uses: pypa/[email protected]
89+
with:
90+
password: ${{ secrets.PYPI_API_TOKEN }}
91+
skip_existing: true

.github/workflows/release.yml

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
name: New Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
if: startsWith(github.ref, 'refs/tags/')
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Build Changelog
19+
id: github_release
20+
uses: mikepenz/release-changelog-builder-action@v3
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
with:
24+
configurationJson: |
25+
{
26+
"template": "## What's Changed\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>\n\nIf you find this project useful, please consider [sponsoring](https://ko-fi.com/vietanhdev) its development.",
27+
"categories": [
28+
{
29+
"title": "## 🚀 Features",
30+
"labels": ["feature"]
31+
},
32+
{
33+
"title": "## 🐛 Fixes",
34+
"labels": ["fix"]
35+
},
36+
{
37+
"title": "## 💬 Other",
38+
"labels": ["other"]
39+
}
40+
]
41+
}
42+
43+
- name: Create Release
44+
id: create_release
45+
uses: mikepenz/[email protected]
46+
with:
47+
body: ${{steps.github_release.outputs.changelog}}
48+
draft: true
49+
prerelease: true
50+
51+
- name: Create release url file
52+
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
53+
54+
- name: Save release url file for publish
55+
uses: actions/upload-artifact@v1
56+
with:
57+
name: release_url
58+
path: release_url.txt
59+
60+
publish:
61+
needs: [release]
62+
63+
strategy:
64+
matrix:
65+
os: [macos-latest, ubuntu-latest, windows-latest]
66+
67+
runs-on: ${{ matrix.os }}
68+
69+
steps:
70+
- uses: actions/checkout@v2
71+
with:
72+
submodules: true
73+
74+
- uses: conda-incubator/setup-miniconda@v2
75+
with:
76+
auto-update-conda: true
77+
python-version: '3.7'
78+
79+
- name: Set preferred device to CPU
80+
shell: bash -l {0}
81+
run: >-
82+
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "CPU"/g' anylabeling/app_info.py
83+
84+
- name: Install main
85+
shell: bash -l {0}
86+
run: |
87+
pip install .
88+
89+
- name: Install PyQt5 for macOS
90+
shell: bash -l {0}
91+
run: |
92+
conda install -c conda-forge pyqt==5.15.7
93+
if: runner.os == 'macOS'
94+
95+
- name: Run pyinstaller
96+
shell: bash -l {0}
97+
run: |
98+
pip install pyinstaller
99+
pyinstaller anylabeling.spec
100+
101+
- name: Load release url file from release job
102+
uses: actions/download-artifact@v1
103+
with:
104+
name: release_url
105+
106+
- name: Get release file name & upload url
107+
id: get_release_info
108+
run: |
109+
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
110+
111+
- name: Upload release executable on macOS & Linux
112+
id: upload_release_executable_macos_linux
113+
uses: actions/upload-release-asset@v1
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
with:
117+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
118+
asset_path: ./dist/anylabeling
119+
asset_name: AnyLabeling-${{ runner.os }}
120+
asset_content_type: application/octet-stream
121+
if: runner.os != 'Windows'
122+
123+
- name: Upload release executable on Windows
124+
id: upload_release_executable_windows
125+
uses: actions/upload-release-asset@v1
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
with:
129+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
130+
asset_path: ./dist/anylabeling.exe
131+
asset_name: AnyLabeling.exe
132+
asset_content_type: application/octet-stream
133+
if: runner.os == 'Windows'
134+
135+
- name: Create dmg for macOS
136+
run: |
137+
npm install -g create-dmg
138+
cd dist
139+
create-dmg AnyLabeling.app || test -f AnyLabeling\ 0.0.0.dmg
140+
mv AnyLabeling\ 0.0.0.dmg AnyLabeling.dmg
141+
if: runner.os == 'macOS'
142+
143+
- name: Upload release app on macOS
144+
id: upload_release_app_macos
145+
uses: actions/upload-release-asset@v1
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
with:
149+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
150+
asset_path: ./dist/AnyLabeling.dmg
151+
asset_name: AnyLabeling.dmg
152+
asset_content_type: application/octet-stream
153+
if: runner.os == 'macOS'
154+
155+
publish-gpu:
156+
needs: [release]
157+
158+
strategy:
159+
matrix:
160+
os: [macos-latest, ubuntu-latest, windows-latest]
161+
162+
runs-on: ${{ matrix.os }}
163+
164+
steps:
165+
- uses: actions/checkout@v2
166+
with:
167+
submodules: true
168+
169+
- uses: conda-incubator/setup-miniconda@v2
170+
with:
171+
auto-update-conda: true
172+
python-version: '3.7'
173+
174+
- name: Set preferred device to GPU
175+
shell: bash -l {0}
176+
run: >-
177+
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py
178+
179+
- name: Install main
180+
shell: bash -l {0}
181+
run: |
182+
pip install .
183+
184+
- name: Install PyQt5 for macOS
185+
shell: bash -l {0}
186+
run: |
187+
conda install -c conda-forge pyqt==5.15.7
188+
if: runner.os == 'macOS'
189+
190+
- name: Run pyinstaller
191+
shell: bash -l {0}
192+
run: |
193+
pip install pyinstaller
194+
pyinstaller anylabeling.spec
195+
196+
- name: Load release url file from release job
197+
uses: actions/download-artifact@v1
198+
with:
199+
name: release_url
200+
201+
- name: Get release file name & upload url
202+
id: get_release_info
203+
run: |
204+
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
205+
206+
- name: Upload release executable on macOS & Linux
207+
id: upload_release_executable_macos_linux
208+
uses: actions/upload-release-asset@v1
209+
env:
210+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211+
with:
212+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
213+
asset_path: ./dist/anylabeling
214+
asset_name: AnyLabeling-${{ runner.os }}-GPU
215+
asset_content_type: application/octet-stream
216+
if: runner.os != 'Windows'
217+
218+
- name: Upload release executable on Windows
219+
id: upload_release_executable_windows
220+
uses: actions/upload-release-asset@v1
221+
env:
222+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
223+
with:
224+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
225+
asset_path: ./dist/anylabeling.exe
226+
asset_name: AnyLabeling-GPU.exe
227+
asset_content_type: application/octet-stream
228+
if: runner.os == 'Windows'
229+
230+
- name: Create dmg for macOS
231+
run: |
232+
npm install -g create-dmg
233+
cd dist
234+
create-dmg AnyLabeling.app || test -f AnyLabeling\ 0.0.0.dmg
235+
mv AnyLabeling\ 0.0.0.dmg AnyLabeling-GPU.dmg
236+
if: runner.os == 'macOS'
237+
238+
- name: Upload release app on macOS
239+
id: upload_release_app_macos
240+
uses: actions/upload-release-asset@v1
241+
env:
242+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
243+
with:
244+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
245+
asset_path: ./dist/AnyLabeling-GPU.dmg
246+
asset_name: AnyLabeling-GPU.dmg
247+
asset_content_type: application/octet-stream
248+
if: runner.os == 'macOS'

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
__pycache__
3+
*.pyc
4+
*.egg-info
5+
anylabeling/data
6+
/data
7+
/dist
8+
/build
9+
/wheels_dist
10+
*_ui.py
11+
anylabeling/app_info.py-*
12+
zipped_models/*

0 commit comments

Comments
 (0)