diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c815592..2f4f28e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,10 @@ on: jobs: test: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Check out repository uses: actions/checkout@v4 @@ -19,12 +22,11 @@ jobs: - name: Set up python id: setup-python uses: actions/setup-python@v5 + with: + python-version: "3.10" - - name: Install Openslide - run: sudo apt install openslide-tools - - name: Install - run: pip install .[test,openslide] + run: pip install .[test] - name: Run tests run: pytest diff --git a/README.md b/README.md index dca8b8b..6b7191e 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,7 @@ git clone https://github.com/qupath/qubalab.git # clone this repository cd qubalab # go to the project directory python -m venv ./.venv # create a local virual environment source ./.venv/bin/activate # activate the venv -pip install -e ".[dev,test,openslide]" # install qubalab (-e means changes are loaded dynamically) +pip install -e ".[dev,test]" # install qubalab (-e means changes are loaded dynamically) jupyter lab . # to start the Jupyter notebooks pytest # to run unit tests ``` - -## OpenSlide support - -OpenSlide support relies on having OpenSlide binaries installed at a system level. Therefore, not all aspects of OpenSlide will work consistently across platforms, as the versions available from package managers or from OpenSlide directly may vary between operating systems. We hope that this will be resolved shortly with the release of OpenSlide 4.0.0 binaries in the [openslide-bin](https://pypi.org/project/openslide-bin/) package, and the release of [openslide-python](https://pypi.org/project/openslide-python/) 1.4.0 which will use them. diff --git a/qubalab/images/qupath_server.py b/qubalab/images/qupath_server.py index af91112..83a440a 100644 --- a/qubalab/images/qupath_server.py +++ b/qubalab/images/qupath_server.py @@ -95,8 +95,10 @@ def _read_block(self, level: int, region: Region2D) -> np.ndarray: self._gateway.entry_point.writeImageRegion(self._qupath_server, request, temp_path) image = bytes_to_image(temp_path, self.metadata.is_rgb, ImageShape(region.width, region.height, c=self.metadata.n_channels)) - - os.remove(temp_path) + ## on Windows, this fails because the file handle is open elsewhere + ## slightly bad manners to pollute tempfiles but should be insignificant + if not os.name == "nt": + os.remove(temp_path) else: format = 'png' if self.metadata.is_rgb else "imagej tiff" diff --git a/setup.cfg b/setup.cfg index 60b267b..8716762 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ install_requires = shapely ~= 2.0.4 rasterio ~= 1.3.10 matplotlib ~= 3.9.0 + openslide-python ~= 1.4.0 + openslide-bin ~=4.0.0 [options.extras_require] @@ -33,7 +35,6 @@ dev = test = pytest ~= 8.2.2 openslide = - openslide-python ~= 1.2.0 doc = sphinx ~= 7.4.5 sphinx-rtd-theme ~= 2.0.0