Skip to content

Commit bd12e56

Browse files
markbaderhotzenklotznormanrz
authored
Wkcuber with typer (#903)
* First minimal version of wkcuber with typer. * Add executor options to all subtasks that support executor. * Add minimal testcases for wkcuber. * Add testcases to test_cli.py. * Add parser for voxel size, mag and bounding box. * Update wkcuber/README.md Co-authored-by: Tom Herold <[email protected]> * Update wkcuber/README.md Co-authored-by: Tom Herold <[email protected]> * Implement requested changes. * Fix minor naming issues. * Update readme.md. * Refactor check_equality.py * Correct wrongly imported Annotated. * Implement requested changes and keep some of the old wkcuber modules. * Move wkcuber into webknossos package and update tests and docs. * Update dependencies and adapt ci workflow. * Update local_wk_setup and remove unused methods from utils. * Update dependencies. * Disable typecheck for nifti image file. * Update download functionality and fix some typing issues. * Type further variables and adapt the parser methods. * Create redirection package and mark wkcuber as outdated. * Update testcases of webknossos cli tool. * Implement further requested changes. * Change typing of parse_path. * disable fixme for pylint. * Adapt description of enum in cli utils. * Adapt docker test in ci pipeline. * Update Dockerfile * Update README.md * Update webknossos/Changelog.md Co-authored-by: Norman Rzepka <[email protected]> * Change exit code for failing equality check. --------- Co-authored-by: Tom Herold <[email protected]> Co-authored-by: Norman Rzepka <[email protected]>
1 parent f83e7a0 commit bd12e56

File tree

168 files changed

+5471
-21161
lines changed

Some content is hidden

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

168 files changed

+5471
-21161
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
wkcuber/testdata
2-
wkcuber/testoutput
31
webknossos/testdata
42
webknossos/testoutput

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
## Context
11-
- Affected library: e.g. webknossos or wkcuber
11+
- Affected library: e.g. webknossos
1212
<!--- In what context did your bug occur? -->
1313
<!--- Providing context helps us come up with a solution that is most useful. -->
1414

@@ -32,4 +32,4 @@ assignees: ''
3232
<!--- In what environment did the bug occur? -->
3333
- Operating System and version: e.g. Windows 10
3434
- Version of webKnossos-libs (Release or Commit):
35-
(can be found e.g. with `pip show webknossos` or `wkcuber --version`)
35+
(can be found e.g. with `pip show webknossos --version`)

.github/ISSUE_TEMPLATE/feature_suggestion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
## Detailed Description
11-
- Affected library: e.g. webknossos or wkcuber
11+
- Affected library: e.g. webknossos
1212
<!--- Provide a detailed description of the change or new feature you would like to have. -->
1313

1414
## Use Cases & Context

.github/workflows/ci.yml

Lines changed: 21 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
outputs:
1919
webknossos: ${{ steps.filter.outputs.webknossos || github.ref == 'refs/heads/master' }}
20-
wkcuber: ${{ steps.filter.outputs.wkcuber || github.ref == 'refs/heads/master' }}
2120
cluster_tools: ${{ steps.filter.outputs.cluster_tools || github.ref == 'refs/heads/master' }}
2221
steps:
2322
- uses: actions/checkout@v3
@@ -27,8 +26,6 @@ jobs:
2726
filters: |
2827
webknossos:
2928
- 'webknossos/**'
30-
wkcuber:
31-
- 'wkcuber/**'
3229
cluster_tools:
3330
- 'cluster_tools/**'
3431
@@ -180,118 +177,10 @@ jobs:
180177
git diff --no-ext-diff --quiet --exit-code
181178
[[ -z $(git status -s) ]]
182179
183-
wkcuber_linux:
184-
needs: [changes]
185-
if: |
186-
${{ needs.changes.outputs.cluster_tools == 'true' }} ||
187-
${{ needs.changes.outputs.webknossos == 'true' }} ||
188-
${{ needs.changes.outputs.wkcuber == 'true' }}
189-
runs-on: ubuntu-latest
190-
strategy:
191-
max-parallel: 4
192-
matrix:
193-
python-version: ["3.8", "3.9", "3.10"]
194-
defaults:
195-
run:
196-
working-directory: wkcuber
197-
198-
steps:
199-
- uses: actions/checkout@v3
200-
- name: Set up Python ${{ matrix.python-version }}
201-
uses: actions/setup-python@v4
202-
with:
203-
python-version: ${{ matrix.python-version }}
204-
205-
- name: Install dependencies
206-
run: |
207-
pip install -r ../requirements.txt
208-
poetry install
209-
210-
- name: Check formatting
211-
run: ./format.sh check
212-
if: ${{ needs.changes.outputs.wkcuber == 'true' }}
213-
214-
- name: Lint code
215-
run: ./lint.sh
216-
if: ${{ needs.changes.outputs.wkcuber == 'true' }}
217-
218-
- name: Check typing
219-
run: ./typecheck.sh
220-
221-
- name: Run tests
222-
run: ./test.sh
223-
224-
- name: Check if git is dirty
225-
run: |
226-
git diff --no-ext-diff --quiet --exit-code
227-
[[ -z $(git status -s) ]]
228-
229-
wkcuber_win:
230-
# Caution! The Windows VM seems to be running out of storage rather quickly.
231-
runs-on: windows-latest
232-
needs: [changes]
233-
if: |
234-
${{ needs.changes.outputs.cluster_tools == 'true' }} ||
235-
${{ needs.changes.outputs.webknossos == 'true' }} ||
236-
${{ needs.changes.outputs.wkcuber == 'true' }}
237-
strategy:
238-
max-parallel: 4
239-
matrix:
240-
python-version: ["3.8", "3.9", "3.10"]
241-
defaults:
242-
run:
243-
working-directory: wkcuber
244-
245-
steps:
246-
- uses: actions/checkout@v3
247-
- name: Set up Python ${{ matrix.python-version }}
248-
uses: actions/setup-python@v4
249-
with:
250-
python-version: ${{ matrix.python-version }}
251-
252-
- name: Install dependencies
253-
shell: bash
254-
run: |
255-
pip install -r ../requirements.txt
256-
poetry install
257-
258-
- name: Run tests
259-
continue-on-error: true
260-
shell: bash
261-
run: poetry run "C:\Program Files\Git\bin\bash.EXE" --noprofile --norc ./test.sh
262-
263-
wkcuber_mac:
264-
runs-on: macos-latest
265-
needs: [changes]
266-
if: |
267-
${{ needs.changes.outputs.cluster_tools == 'true' }} ||
268-
${{ needs.changes.outputs.webknossos == 'true' }} ||
269-
${{ needs.changes.outputs.wkcuber == 'true' }}
270-
strategy:
271-
max-parallel: 4
272-
matrix:
273-
python-version: ["3.8", "3.9", "3.10"]
274-
defaults:
275-
run:
276-
working-directory: wkcuber
277-
278-
steps:
279-
- uses: actions/checkout@v3
280-
- name: Set up Python ${{ matrix.python-version }}
281-
uses: actions/setup-python@v4
282-
with:
283-
python-version: ${{ matrix.python-version }}
284-
285-
- name: Install dependencies
286-
run: |
287-
pip install -r ../requirements.txt
288-
poetry install
289180
290-
- name: Run tests
291-
run: ./test.sh
292181
293-
wkcuber_docker:
294-
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac]
182+
webknossos_cli_docker:
183+
needs: [cluster_tools, webknossos_linux]
295184
if: |
296185
always() &&
297186
!contains(needs.*.result, 'failure') &&
@@ -309,29 +198,25 @@ jobs:
309198
- name: Write version file
310199
run: |
311200
pip install -r requirements.txt
312-
pushd wkcuber
201+
pushd webknossos
313202
314203
PKG_VERSION="$(dunamai from git)"
315-
echo "__version__ = '$PKG_VERSION'" > ./wkcuber/version.py
204+
echo "__version__ = '$PKG_VERSION'" > ./webknossos/version.py
316205
poetry version "$PKG_VERSION"
317206
318207
popd
319208
320209
- name: Build docker image
321-
run: docker build -t scalableminds/webknossos-cuber:$GITHUB_SHA -f wkcuber/Dockerfile .
210+
run: docker build -t scalableminds/webknossos-cli:$GITHUB_SHA -f webknossos/Dockerfile .
322211

323212
- name: Smoke test docker
324213
run: |
325214
docker run --rm \
326-
-v$(pwd)/wkcuber/testdata:/app/testdata \
327215
-v$(pwd)/webknossos/testdata:/webknossos/testdata \
328-
scalableminds/webknossos-cuber:$GITHUB_SHA \
329-
wkcuber.cubing \
216+
scalableminds/webknossos-cli:$GITHUB_SHA \
217+
webknossos convert \
330218
--jobs 2 \
331-
--batch_size 8 \
332-
--layer_name color \
333-
--chunks_per_shard 32 \
334-
--voxel_size 1,1,1 \
219+
--voxel-size 1,1,1 \
335220
testdata/tiff testoutput/tiff
336221
337222
- name: Login to docker
@@ -343,33 +228,33 @@ jobs:
343228
344229
- name: Push docker images
345230
run: |
346-
docker push scalableminds/webknossos-cuber:$GITHUB_SHA
231+
docker push scalableminds/webknossos-cli:$GITHUB_SHA
347232
348233
- name: Push docker images (for tag)
349234
if: github.ref_type == 'tag'
350235
run: |
351236
CI_TAG=$(git describe --tags)
352237
docker tag \
353-
scalableminds/webknossos-cuber:$GITHUB_SHA \
354-
scalableminds/webknossos-cuber:$CI_TAG
355-
docker push scalableminds/webknossos-cuber:$CI_TAG
238+
scalableminds/webknossos-cli:$GITHUB_SHA \
239+
scalableminds/webknossos-cli:$CI_TAG
240+
docker push scalableminds/webknossos-cli:$CI_TAG
356241
docker tag \
357-
scalableminds/webknossos-cuber:$GITHUB_SHA \
358-
scalableminds/webknossos-cuber:latest
359-
docker push scalableminds/webknossos-cuber:latest
242+
scalableminds/webknossos-cli:$GITHUB_SHA \
243+
scalableminds/webknossos-cli:latest
244+
docker push scalableminds/webknossos-cli:latest
360245
361246
- name: Push docker images (for branch)
362247
if: github.ref_type == 'branch'
363248
run: |
364249
CI_BRANCH=${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}
365250
NORMALIZED_CI_BRANCH=${CI_BRANCH//[\/-]/_}
366251
docker tag \
367-
scalableminds/webknossos-cuber:$GITHUB_SHA \
368-
scalableminds/webknossos-cuber:$NORMALIZED_CI_BRANCH
369-
docker push scalableminds/webknossos-cuber:$NORMALIZED_CI_BRANCH
252+
scalableminds/webknossos-cli:$GITHUB_SHA \
253+
scalableminds/webknossos-cli:$NORMALIZED_CI_BRANCH
254+
docker push scalableminds/webknossos-cli:$NORMALIZED_CI_BRANCH
370255
371256
docs:
372-
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac]
257+
needs: [cluster_tools, webknossos_linux]
373258
runs-on: ubuntu-latest
374259
if: |
375260
always() &&
@@ -430,7 +315,7 @@ jobs:
430315
431316
432317
pypi_and_gh_release:
433-
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac]
318+
needs: [cluster_tools, webknossos_linux]
434319
if: |
435320
always() &&
436321
!contains(needs.*.result, 'failure') &&
@@ -470,7 +355,7 @@ jobs:
470355
prerelease: false
471356

472357
complete:
473-
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac, wkcuber_docker, docs, pypi_and_gh_release]
358+
needs: [cluster_tools, webknossos_linux, webknossos_cli_docker, docs, pypi_and_gh_release]
474359
if: always()
475360
runs-on: ubuntu-latest
476361
steps:

CONTRIBUTING.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ The [WEBKNOSSOS-libs repository](https://github.com/scalableminds/webknossos-lib
9898

9999
* `cluster_tools`
100100
* `webknossos`
101-
* `wkcuber`
102101
* (`docs`, see below for **Documentation**)
103102

104103
See below for specifics of the different packages. Let's have a look at the common tooling first:
@@ -157,13 +156,6 @@ To re-generate the code, run
157156
./generate_client.sh
158157
```
159158

160-
161-
#### `wkcuber` package
162-
163-
Simply use the default scripts mentioned above, such as
164-
`./format.sh`, `./lint.sh`, `./typecheck.sh`, `./test.sh`.
165-
166-
167159
#### `cluster_tools` package
168160

169161
For testing the `slurm` setup a docker-compose setup is available. Please see the [respective Readme](https://github.com/scalableminds/webknossos-libs/blob/master/cluster_tools/README.md) for details.
@@ -177,7 +169,7 @@ We render a common documentation for WEBKNOSSOS itself and WEBKNOSSOS-libs from
177169

178170
* `docs/src/webknossos`: Server & Website documentation, linked from the [webknossos repository](https://github.com/scalableminds/webknossos) (must be available under `docs/wk-repo`, see below).
179171
* `docs/src/api`: Generated using [pdoc](https://pdoc.dev) from Python docstrings.
180-
* `docs/src/webknossos-py` & `docs/src/wkcuber`: Documentation for the respective Python Packages
172+
* `docs/src/webknossos-py`: Documentation for the Python Package
181173

182174
The structure of the documentation page is given by `docs/mkdocs.yml`.
183175

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
packages_by_priority := webknossos wkcuber cluster_tools docs
2-
packages_by_dependency := cluster_tools webknossos wkcuber docs
3-
code_packages := cluster_tools webknossos wkcuber
1+
packages_by_priority := webknossos cluster_tools docs
2+
packages_by_dependency := cluster_tools webknossos docs
3+
code_packages := cluster_tools webknossos
44

55
define in_each_pkg_by_dependency
66
for PKG in $(packages_by_dependency); do echo $$PKG; cd $$PKG; $1; cd ..; done

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,29 @@
88
<img align="right" src="https://static.webknossos.org/logos/webknossos-icon-only.svg" alt="WEBKNOSSOS Logo" width="100" height="100"/>
99

1010
## [WEBKNOSSOS Python API](webknossos)
11+
12+
### API
13+
1114
Python API for working with [WEBKNOSSOS](https://webknossos.org) datasets, annotations, and for WEBKNOSSOS server interactions.
1215

1316
Use this for:
1417
- reading/writing/manipulating raw 2D/3D image data and volume annotations/segmentation in WEBKNOSSOS wrap (*.wkw) format
1518
- handling/manipulation of WEBKNOSSOS datasets
1619
- reading/writing/manipulating WEBKNOSSOS skeleton annotations (*.nml)
1720
- up- & downloading annotations and datasets from your WEBKNOSSOS instance
18-
- executing any of the wkcuber operations from below from your code
1921

2022
[Read more in the docs.](https://docs.webknossos.org/webknossos-py/)
2123

22-
## [WEBKNOSSOS cuber (wkcuber) CLI](wkcuber)
24+
### CLI
25+
2326
CLI tool for creating and manipulating [WEBKNOSSOS](https://webknossos.org) [WKW](https://github.com/scalableminds/webknossos-wrap) datasets. WKW is a container format for efficiently storing large-scale 3D images as found in microscopy data.
2427

2528
Use this for:
2629
- converting Tiff-stacks and other data formats for volume image data to WEBKNOSSOS-compatible *.wkw files from the CLI
2730
- up/downsampling of *.wkw files to different magnification levels (image pyramid) from the CLI
2831
- compressing your *.wkw files to save disk space from the CLI
2932

30-
[Read more in the docs.](https://docs.webknossos.org/wkcuber)
33+
[Read more in the docs.](https://docs.webknossos.org/webknossos-py/)
3134

3235
## [Cluster Tools](cluster_tools)
3336
The `cluster_tools` package provides python `Executor` classes for distributing tasks on a slurm cluster or via multi processing.

docs/generate.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,19 @@ fi
1717

1818
export PDOC_CLASS_MODULES="$(poetry run python get_keyword_mapping.py)"
1919
if [ $# -eq 1 ] && [ "$1" = "--api" ]; then
20-
poetry run pdoc ../webknossos/webknossos ../wkcuber/wkcuber -t pdoc_templates/pure_pdoc -h 0.0.0.0 -p 8196
20+
poetry run pdoc ../webknossos/webknossos -t pdoc_templates/pure_pdoc -h 0.0.0.0 -p 8196
2121
else
2222
rm -rf src/api
23-
poetry run pdoc ../webknossos/webknossos ../wkcuber/wkcuber -t pdoc_templates/with_mkdocs -o src/api
23+
poetry run pdoc ../webknossos/webknossos -t pdoc_templates/with_mkdocs -o src/api
2424
# rename .html files to .md
2525
find src/api -iname "*.html" -exec sh -c 'mv "$0" "${0%.html}.md"' {} \;
2626
# assert that API docs are written
2727
webknossos_files="$(find src/api/webknossos -type f -name "*.md" | wc -l)"
28-
wkcuber_files="$(find src/api/wkcuber -type f -name "*.md" | wc -l)"
2928
if ! [ "$webknossos_files" -gt "50" ]; then
3029
echo "Error: There are too few ($webknossos_files, expected > 80) files in src/api/webknossos,"
3130
echo "probably there was an error with pdoc before!"
3231
exit 1
3332
fi
34-
if ! [ "$wkcuber_files" -gt "25" ]; then
35-
echo "There are too few ($wkcuber_files, expected > 25) files in src/api/wkcuber,"
36-
echo "probably there was an error with pdoc before!"
37-
exit 1
38-
fi
3933
if [ $# -eq 1 ] && [ "$1" = "--persist" ]; then
4034
PYTHONPATH=$PYTHONPATH:. poetry run mkdocs build
4135
else

docs/mkdocs.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ nav:
120120
- User: api/webknossos/administration/user.md
121121
- Project: api/webknossos/administration/project.md
122122
- Task: api/webknossos/administration/task.md
123+
- CLI Reference:
124+
- Overview: cli/index.md
123125
- Version Changelog:
124126
- webknossos-py/stability_policy.md
125127
- webknossos-py/changelog.md
@@ -133,14 +135,6 @@ nav:
133135
- Commercial Support: https://scalableminds.com" target="_blank
134136
- GitHub: https://github.com/scalableminds/webknossos-libs/tree/master/webknossos" target="_blank
135137
- Blog: https://medium.com/scalableminds" target="_blank
136-
- WEBKNOSSOS Cuber:
137-
- wkcuber CLI: wkcuber/index.md
138-
- wkcuber/changelog.md
139-
- Getting Help:
140-
- Community Support: https://forum.image.sc/tag/webknossos" target="_blank
141-
- Email Support: mailto:[email protected]
142-
- Commercial Support: https://scalableminds.com" target="_blank
143-
- GitHub: https://github.com/scalableminds/webknossos-libs/tree/master/wkcuber" target="_blank
144138

145139
plugins:
146140
- search

0 commit comments

Comments
 (0)