diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..a07afb1 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,43 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest coveralls pytest-cov + if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi + - name: Install rio-mbtiles + run: | + pip install -e . + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest -v diff --git a/.travis.yml b/.travis.yml index 273c0a0..d1c31e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,14 @@ env: global: - PIP_WHEEL_DIR=$HOME/.cache/pip - PIP_FIND_LINKS=$HOME/.cache/pip -python: - - "2.7.15" - - "3.6" - - "3.7" +matrix: + fast_finish: true + include: + - python: '3.10' + dist: bionic + - python: '3.9' + - python: '3.8' + cache: directories: - $HOME/.cache/pip/ diff --git a/README.rst b/README.rst index 29b488f..a02be94 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,18 @@ rio-mbtiles =========== +.. image:: https://github.com/mapbox/rio-mbtiles/actions/workflows/python-package.yml/badge.svg + :alt: Python Workflow + :target: https://github.com/mapbox/rio-mbtiles/actions/workflows/python-package.yml + .. image:: https://travis-ci.org/mapbox/rio-mbtiles.svg :target: https://travis-ci.org/mapbox/rio-mbtiles + +.. image:: https://img.shields.io/pypi/v/rio-mbtiles.svg + :target: https://pypi.python.org/pypi/rio-mbtiles + + A plugin for the `Rasterio CLI `__ that exports a raster dataset to the MBTiles (version 1.3) format. Features diff --git a/mbtiles/scripts/cli.py b/mbtiles/scripts/cli.py index 70d87ed..7fee269 100644 --- a/mbtiles/scripts/cli.py +++ b/mbtiles/scripts/cli.py @@ -458,6 +458,7 @@ def mbtiles( pbar = None # Initialize the sqlite db. + appending = None output_exists = os.path.exists(output) if append: appending = output_exists diff --git a/requirements-dev.txt b/requirements-dev.txt index 49a2252..a9a95e9 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,13 +1,13 @@ affine==2.2.1 cligj==0.5.0 -coveralls==1.5.1 +coveralls enum34==1.1.6 mercantile==1.1.6 mock; python_version < "3.3" -numpy==1.15.2 -pytest<3.9 -pytest-cov==2.5.1 +numpy>=1.10 +pytest +pytest-cov coverage==4.5.1 -rasterio~=1.0 +rasterio>=1.0 snuggs==1.4.2 -tqdm==4.48.2 +tqdm>=4.0 diff --git a/setup.py b/setup.py index 8f03754..5961136 100644 --- a/setup.py +++ b/setup.py @@ -36,10 +36,10 @@ "cligj>=0.5", "mercantile", "numpy>=1.10", - "rasterio~=1.0", - "shapely~=1.7.0", + "rasterio>=1.0", + "shapely>=1.8.0", "supermercado", - "tqdm~=4.0", + "tqdm>=4.0", ], extras_require={"test": ["coveralls", "pytest", "pytest-cov"]}, entry_points=""" diff --git a/tests/test_cli.py b/tests/test_cli.py index 1da5d87..414fe7c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -249,7 +249,7 @@ def test_rgba_png(tmpdir, data, filename): (4, 10, 70, "RGB.byte.tif"), (6, 7, 6, "RGB.byte.tif"), (4, 10, 12, "rgb-193f513.vrt"), - (4, 10, 69, "rgb-fa48952.vrt"), + (4, 10, 70, "rgb-fa48952.vrt"), ], ) @pytest.mark.parametrize(