Skip to content

Commit 2e6418e

Browse files
authored
Merge pull request #214 from bgilbert/python3.7
Drop support for Python 3.7
2 parents 35e711d + 8016b9d commit 2e6418e

File tree

9 files changed

+17
-57
lines changed

9 files changed

+17
-57
lines changed

.github/workflows/python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
matrix:
3232
os: [ubuntu-latest, macos-latest]
33-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
33+
python-version: [3.8, 3.9, "3.10", "3.11"]
3434
steps:
3535
- name: Check out repo
3636
uses: actions/checkout@v3
@@ -69,7 +69,7 @@ jobs:
6969
shell: bash
7070
strategy:
7171
matrix:
72-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
72+
python-version: [3.8, 3.9, "3.10", "3.11"]
7373
python-arch: [x86, x64]
7474
steps:
7575
- name: Check out repo

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ OpenSlide can read virtual slides in several formats:
3737

3838
## Requirements
3939

40-
* Python ≥ 3.7
40+
* Python ≥ 3.8
4141
* OpenSlide ≥ 3.4.0
4242
* Pillow
4343

doc/index.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,12 @@ to a known path. Then, import ``openslide`` inside a
6363

6464
import os
6565
if hasattr(os, 'add_dll_directory'):
66-
# Python >= 3.8 on Windows
66+
# Windows
6767
with os.add_dll_directory(OPENSLIDE_PATH):
6868
import openslide
6969
else:
7070
import openslide
7171

72-
This won't work with Python 3.7 or earlier; you'll need to add the OpenSlide
73-
``bin`` directory to your ``PATH`` instead.
74-
7572
.. _install: https://openslide.org/download/#distribution-packages
7673
.. _Anaconda: https://anaconda.org/
7774
.. _MacPorts: https://www.macports.org/

examples/deepzoom/deepzoom_multiserver.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,10 @@
3030
if os.name == 'nt':
3131
_dll_path = os.getenv('OPENSLIDE_PATH')
3232
if _dll_path is not None:
33-
if hasattr(os, 'add_dll_directory'):
34-
# Python >= 3.8
35-
with os.add_dll_directory(_dll_path):
36-
import openslide
37-
else:
38-
# Python < 3.8
39-
_orig_path = os.environ.get('PATH', '')
40-
os.environ['PATH'] = _orig_path + ';' + _dll_path
33+
with os.add_dll_directory(_dll_path):
4134
import openslide
42-
43-
os.environ['PATH'] = _orig_path
35+
else:
36+
import openslide
4437
else:
4538
import openslide
4639

examples/deepzoom/deepzoom_server.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,10 @@
2929
if os.name == 'nt':
3030
_dll_path = os.getenv('OPENSLIDE_PATH')
3131
if _dll_path is not None:
32-
if hasattr(os, 'add_dll_directory'):
33-
# Python >= 3.8
34-
with os.add_dll_directory(_dll_path):
35-
import openslide
36-
else:
37-
# Python < 3.8
38-
_orig_path = os.environ.get('PATH', '')
39-
os.environ['PATH'] = _orig_path + ';' + _dll_path
32+
with os.add_dll_directory(_dll_path):
4033
import openslide
41-
42-
os.environ['PATH'] = _orig_path
34+
else:
35+
import openslide
4336
else:
4437
import openslide
4538

examples/deepzoom/deepzoom_tile.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,10 @@
3333
if os.name == 'nt':
3434
_dll_path = os.getenv('OPENSLIDE_PATH')
3535
if _dll_path is not None:
36-
if hasattr(os, 'add_dll_directory'):
37-
# Python >= 3.8
38-
with os.add_dll_directory(_dll_path):
39-
import openslide
40-
else:
41-
# Python < 3.8
42-
_orig_path = os.environ.get('PATH', '')
43-
os.environ['PATH'] = _orig_path + ';' + _dll_path
36+
with os.add_dll_directory(_dll_path):
4437
import openslide
45-
46-
os.environ['PATH'] = _orig_path
38+
else:
39+
import openslide
4740
else:
4841
import openslide
4942

openslide/lowlevel.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,9 @@ def try_load(names):
6363
try:
6464
return try_load(['libopenslide-1.dll', 'libopenslide-0.dll'])
6565
except FileNotFoundError:
66-
import os
67-
68-
if hasattr(os, 'add_dll_directory'):
69-
# Python >= 3.8
70-
admonition = 'Did you call os.add_dll_directory()?'
71-
else:
72-
admonition = 'Did you add OpenSlide to PATH?'
7366
raise ModuleNotFoundError(
74-
f"Couldn't locate OpenSlide DLL. {admonition} "
67+
"Couldn't locate OpenSlide DLL. "
68+
"Did you call os.add_dll_directory()? "
7569
"https://openslide.org/api/python/#installing"
7670
)
7771
elif platform.system() == 'Darwin':

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@
3939
'Operating System :: POSIX :: Linux',
4040
'Programming Language :: Python',
4141
'Programming Language :: Python :: 3',
42-
'Programming Language :: Python :: 3.7',
4342
'Programming Language :: Python :: 3.8',
4443
'Programming Language :: Python :: 3.9',
4544
'Programming Language :: Python :: 3.10',
4645
'Programming Language :: Python :: 3.11',
4746
'Topic :: Scientific/Engineering :: Bio-Informatics',
4847
],
49-
python_requires='>=3.7',
48+
python_requires='>=3.8',
5049
install_requires=[
5150
'Pillow',
5251
],

tests/common.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,9 @@
2828
# environment.
2929
_dll_path = os.getenv('OPENSLIDE_PATH')
3030
if _dll_path is not None:
31-
if hasattr(os, 'add_dll_directory'):
32-
# Python >= 3.8
33-
with os.add_dll_directory(_dll_path):
34-
import openslide
35-
else:
36-
# Python < 3.8
37-
_orig_path = os.environ.get('PATH', '')
38-
os.environ['PATH'] = _orig_path + ';' + _dll_path
31+
with os.add_dll_directory(_dll_path):
3932
import openslide # noqa: F401 module-imported-but-unused
4033

41-
os.environ['PATH'] = _orig_path
42-
4334

4435
def file_path(name):
4536
return Path(__file__).parent / 'fixtures' / name

0 commit comments

Comments
 (0)