Skip to content

Commit

Permalink
drop support for python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jkittner committed Oct 23, 2024
1 parent 31e2b5e commit ec0a925
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.12"]
python-version: ["3.9", "3.12"]

defaults:
run:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:

matrix:
os: [macos-latest, windows-latest]
python-version: ["3.8", "3.12"]
python-version: ["3.9", "3.12"]

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion docs/get-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ to create a new environment containing all dependencies and Terracotta:
$ conda env create -f environment.yml
If you already have Python 3.8 (or above) installed, you can just run
If you already have Python 3.9 (or above) installed, you can just run

.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Try out a live demo `here <https://terracotta-demo-frontend.orangebeach-11aa4896
Installation
------------

If you are using Linux and already have Python 3.8+ installed, all you need to
If you are using Linux and already have Python 3.9+ installed, all you need to
do to check out Terracotta is

.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python>=3.8
- python>=3.9
- numpy
- rasterio>=1.3.0
- shapely
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"Development Status :: 4 - Beta",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -54,7 +53,7 @@
],
# module
packages=find_packages(exclude=["docs", "tests"]),
python_requires=">=3.8",
python_requires=">=3.9",
use_scm_version={"write_to": "terracotta/_version.py"},
# dependencies
setup_requires=[
Expand All @@ -70,7 +69,6 @@
"click-spinner",
"flask",
"flask_cors",
"importlib_resources; python_version<'3.9'",
"marshmallow>=3.0.0",
"mercantile",
"numpy%s" % numpy_version,
Expand Down
9 changes: 2 additions & 7 deletions terracotta/cmaps/get_cmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
Define an interface to retrieve stored color maps.
"""

import importlib.resources
from typing import Dict
import os
import numpy as np
import sys

if sys.version_info >= (3, 9):
import importlib.resources as importlib_resources
else:
import importlib_resources


SUFFIX = "_rgba.npy"
EXTRA_CMAP_FOLDER = os.environ.get("TC_EXTRA_CMAP_FOLDER", "")

try:
PACKAGE_DIR = str(importlib_resources.files("terracotta") / "cmaps/data")
PACKAGE_DIR = str(importlib.resources.files("terracotta") / "cmaps/data")
except ModuleNotFoundError:
# terracotta was not installed, fall back to file system
PACKAGE_DIR = os.path.join(os.path.dirname(__file__), "data")
Expand Down
18 changes: 8 additions & 10 deletions tests/cmaps/test_get_cmap.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import pytest

import numpy as np
import sys

if sys.version_info >= (3, 9):
import importlib.resources as importlib_resources
else:
import importlib_resources


@pytest.fixture(autouse=True)
Expand All @@ -31,17 +25,21 @@ def test_get_cmap():

def test_get_cmap_filesystem(monkeypatch):
import importlib
import importlib.resources

import terracotta.cmaps.get_cmaps

def throw_error(*args, **kwargs):
raise ModuleNotFoundError
raise ModuleNotFoundError("monkeypatched")

with monkeypatch.context() as m:
m.setattr(importlib_resources, "files", throw_error)
m.setattr(importlib.resources, "files", throw_error)

with pytest.raises(ModuleNotFoundError) as exc_info:
importlib.resources.files("terracotta")

with pytest.raises(ModuleNotFoundError):
importlib_resources.files("terracotta")
(msg,) = exc_info.value.args
assert msg == "monkeypatched"

importlib.reload(terracotta.cmaps.get_cmaps)

Expand Down

0 comments on commit ec0a925

Please sign in to comment.