From 16d6077b11c69f46a57c117ad483a6e16f005523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dion=20H=C3=A4fner?= Date: Mon, 21 Feb 2022 11:05:53 +0100 Subject: [PATCH] Test with conda on python 3.10 (#252) --- .github/workflows/pre-commit.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 16 ++++++---------- .pre-commit-config.yaml | 12 ++++++++++++ setup.cfg | 3 --- setup.py | 2 -- terracotta/handlers/singleband.py | 2 +- 6 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml 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/.github/workflows/test.yml b/.github/workflows/test.yml index c14bcd9a..47d88a33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,8 +22,9 @@ jobs: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + 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: @@ -60,7 +61,6 @@ jobs: 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 +77,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,9 +97,9 @@ 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.9"] + python-version: ["3.7", "3.10"] defaults: run: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..f8ba9799 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/setup.cfg b/setup.cfg index 834052be..957671ea 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 @@ -26,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 diff --git a/setup.py b/setup.py index 5d10949a..9959aa84 100644 --- a/setup.py +++ b/setup.py @@ -80,13 +80,11 @@ 'pytest', 'pytest-cov', 'pytest-mypy', - 'pytest-flake8', 'pytest-benchmark', 'attrs>=17.4.0', 'codecov', 'colorlog', 'crick', - 'flake8', 'matplotlib', 'moto', 'aws-xray-sdk', 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: