Skip to content

Commit e4434f9

Browse files
authored
Merge pull request #532 from bioimage-io/silence_tqdm
Silence tqdm without removing tqdm as a package
2 parents 0aa4f86 + 67438af commit e4434f9

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.github/workflows/validate_resources.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ jobs:
104104
conda-forge::bioimageio.spec
105105
continue-on-error: true # we inspect this step's outcome in dynamic_validation.py
106106
timeout-minutes: 60
107-
- name: remove tqdm to avoid spamming logs
108-
shell: bash -l {0}
109-
run: conda remove --yes --force tqdm
110-
continue-on-error: true
111107
- name: get artifact name wo forward slashes
112108
id: artifact_name
113109
run: echo ::set-output name=name::dynamic_validation_artifact_$(echo ${{ matrix.resource_id }}_${{ matrix.version_id }}_${{ matrix.weight_format }} | sed 's#/##g')

scripts/download_documentation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import warnings
2+
from functools import partial
23
from pathlib import Path
34

45
import typer
6+
from tqdm import tqdm
57

68
from bioimageio.spec.shared import resolve_source
79
from utils import yaml
@@ -31,7 +33,7 @@ def main(
3133
else:
3234
type_ext = "md"
3335

34-
resolve_source(doc_uri, output=rdf_path.with_name(f"documentation.{type_ext}"))
36+
resolve_source(doc_uri, output=rdf_path.with_name(f"documentation.{type_ext}"), pbar=partial(tqdm, disable=True))
3537

3638

3739
if __name__ == "__main__":

scripts/dynamic_validation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import traceback
2+
from functools import partialmethod
23
from pathlib import Path
34
from typing import List, Optional
45

56
import typer
67
from marshmallow import missing
8+
from tqdm import tqdm
79

810
from bioimageio.spec import load_raw_resource_description
911
from bioimageio.spec.shared import yaml
1012

13+
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True) # silence tqdm
14+
1115

1216
def test_summary_from_exception(name, exception):
1317
return dict(

scripts/static_validation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import shutil
22
import warnings
3+
from functools import partialmethod
34
from pathlib import Path
45
from typing import Dict, List, Optional, Union
56

@@ -8,6 +9,7 @@
89
from marshmallow import missing
910
from marshmallow.utils import _Missing
1011
from packaging.version import Version
12+
from tqdm import tqdm
1113

1214
from bare_utils import set_gh_actions_outputs
1315
from bioimageio.spec import load_raw_resource_description, validate
@@ -17,6 +19,8 @@
1719
from bioimageio.spec.shared.raw_nodes import Dependencies, URI
1820
from utils import ADJECTIVES, ANIMALS, iterate_over_gh_matrix, split_animal_nickname
1921

22+
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True) # silence tqdm
23+
2024

2125
def get_base_env() -> Dict[str, Union[str, List[Union[str, Dict[str, List[str]]]]]]:
2226
return {"channels": ["defaults"], "dependencies": ["conda-forge::bioimageio.core"]}

scripts/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111
import numpy
1212
import requests
1313
from marshmallow import missing
14-
from requests import HTTPError
1514
from ruamel.yaml import YAML, comments
1615

1716
from bare_utils import DEPLOYED_BASE_URL, GH_API_URL
1817
from bioimageio.spec import (
1918
load_raw_resource_description,
2019
serialize_raw_resource_description_to_dict,
2120
)
21+
from bioimageio.spec.collection.v0_2.raw_nodes import Collection
2222
from bioimageio.spec.collection.v0_2.utils import resolve_collection_entries
23-
from bioimageio.spec.io_ import serialize_raw_resource_description
2423
from bioimageio.spec.partner.utils import enrich_partial_rdf_with_imjoy_plugin
2524

2625

@@ -110,9 +109,6 @@ def iterate_over_gh_matrix(matrix: Union[str, Dict[str, list]]):
110109
def resolve_partners(
111110
rdf: dict, *, current_format: str, previous_partner_hashes: Dict[str, str]
112111
) -> Tuple[List[dict], List[dict], Dict[str, str], set]:
113-
from bioimageio.spec import load_raw_resource_description
114-
from bioimageio.spec.collection.v0_2.raw_nodes import Collection
115-
116112
partners = []
117113
updated_partner_resources = []
118114
new_partner_hashes = {}
@@ -151,7 +147,7 @@ def resolve_partners(
151147
)
152148
try:
153149
r.raise_for_status()
154-
except HTTPError as e:
150+
except requests.HTTPError as e:
155151
print(e)
156152
continue
157153

0 commit comments

Comments
 (0)