Skip to content

Commit

Permalink
switch to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jun 7, 2022
1 parent 0cff3e5 commit edb9f86
Show file tree
Hide file tree
Showing 30 changed files with 115 additions and 146 deletions.
9 changes: 9 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -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}"
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
3 changes: 1 addition & 2 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 15 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,40 @@ 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
```

### 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
```
1 change: 0 additions & 1 deletion docs/contributing.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.md

This file was deleted.

2 changes: 1 addition & 1 deletion mkdocs.yml → docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/release-notes.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/src/contributing.md
1 change: 1 addition & 0 deletions docs/src/index.md
1 change: 1 addition & 0 deletions docs/src/release-notes.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"},
]
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"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

36 changes: 0 additions & 36 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

30 changes: 0 additions & 30 deletions tox.ini

This file was deleted.

0 comments on commit edb9f86

Please sign in to comment.