Skip to content

Conversation

@shaneahmed
Copy link
Member

@shaneahmed shaneahmed commented Mar 3, 2022

  • Restructure cli to use lazy imports
  • Minimize duplication for consistency in input arguments using common decorators.

- Update setup.py documentation.
- Update cli using subclass.
- Common functions for cli.
- Add output path in common.
- Enable all inputs for tests
- Pass all the decorators from a common module
- Move cli functions from utils.misc to cli.common
@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #307 (eb3c50d) into develop (ca0ece6) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #307      +/-   ##
===========================================
+ Coverage    99.82%   99.84%   +0.02%     
===========================================
  Files           54       55       +1     
  Lines         5146     5169      +23     
  Branches       893      877      -16     
===========================================
+ Hits          5137     5161      +24     
  Misses           2        2              
+ Partials         7        6       -1     
Impacted Files Coverage Δ
tiatoolbox/cli/__init__.py 100.00% <100.00%> (ø)
tiatoolbox/cli/common.py 100.00% <100.00%> (ø)
tiatoolbox/cli/nucleus_instance_segment.py 100.00% <100.00%> (ø)
tiatoolbox/cli/patch_predictor.py 100.00% <100.00%> (ø)
tiatoolbox/cli/read_bounds.py 100.00% <100.00%> (ø)
tiatoolbox/cli/save_tiles.py 100.00% <100.00%> (ø)
tiatoolbox/cli/semantic_segment.py 100.00% <100.00%> (ø)
tiatoolbox/cli/slide_info.py 100.00% <100.00%> (ø)
tiatoolbox/cli/slide_thumbnail.py 100.00% <100.00%> (ø)
tiatoolbox/cli/stain_norm.py 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca0ece6...eb3c50d. Read the comment docs.

- Fix help if no input provided.
- Remove redundant code.
- Use common click options for consistency.
- Fix help if no input provided.
@John-P John-P changed the title DEV: Improve cli DEV: Improve CLI Mar 4, 2022
@John-P John-P added the enhancement New feature or request label Mar 4, 2022
- Update for default values.
- Update for default values.
Copy link
Contributor

@John-P John-P left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me. I am not super familiar with click, so I can't give feedback specific if this is the 'right' way to do it. But if it works, then I am happy. Certainly looks a bit tidier.

- Update click options for default value..
- Remove default values from function docstring.
- Update slide-thumbnail according to new options.
- Remove redundant code.
- Skip test to show on travis.
- Improve documentation of common.py.
- Fix mode and verbose conflicts.
- Move img_input check to common.py
- Update read_bounds.py cli
- Fix tests for tissue_mask.py cli
- Move overlapping function to common.py
- Improve input choice for tissue_mask.py.
- Add input type to mode.
- Update stain_norm.py for method.
- Fix tests for stain_norm.
- Rearrange inputs to stain_norm.py
- Fix deepsource bugs
- unused imports
- unnecessary else
- Fix coverage issues as some parts in the code cannot be reached.
- Update patch_predictor.py with common.py.
- Use prepare_file_dir_cli in stain_norm.py.
- Use prepare_file_dir_cli in save_tiles.py.
@shaneahmed shaneahmed self-assigned this Mar 5, 2022
- Fix patch predictor test
- Fix patch_predictor test.
- Remove mode from prepare_model_cli.
- Update semantic_segment.py for cli.
- Update nucleus_instance_segment.py for cli.
- Remove unexpected keyword
- Reduce duplicate code.
- Define function for ioconfig.
- Lazy import in common.
- Lazy imports for efficiency.
- Import iosegment config from relevant module.
@shaneahmed shaneahmed requested a review from John-P March 6, 2022 15:02
@shaneahmed shaneahmed marked this pull request as ready for review March 6, 2022 15:02
Comment on lines +1645 to +1648
@pytest.mark.skipif(
utils.env_detection.running_on_travis(),
reason="No need to display image on travis.",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why this is added? Is it slow on travis?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just avoiding the clunky output on travis.

@shaneahmed shaneahmed merged commit 4d2d3bf into develop Mar 11, 2022
@shaneahmed shaneahmed deleted the dev-improve-cli branch March 11, 2022 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants