Skip to content

Commit

Permalink
Update dependencies and actions (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson authored Feb 20, 2024
1 parent 67b98a9 commit 93a2e62
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 428 deletions.
37 changes: 12 additions & 25 deletions .github/workflows/run_pytests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load test images from cache
id: cache-test-images
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: test-images-cache-${{ hashFiles('tests/download_test_images.py') }}
path: OPENTILE_TESTDATA
path: tests/testdata/slides
enableCrossOsArchive: true
- name: Load test images
if: steps.cache-test-images.outputs.cache-hit != 'true'
env:
OPENTILE_TESTDIR: OPENTILE_TESTDATA
- name: Download test images
if: ${{ steps.cache-test-images.outputs.cache-hit != 'true' }}
run: |
python -m pip install -U pip
python -m pip install requests
Expand All @@ -38,36 +36,27 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Prevent cache-miss on windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Use GNU tar instead BSD tar
if: matrix.os == 'windows-latest'
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: Load test images from cache
id: cache-test-images
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: test-images-cache-${{ hashFiles('tests/download_test_images.py') }}
path: OPENTILE_TESTDATA
path: tests/testdata/slides
enableCrossOsArchive: true
- name: Check test images are loaded
if: steps.cache-test-images.outputs.cache-hit != 'true'
uses: actions/github-script@v6
with:
script: |
core.setFailed('test images were not cached')
fail-on-cache-miss: true
- name: Set up Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y libturbojpeg
Expand All @@ -82,7 +71,7 @@ jobs:
7z e libjpeg-turbo-2.1.4-vc64.exe -oC:\turbojpeg bin/turbojpeg.dll
- name: Set up paths in windows
if: matrix.os == 'windows-latest'
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
core.addPath('C:\\turbojpeg')
Expand All @@ -102,6 +91,4 @@ jobs:
python -m poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics
- name: Test with pytest.
env:
OPENTILE_TESTDIR: OPENTILE_TESTDATA
run: python -m poetry run pytest
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] -

## [0.11.2] - 2024-02-20

### Fixed

- Updated `ome-types` to 0.5.0.

## [0.11.1] - 2023-12-06

### Fixed
Expand Down Expand Up @@ -181,7 +187,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release of opentile.

[Unreleased]: https://github.com/imi-bigpicture/opentile/compare/v0.11.1..HEAD
[Unreleased]: https://github.com/imi-bigpicture/opentile/compare/v0.11.2..HEAD
[0.11.2]: https://github.com/imi-bigpicture/opentile/compare/v0.11.1..v0.11.2
[0.11.1]: https://github.com/imi-bigpicture/opentile/compare/v0.11.0..v0.11.1
[0.11.0]: https://github.com/imi-bigpicture/opentile/compare/v0.10.4..v0.11.0
[0.10.4]: https://github.com/imi-bigpicture/opentile/compare/v0.10.3..v0.10.4
Expand Down
2 changes: 1 addition & 1 deletion opentile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
from opentile.opentile import OpenTile
from opentile.metadata import Metadata

__version__ = "0.11.1"
__version__ = "0.11.2"
718 changes: 345 additions & 373 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "opentile"
version = "0.11.1"
version = "0.11.2"
description = "Read tiles from wsi-TIFF files"
authors = ["Erik O Gabrielsson <erik.o.gabrielsson@sectra.com>"]
license = "Apache-2.0"
Expand All @@ -22,15 +22,14 @@ PyTurboJPEG = "^1.7.3"
Pillow = "^10.1.0"
imagecodecs = ">=2022.12.24"
defusedxml = "^0.7.1"
ome-types = "^0.4.0"
ome-types = "^0.5.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.0"
pytest-watch = "^4.2.0"
pycodestyle = "^2.8.0"
requests = "^2.28.1"
flake8 = "^4.0.1"
black = "^22.12.0"
black = "^24.2.0"
flake8 = "^7.0.0"
codespell = "^2.2.5"

[build-system]
Expand Down
23 changes: 12 additions & 11 deletions tests/download_test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
from hashlib import md5

FILES: Dict[str, Dict[str, Any]] = {
"slides/svs/CMU-1/CMU-1.svs": {
"svs/CMU-1/CMU-1.svs": {
"url": "https://data.cytomine.coop/open/openslide/aperio-svs/CMU-1.svs", # NOQA
"md5": {"CMU-1.svs": "751b0b86a3c5ff4dfc8567cf24daaa85"},
},
"slides/ndpi/CMU-1/CMU-1.ndpi": {
"ndpi/CMU-1/CMU-1.ndpi": {
"url": "https://data.cytomine.coop/open/openslide/hamamatsu-ndpi/CMU-1.ndpi", # NOQA
"md5": {"CMU-1.ndpi": "fb89dea54f85fb112e418a3cf4c7888a"},
},
}

DEFAULT_DIR = "testdata"
DEFAULT_SLIDE_FOLDER = "tests/testdata/slides"
DOWNLOAD_CHUNK_SIZE = 8192


Expand All @@ -43,19 +43,20 @@ def download_file(url: str, filename: Path):

def main():
print("Downloading and/or checking testdata from cytomine.")
test_data_path = os.environ.get("OPENTILE_TESTDIR")
if test_data_path is None:
test_data_dir = Path(DEFAULT_DIR)

test_data_folder = os.environ.get("OPENTILE_TESTDIR")
if test_data_folder is None:
slide_folder = Path(DEFAULT_SLIDE_FOLDER)
print(
'Env "OPENTILE_TESTDIR"" not set, downloading to default folder '
f"{test_data_dir}."
f"{slide_folder}."
)
else:
test_data_dir = Path(test_data_path)
print(f"Downloading to {test_data_dir}")
os.makedirs(test_data_dir, exist_ok=True)
slide_folder = Path(test_data_folder).joinpath("slides")
print(f"Downloading to {slide_folder}")
os.makedirs(slide_folder, exist_ok=True)
for file, file_settings in FILES.items():
file_path = test_data_dir.joinpath(file)
file_path = slide_folder.joinpath(file)
if file_path.exists():
print(f"{file} found, skipping download")
else:
Expand Down
17 changes: 7 additions & 10 deletions tests/filepaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
from pathlib import Path

test_data_dir = os.environ.get("OPENTILE_TESTDIR", "tests/testdata")
svs_file_path = Path(test_data_dir).joinpath("slides/svs/CMU-1/CMU-1.svs")
philips_file_path = Path(test_data_dir).joinpath(
"slides/philips_tiff/philips1/input.tif"
)
ndpi_file_path = Path(test_data_dir).joinpath("slides/ndpi/CMU-1/CMU-1.ndpi")
histech_file_path = Path(test_data_dir).joinpath(
"slides/3dhistech_tiff/CMU-1/CMU-1_Default_Extended.tif"
)
ome_tiff_file_path = Path(test_data_dir).joinpath(
"slides/ome_tiff/CMU-1/CMU-1.ome.tiff"
slide_folder = Path(test_data_dir).joinpath("slides")
svs_file_path = slide_folder.joinpath("svs/CMU-1/CMU-1.svs")
philips_file_path = slide_folder.joinpath("philips_tiff/philips1/input.tif")
ndpi_file_path = slide_folder.joinpath("ndpi/CMU-1/CMU-1.ndpi")
histech_file_path = slide_folder.joinpath(
"3dhistech_tiff/CMU-1/CMU-1_Default_Extended.tif"
)
ome_tiff_file_path = slide_folder.joinpath("ome_tiff/CMU-1/CMU-1.ome.tiff")
5 changes: 3 additions & 2 deletions tests/test_jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
from tifffile import TiffFile, TiffPage

test_data_dir = os.environ.get("OPENTILE_TESTDIR", "tests/testdata")
ndpi_file_path = Path(test_data_dir).joinpath("slides/ndpi/CMU-1/CMU-1.ndpi")
svs_file_path = Path(test_data_dir).joinpath("slides/svs/CMU-1/CMU-1.svs")
slide_folder = Path(test_data_dir).joinpath("slides")
ndpi_file_path = slide_folder.joinpath("ndpi/CMU-1/CMU-1.ndpi")
svs_file_path = slide_folder.joinpath("svs/CMU-1/CMU-1.svs")


@pytest.fixture()
Expand Down

0 comments on commit 93a2e62

Please sign in to comment.