Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 50 additions & 9 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,68 @@ permissions:
contents: read

jobs:
build:

dependency-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

test:
needs: dependency-install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# - 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: |
python -m pytest

devops:
needs: test
environment: development
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with pylint
run: |
pip install pylint
pylint --fail-under=9.8 --rcfile=.pylintrc utilities
- name: code coverage
run: |
mkdir -p ./coverage
pip install pytest-cov
python -m pytest --cov --cov-report=xml:./coverage/coverage.xml

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage/coverage.xml # optional
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 GU Orbit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![example branch parameter](https://github.com/guorbit/utilities/actions/workflows/python-app.yml/badge.svg?branch=migrating_segmentation_utils)
![example branch parameter](https://github.com/guorbit/utilities/actions/workflows/python-app.yml/badge.svg?branch=main) [![codecov](https://codecov.io/github/guorbit/utilities/branch/main/graph/badge.svg?token=3RVZAHQ4W2)](https://codecov.io/github/guorbit/utilities)

Note before installation: None of these commands have been properly tested. Make sure you installed the package in a virtual environment.

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
tensorflow==2.10
numpy==1.24.1
rasterio==1.3.6
Pillow==9.4.0
9 changes: 9 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

### Code coverage
provided by codecov



<a href="https://codecov.io/github/guorbit/utilities" >
<img src="https://codecov.io/github/guorbit/utilities/branch/main/graphs/sunburst.svg?token=3RVZAHQ4W2"/>
</a>
22 changes: 11 additions & 11 deletions tests/transform_utils_test.py/image_cutting_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
image_stich,
image_cut_experimental,
)
import pytest



def test_image_cut() -> None:
Expand All @@ -17,16 +17,16 @@ def test_image_cut() -> None:
assert cut_ims[-1, -1, -1, 0] == 1


@pytest.mark.xfail
def test_image_cut_incorrect_shape_colum_vector() -> None:
# does not pass
try:
img = np.zeros((512))
img[-1, -1, 0] = 1
image_cut(img, (256, 256), num_bands=3)
assert False
except ValueError:
assert True
# @pytest.mark.xfail
# def test_image_cut_incorrect_shape_colum_vector() -> None:
# # does not pass
# try:
# img = np.zeros((512))
# img[-1, -1, 0] = 1
# image_cut(img, (256, 256), num_bands=3)
# assert False
# except ValueError:
# assert True


def test_image_cut_incorrect_shape_too_many() -> None:
Expand Down