diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..4293714 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,9 @@ +[bumpversion] +current_version = 0.6.0 +commit = True +tag = True +tag_name = {new_version} + +[bumpversion:file:rio_tiler_pds/__init__.py] +search = __version__ = "{current_version}" +replace = __version__ = "{new_version}" diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..71b4e2d --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = E501,W503,E203 +exclude = .git,__pycache__,docs/source/conf.py,old,build,dist +max-complexity = 12 +max-line-length = 90 diff --git a/codecov.yml b/.github/codecov.yml similarity index 100% rename from codecov.yml rename to .github/codecov.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9aab6f..664f921 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,13 +8,15 @@ on: tags: - '*' pull_request: +env: + LATEST_PY_VERSION: '3.9' jobs: tests: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ['3.7', '3.8', '3.9'] steps: - uses: actions/checkout@v2 @@ -26,24 +28,24 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install pre-commit - - - name: Install module - run: python -m pip install -e .["test"] + python -m pip install .["test"] - name: Run pre-commit - run: pre-commit run --all-files + if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} + run: | + python -m pip install pre-commit + pre-commit run --all-files - name: Run tests run: python -m pytest --cov rio_tiler_pds --cov-report xml --cov-report term-missing - name: Upload Results - if: success() + if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} uses: codecov/codecov-action@v1 with: file: ./coverage.xml flags: unittests - name: ${{ matrix.platform }}-${{ matrix.tox-env }} + name: ${{ matrix.python-version }} fail_ci_if_error: false publish: @@ -55,27 +57,25 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: "3.x" + python-version: ${{ env.LATEST_PY_VERSION }} - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install tox + python -m pip install flit + python -m pip install . - name: Set tag version id: tag - # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - name: Set module version id: module - # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions - run: echo ::set-output name=version::$(python setup.py --version) + run: echo ::set-output name=version::$(python -c 'from importlib.metadata import version; print(version("rio_tiler_pds"))') - name: Build and publish if: steps.tag.outputs.tag == steps.module.outputs.version env: - TOXENV: release - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: tox + FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }} + FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: flit publish diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index d4455f2..00c9f4a 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -27,8 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install numpy python -m pip install -e .["docs"] - name: Deploy docs - run: mkdocs gh-deploy --force + run: mkdocs gh-deploy --force -f docs/mkdocs.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e2581a..93cbc7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,13 +18,15 @@ repos: language_version: python - repo: https://github.com/PyCQA/pydocstyle - rev: 5.1.1 + rev: 6.1.1 hooks: - id: pydocstyle language_version: python + additional_dependencies: + - toml - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.960 hooks: - id: mypy language_version: python diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffb4114..6ccf4ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,12 +7,18 @@ Issues and pull requests are more than welcome: https://github.com/cogeotiff/rio ```bash $ git clone https://github.com/cogeotiff/rio-tiler-pds.git $ cd rio-tiler-pds -$ pip install -e .[dev] +$ pip install -e .["test,dev"] ``` -**Python3.7 only** +You can then run the tests with the following command: -This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and *mypy* when committing new code. +```sh +python -m pytest --cov rio_tiler_pds --cov-report term-missing +``` + +### pre-commit + +This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code. ```bash $ pre-commit install @@ -20,21 +26,21 @@ $ pre-commit install ### Docs -``` -pip install rio_tiler_pds[docs] +```sh +pip install rio_tiler_pds["docs"] ``` Hot-reloading docs: -``` +```sh git clone https://github.com/cogeotiff/rio-tiler-pds cd rio-tiler-pds -mkdocs serve +mkdocs serve -f docs/mkdocs.yml ``` To manually deploy docs (note you should never need to do this because Github Actions deploys automatically for new commits.): -``` -mkdocs gh-deploy +```sh +mkdocs gh-deploy -f docs/mkdocs.yml ``` diff --git a/docs/contributing.md b/docs/contributing.md deleted file mode 120000 index 44fcc63..0000000 --- a/docs/contributing.md +++ /dev/null @@ -1 +0,0 @@ -../CONTRIBUTING.md \ No newline at end of file diff --git a/docs/index.md b/docs/index.md deleted file mode 120000 index 32d46ee..0000000 --- a/docs/index.md +++ /dev/null @@ -1 +0,0 @@ -../README.md \ No newline at end of file diff --git a/mkdocs.yml b/docs/mkdocs.yml similarity index 99% rename from mkdocs.yml rename to docs/mkdocs.yml index 58313a8..cb900fe 100644 --- a/mkdocs.yml +++ b/docs/mkdocs.yml @@ -2,7 +2,7 @@ site_name: 'rio-tiler-pds' site_description: 'A rio-tiler plugin to access and read Public hosted datasets.' -docs_dir: 'docs' +docs_dir: 'src' site_dir: 'build' # Repository diff --git a/docs/release-notes.md b/docs/release-notes.md deleted file mode 120000 index cf54708..0000000 --- a/docs/release-notes.md +++ /dev/null @@ -1 +0,0 @@ -../CHANGES.md \ No newline at end of file diff --git a/docs/API/cbers.md b/docs/src/API/cbers.md similarity index 100% rename from docs/API/cbers.md rename to docs/src/API/cbers.md diff --git a/docs/API/landsat-c2.md b/docs/src/API/landsat-c2.md similarity index 100% rename from docs/API/landsat-c2.md rename to docs/src/API/landsat-c2.md diff --git a/docs/API/landsat.md b/docs/src/API/landsat.md similarity index 100% rename from docs/API/landsat.md rename to docs/src/API/landsat.md diff --git a/docs/API/modis.md b/docs/src/API/modis.md similarity index 100% rename from docs/API/modis.md rename to docs/src/API/modis.md diff --git a/docs/API/sentinel.md b/docs/src/API/sentinel.md similarity index 100% rename from docs/API/sentinel.md rename to docs/src/API/sentinel.md diff --git a/docs/src/contributing.md b/docs/src/contributing.md new file mode 120000 index 0000000..f939e75 --- /dev/null +++ b/docs/src/contributing.md @@ -0,0 +1 @@ +../../CONTRIBUTING.md \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/docs/src/release-notes.md b/docs/src/release-notes.md new file mode 120000 index 0000000..8980b4a --- /dev/null +++ b/docs/src/release-notes.md @@ -0,0 +1 @@ +../../CHANGES.md \ No newline at end of file diff --git a/docs/usage/cbers.md b/docs/src/usage/cbers.md similarity index 100% rename from docs/usage/cbers.md rename to docs/src/usage/cbers.md diff --git a/docs/usage/landsat-c2.md b/docs/src/usage/landsat-c2.md similarity index 100% rename from docs/usage/landsat-c2.md rename to docs/src/usage/landsat-c2.md diff --git a/docs/usage/landsat.md b/docs/src/usage/landsat.md similarity index 100% rename from docs/usage/landsat.md rename to docs/src/usage/landsat.md diff --git a/docs/usage/modis.md b/docs/src/usage/modis.md similarity index 100% rename from docs/usage/modis.md rename to docs/src/usage/modis.md diff --git a/docs/usage/overview.md b/docs/src/usage/overview.md similarity index 100% rename from docs/usage/overview.md rename to docs/src/usage/overview.md diff --git a/docs/usage/sentinel.md b/docs/src/usage/sentinel.md similarity index 100% rename from docs/usage/sentinel.md rename to docs/src/usage/sentinel.md diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c023036 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,60 @@ +[project] +name = "rio-tiler-pds" +description = "Get mercator tile from cloud hosted dataset such as CBERS-4, Sentinel-2, Sentinel-1 and Landsat-8 AWS PDS." +readme = "README.md" +requires-python = ">=3.7" +license = {file = "LICENSE"} +authors = [ + {name = "Vincent Sarago", email = "vincent@developmentseed.com"}, +] +keywords = ["COGEO", "Cloud Optimized Geotiff", "AWS PDS"] +classifiers = [ + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering :: GIS", + "Typing :: Typed", +] +dynamic = ["version"] +dependencies = ["rio-tiler>=3.0.0,<4.0", "rio-toa"] + +[project.optional-dependencies] +test = ["pytest", "pytest-cov"] +dev = ["pre-commit"] +docs = ["mkdocs", "mkdocs-material", "pygments", "mkapi"] + +[project.urls] +Source = "https://github.com/cogeotiff/rio-tiler-pds" +Documentation = "https://cogeotiff.github.io/rio-tiler-pds/" + +[build-system] +requires = ["flit>=3.2,<4"] +build-backend = "flit_core.buildapi" + +[tool.flit.module] +name = "rio_tiler_pds" + +[tool.flit.sdist] +exclude = [ + "tests/", + "docs/", + ".github/", + "CHANGELOG.md", + "CONTRIBUTING.md", +] + +[tool.isort] +profile = "black" +known_first_party = ["rio_tiler", "rio_tiler_pds", "rio_toa"] +known_third_party = ["rasterio","morecantile"] +default_section = "THIRDPARTY" + +[tool.mypy] +no_strict_optional = true + +[tool.pydocstyle] +select = "D1" +match = "(?!test).*.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e319eaa..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ - -rio-tiler>=2.0.0rc2,<2.1 -rio-toa diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d47ca45..0000000 --- a/setup.cfg +++ /dev/null @@ -1,36 +0,0 @@ -[bumpversion] -current_version = 0.6.0 -commit = True -tag = True -tag_name = {new_version} -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.(?P.+))? -serialize = - {major}.{minor}.{patch}.{suffix} - {major}.{minor}.{patch} - -[bumpversion:file:setup.py] -search = version="{current_version}" -replace = version="{new_version}" - -[bumpversion:file:rio_tiler_pds/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[isort] -profile = black -known_first_party = rio_tiler,rio_tiler_pds,rio_toa -known_third_party = rasterio,mercantile,morecantile -default_section = THIRDPARTY - -[flake8] -ignore = E501,W503,E203 -exclude = .git,__pycache__,docs/source/conf.py,old,build,dist -max-complexity = 12 -max-line-length = 90 - -[mypy] -no_strict_optional = True - -[pydocstyle] -select = D1 -match = (?!test).*\.py diff --git a/setup.py b/setup.py deleted file mode 100644 index bb246ed..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Setup for rio-tiler-pds.""" - -from setuptools import find_packages, setup - -with open("README.md") as f: - readme = f.read() - -# Runtime requirements. -inst_reqs = ["rio-tiler>=3.0.0,<4.0", "rio-toa"] - -extra_reqs = { - "test": ["pytest", "pytest-cov"], - "dev": ["pytest", "pytest-cov", "pre-commit"], - "docs": ["mkdocs", "mkdocs-material", "pygments", "mkapi"], -} - -setup( - name="rio-tiler-pds", - version="0.6.0", - python_requires=">=3.7", - description="""Get mercator tile from cloud hosted dataset such as CBERS-4, Sentinel-2, Sentinel-1 and Landsat-8 AWS PDS""", - long_description=readme, - long_description_content_type="text/markdown", - classifiers=[ - "Intended Audience :: Information Technology", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.7", - "Topic :: Scientific/Engineering :: GIS", - ], - keywords="COG cogeo raster aws map tiler gdal rasterio", - author="Vincent Sarago", - author_email="vincent@developmentseed.org", - url="https://github.com/cogeotiff/rio-tiler-pds", - license="BSD", - packages=find_packages(exclude=["ez_setup", "examples", "tests"]), - include_package_data=True, - zip_safe=False, - install_requires=inst_reqs, - extras_require=extra_reqs, -) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index e58cb56..0000000 --- a/tox.ini +++ /dev/null @@ -1,30 +0,0 @@ -[tox] -envlist = py37,py38,py39 - -[testenv] -extras = test -commands= - python -m pytest --cov rio_tiler_pds --cov-report xml --cov-report term-missing --ignore=venv - -# Release tooling -[testenv:build] -basepython = python3 -skip_install = true -deps = - wheel - setuptools -commands = - python setup.py sdist - -[testenv:release] -setenv = - TWINE_USERNAME = {env:TWINE_USERNAME} - TWINE_PASSWORD = {env:TWINE_PASSWORD} -basepython = python3 -skip_install = true -deps = - {[testenv:build]deps} - twine >= 1.5.0 -commands = - {[testenv:build]commands} - twine upload --skip-existing dist/*