-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add linting with flake8, black & isort - Remove python-env from tox.ini files, use gh-actions matrix for running different python versions - Define tox runs as `tox -e [lint/format/flake8/test]` * Change basepython to python3 from python3.9. Add test run with tox. * Add python3.10 to the github runner matrix * Use ubuntu-small osgeo container - Tested github-actions locally using act. - osgeo ubuntu-large images are 1.4 GB in size, takes some time to run this locally - Replacing this with ubuntu-small runs it faster with no side effects * Add release Actions workflow (#449) * Uncomment tox * Update job name to test * Add release workflow only on main and with tag * Fix flake8 (#450) * lint is flake8 * Remove - in order to not ignore exit code * Add extended ignores for flake8 * Rm unused vars * Remove extra # * Rm unused var * Add rio-cogeo dependency * Fix undefined variable, ignore ambigous name * Rm flake8 * Fix unused imports F401 * Remove - * Add cv2 dependencies * Format * Check if formatting passes * Move black/isort/flake8 config to setup.cfg * Add pre-commit config with isort, balck and flake8 * Add pre-commit dep Co-authored-by: SRM <[email protected]>
- Loading branch information
Rodrigo Almeida
and
SRM
authored
Feb 8, 2022
1 parent
ec4e0ef
commit 0dc498b
Showing
29 changed files
with
125 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release Python package | ||
|
||
on: | ||
workflow_run: | ||
workflows: [tests] | ||
branches: [main] | ||
types: [completed] | ||
|
||
jobs: | ||
release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
name: Release package to PyPi | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
- name: Build and release 📦 to PyPI | ||
with: | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
run: | | ||
tox -e release | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/ambv/black | ||
rev: 22.1.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.9 | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ pytest | |
tox | ||
isort | ||
flake8 | ||
pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[flake8] | ||
extend-ignore = | ||
E203, # whitespace before ':' | ||
E501, # line too long | ||
C901, # is too complex | ||
E402, # module level import not at top of file (for docs) | ||
E741, # ambiguous variable name | ||
|
||
exclude = | ||
.git, | ||
__pycache__, | ||
docs/source/conf.py, | ||
old, | ||
build, | ||
dist, | ||
.tox | ||
max-line-length = 88 | ||
max-complexity = 10 | ||
count=true | ||
|
||
[isort] | ||
profile = black | ||
|
||
[black] | ||
line-length = 88 | ||
target-version = ['py37', 'py38', 'py39', 'py310'] | ||
experimental_string_processing = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ def check_output(cmd): | |
"pyproj>=2.1", | ||
"PyYAML>=5.4", | ||
"rasterio>=1.0.23", | ||
"rio-cogeo>=3.0.2", | ||
"requests==2.22.0", | ||
"rtree>=0.9.3", | ||
"scikit-image>=0.16.2", | ||
|
@@ -79,7 +80,7 @@ def check_output(cmd): | |
"Programming Language :: Python :: 3.10", | ||
"Topic :: Scientific/Engineering :: GIS", | ||
], | ||
author=u"Ryan Avery", | ||
author="Ryan Avery", | ||
author_email="[email protected]", | ||
url="https://github.com/CosmiQ/solaris", | ||
license="MIT", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from . import data, utils, vector | ||
from . import data, utils, vector # noqa: F401 | ||
|
||
# data, eval, preproc, raster, tile, have gdal in them need to replace with rasterio | ||
__version__ = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import base, iou, pixel, vector | ||
from . import base, iou, pixel, vector # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import image, label, optical, pipesegment, sar | ||
from . import image, label, optical, pipesegment, sar # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import image | ||
from . import image # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import os | ||
|
||
import numpy as np | ||
import rasterio | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import raster_tile, vector_tile | ||
from . import raster_tile, vector_tile # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import cli, core, data, geo, io, tile | ||
from . import cli, core, data, geo, io, tile # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import graph, mask, polygon | ||
from . import graph, mask, polygon # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import os | ||
import pickle | ||
import subprocess | ||
|
||
import networkx as nx | ||
import numpy as np | ||
import skimage.io | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# flake8: noqa: F401 | ||
class TestImports(object): | ||
def test_imports(self): | ||
import solaris | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters