From 08e079111d81c89a2655f198e479e7f1d3ffb23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 15:04:46 +0100 Subject: [PATCH 1/8] test on python 3.10 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c14bcd9a..048feae8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] # only test oldest and most recent supported Python versions - python-version: ["3.6", "3.9"] + python-version: ["3.6", "3.10"] defaults: run: @@ -103,7 +103,7 @@ jobs: matrix: os: [windows-latest] # Python 3.6 is EOL on conda-forge, so use 3.7 instead - python-version: ["3.7", "3.9"] + python-version: ["3.7", "3.10"] defaults: run: From 9e06c5e18b72deb06647924da62d3e5295abc9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 20:47:56 +0100 Subject: [PATCH 2/8] wip on 3.10 support --- .github/workflows/test.yml | 18 +++++++++--------- terracotta/handlers/singleband.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 048feae8..c0ca9fe6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] # only test oldest and most recent supported Python versions python-version: ["3.6", "3.10"] @@ -54,13 +54,17 @@ jobs: restore-keys: | ${{ matrix.os }}-pip- + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install libgdal-dev -y + - name: Setup Python environment run: | python -m pip install --upgrade pip setuptools wheel pip install cython numpy - name: Setup MySQL - if: contains(matrix.os, 'ubuntu') run: | sudo /etc/init.d/mysql start mysql -e 'SHOW DATABASES;' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} @@ -77,12 +81,8 @@ jobs: - name: Run tests run: | - if [ ${{ runner.os }} == "Linux" ]; then - MYSQL_SRV="${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@127.0.0.1:${{ env.DB_PORT }}" - python -m pytest . --color=yes --cov=terracotta --mysql-server=$MYSQL_SRV - else - python -m pytest . --color=yes --cov=terracotta - fi + MYSQL_SRV="${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@127.0.0.1:${{ env.DB_PORT }}" + python -m pytest . --color=yes --cov=terracotta --mysql-server=$MYSQL_SRV - name: Run benchmarks run: | @@ -101,7 +101,7 @@ jobs: fail-fast: false matrix: - os: [windows-latest] + os: [macos-latest, windows-latest] # Python 3.6 is EOL on conda-forge, so use 3.7 instead python-version: ["3.7", "3.10"] diff --git a/terracotta/handlers/singleband.py b/terracotta/handlers/singleband.py index 7a137624..39f5090a 100644 --- a/terracotta/handlers/singleband.py +++ b/terracotta/handlers/singleband.py @@ -30,7 +30,7 @@ def singleband(keys: Union[Sequence[str], Mapping[str, str]], else: stretch_min, stretch_max = stretch_range - preserve_values = isinstance(colormap, collections.Mapping) + preserve_values = isinstance(colormap, collections.abc.Mapping) settings = get_settings() if tile_size is None: From 54e0a8dba69e36939e0e8f7a9d42df02820a334e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 22:28:15 +0100 Subject: [PATCH 3/8] wip on 3.10 support --- .github/workflows/test.yml | 1 + setup.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0ca9fe6..60574290 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,6 +63,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools wheel pip install cython numpy + pip install rasterio --no-build-isolation - name: Setup MySQL run: | diff --git a/setup.py b/setup.py index 5d10949a..24442fa4 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,6 @@ 'pytest', 'pytest-cov', 'pytest-mypy', - 'pytest-flake8', 'pytest-benchmark', 'attrs>=17.4.0', 'codecov', From 20581ea6f0aab858ebb6b2687c9295e533bc2bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 22:29:39 +0100 Subject: [PATCH 4/8] add pre-commit action instead of pytest-flake8 --- .github/workflows/pre-commit.yml | 17 +++++++++++++++++ .pre-commit-config.yml | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..7c3941a1 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit + +on: + pull_request: + + push: + branches: + - main + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 \ No newline at end of file diff --git a/.pre-commit-config.yml b/.pre-commit-config.yml new file mode 100644 index 00000000..f8ba9799 --- /dev/null +++ b/.pre-commit-config.yml @@ -0,0 +1,12 @@ +repos: +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + args: ['--config=setup.cfg'] + +exclude: " + ^$\ + |terracotta/_version.py\ + |docs\ + " \ No newline at end of file From a7547c58eec5235614ac16a3439149363e20289a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 22:39:54 +0100 Subject: [PATCH 5/8] more wip --- .github/workflows/test.yml | 3 ++- .pre-commit-config.yml => .pre-commit-config.yaml | 0 setup.cfg | 1 - setup.py | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) rename .pre-commit-config.yml => .pre-commit-config.yaml (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60574290..227d9aec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,7 +54,9 @@ jobs: restore-keys: | ${{ matrix.os }}-pip- + # no rasterio wheels for 3.10, so we need to build from source - name: Install system dependencies + if: contains(matrix.python-version, '3.10') run: | sudo apt-get update sudo apt-get install libgdal-dev -y @@ -63,7 +65,6 @@ jobs: run: | python -m pip install --upgrade pip setuptools wheel pip install cython numpy - pip install rasterio --no-build-isolation - name: Setup MySQL run: | diff --git a/.pre-commit-config.yml b/.pre-commit-config.yaml similarity index 100% rename from .pre-commit-config.yml rename to .pre-commit-config.yaml diff --git a/setup.cfg b/setup.cfg index 834052be..bf391ae8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,6 @@ max-line-length = 100 [tool:pytest] addopts = --mypy - --flake8 --benchmark-group-by=func --benchmark-columns=min,max,median -v diff --git a/setup.py b/setup.py index 24442fa4..9959aa84 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,6 @@ 'codecov', 'colorlog', 'crick', - 'flake8', 'matplotlib', 'moto', 'aws-xray-sdk', From c7c4b16e8ff4ac50abf417e2cb189b6f2d3e0c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Fri, 11 Feb 2022 22:43:49 +0100 Subject: [PATCH 6/8] more wip --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index bf391ae8..957671ea 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,8 +25,6 @@ filterwarnings = ignore:numpy.ufunc size changed:RuntimeWarning # sometimes, dependencies leak resources ignore:.*socket\.socket.*:pytest.PytestUnraisableExceptionWarning -flake8-ignore = - terracotta/_version.py ALL [mypy] show_error_codes = True From f81d8db128f5250ee9d6c63bbed528f6f1577ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Sat, 12 Feb 2022 20:24:25 +0100 Subject: [PATCH 7/8] don't test with 3.10 just yet --- .github/workflows/test.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 227d9aec..55917f1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest] # only test oldest and most recent supported Python versions - python-version: ["3.6", "3.10"] + python-version: ["3.6", "3.9"] defaults: run: @@ -54,13 +54,6 @@ jobs: restore-keys: | ${{ matrix.os }}-pip- - # no rasterio wheels for 3.10, so we need to build from source - - name: Install system dependencies - if: contains(matrix.python-version, '3.10') - run: | - sudo apt-get update - sudo apt-get install libgdal-dev -y - - name: Setup Python environment run: | python -m pip install --upgrade pip setuptools wheel From 967a1edef8894533d89e0e56a936c4f825cda65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Mon, 21 Feb 2022 10:36:18 +0100 Subject: [PATCH 8/8] add comment --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 55917f1a..47d88a33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: matrix: os: [ubuntu-latest] # only test oldest and most recent supported Python versions + # no rasterio wheels on 3.10 yet, so we use 3.9 for now python-version: ["3.6", "3.9"] defaults: