Skip to content

Commit

Permalink
Support builds on windows, linux, and osx (#3)
Browse files Browse the repository at this point in the history
* Fix build on windows

* Switch to conda build

* Remove cuda dependencies

* Set default actions shell to bash

* Fix conda install on windows in GH actions test

* Set bash as default shell

* Test python 3.8 and 3.9

* Downgrade numpy

See brycefrank/pyfor#78

* Tidy up action workflow

* Fix install
  • Loading branch information
tayden authored Feb 24, 2022
1 parent eb00fe5 commit 773b4d8
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 50 deletions.
52 changes: 27 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# For more information see: https:/help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

Expand All @@ -10,32 +10,34 @@ on:
branches: [ main ]

jobs:
build:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9"]
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.9" ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1
- name: Install dependencies
run: |
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
poetry run pytest
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-update-conda: true
auto-activate-base: true
- name: Lint with flake8
run: |
conda install flake8
# 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: |
conda install pytest
pytest
2 changes: 1 addition & 1 deletion .idea/hakai-segmentation.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions conda/hakai_segmentation/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% set name = "hakai_segmentation" %}
{% set version = "0.1.0rc2" %}

package:
name: "{{ name|lower }}"
version: "{{ version }}"

source:
path: ../../

build:
noarch: python
number: 0
entry_points:
- kom = hakai_segmentation.cli:cli
script: "{{ PYTHON }} -m pip install . -vv"

requirements:
host:
- python
- pip
- poetry
run:
- python
- fire >=0.4.0,<0.5.0
- numpy >=1.22.2,<2.0.0
- rasterio >=1.2.10,<2.0.0
- pytorch >=1.10.2,<2.0.0
- torchvision >=0.11.3,<0.12.0
- tqdm >=4.62.3,<5.0

test:
imports:
- hakai_segmentation
- hakai_segmentation.data
- hakai_segmentation.geotiff_io
commands:
- kom --help

about:
home: "https://github.com/hakaiInstitute/hakai-segmentation"
license: MIT
license_file: LICENSE.txt
summary: "Hakai Segment Tool for GeoTiff RPAS Imagery"
doc_url: "https://hakai-segmentation.readthedocs.io"
dev_url: "https://github.com/hakaiInstitute/hakai-segmentation"

extra:
recipe-maintainers:
- tayden
13 changes: 13 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: hakai-segmentation
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- python>=3.8,<3.10
- conda-forge::fire
- conda-forge::numpy
- conda-forge::rasterio
- conda-forge::tqdm
- pytorch::pytorch>=1.10
- pytorch::torchvision
2 changes: 1 addition & 1 deletion hakai_segmentation/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fire

from hakai_segmentation import find_kelp, find_mussels
from hakai_segmentation.lib import find_kelp, find_mussels


def cli():
Expand Down
2 changes: 1 addition & 1 deletion hakai_segmentation/geotiff_io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hakai_segmentation.geotiff_io.geotiff_reader import GeotiffReader
from hakai_segmentation.geotiff_io.geotiff_writer import GeotiffWriter

__all__ = [GeotiffReader, GeotiffWriter]
__all__ = ['GeotiffReader', 'GeotiffWriter']
9 changes: 0 additions & 9 deletions hooks/hook-rasterio.py

This file was deleted.

15 changes: 2 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors = ["Taylor Denouden <[email protected]>"]
license = "MIT"
readme = "README.rst"
repository = "https://github.com/hakaiInstitute/hakai-segmentation"
documentation = "https://hakai-segmentation.readthedocs.io"

packages = [
{ include = "hakai_segmentation" }
Expand All @@ -21,19 +22,7 @@ tqdm = "^4.62.3"
torchvision = "^0.11.3"
torch = "^1.10.2"
fire = "^0.4.0"
rasterio = [
{ version = "^1.2.10", platform = "linux || darwin" },
{ path = "windows/rasterio-1.2.10-cp38-cp38-win32.whl", markers = "python_version == '3.8' and platform_system == 'Windows' and platform_machine == 'x86_64'" },
{ path = "windows/rasterio-1.2.10-cp39-cp39-win32.whl", markers = "python_version == '3.9' and platform_system == 'Windows' and platform_machine == 'x86_64'" },
{ path = "windows/rasterio-1.2.10-cp38-cp38-win_amd64.whl", markers = "python_version == '3.8' and platform_system == 'Windows' and platform_machine == 'AMD64'" },
{ path = "windows/rasterio-1.2.10-cp39-cp39-win_amd64.whl", markers = "python_version == '3.9' and platform_system == 'Windows' and platform_machine == 'AMD64'" },
]
gdal = [
{ path = "windows/GDAL-3.4.1-cp38-cp38-win32.whl", markers = "python_version == '3.8' and platform_system == 'Windows' and platform_machine == 'x86_64'" },
{ path = "windows/GDAL-3.4.1-cp39-cp39-win32.whl", markers = "python_version == '3.9' and platform_system == 'Windows' and platform_machine == 'x86_64'" },
{ path = "windows/GDAL-3.4.1-cp38-cp38-win_amd64.whl", markers = "python_version == '3.8' and platform_system == 'Windows' and platform_machine == 'AMD64'" },
{ path = "windows/GDAL-3.4.1-cp39-cp39-win_amd64.whl", markers = "python_version == '3.9' and platform_system == 'Windows' and platform_machine == 'AMD64'" },
]
rasterio = "^1.2.1"

[tool.poetry.dev-dependencies]
pytest = "^7.0.1"
Expand Down
Binary file removed windows/GDAL-3.4.1-cp38-cp38-win32.whl
Binary file not shown.
Binary file removed windows/GDAL-3.4.1-cp38-cp38-win_amd64.whl
Binary file not shown.
Binary file removed windows/GDAL-3.4.1-cp39-cp39-win32.whl
Binary file not shown.
Binary file removed windows/GDAL-3.4.1-cp39-cp39-win_amd64.whl
Binary file not shown.
Binary file removed windows/rasterio-1.2.10-cp38-cp38-win32.whl
Binary file not shown.
Binary file removed windows/rasterio-1.2.10-cp38-cp38-win_amd64.whl
Binary file not shown.
Binary file removed windows/rasterio-1.2.10-cp39-cp39-win32.whl
Binary file not shown.
Binary file removed windows/rasterio-1.2.10-cp39-cp39-win_amd64.whl
Binary file not shown.

0 comments on commit 773b4d8

Please sign in to comment.