Skip to content

Commit e9e3fc4

Browse files
authored
Merge pull request #1 from phobson/gha-workflows
Gha workflows
2 parents 53c5792 + 1b8bcb2 commit e9e3fc4

File tree

10 files changed

+56
-31
lines changed

10 files changed

+56
-31
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Run basic unit tests
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: mamba-org/setup-micromamba@v1
22+
with:
23+
# the create command looks like this:
24+
micromamba-version: '2.0.2-2'
25+
environment-name: test-env
26+
create-args: >-
27+
python=${{ matrix.python-version }}
28+
gridgen
29+
numpy
30+
matplotlib
31+
pyproj
32+
pytest
33+
coverage
34+
docopt
35+
requests
36+
pyyaml
37+
init-shell: bash
38+
cache-environment: true
39+
post-cleanup: 'all'
40+
- name: Run Python tests
41+
run: python check_pygridtools.py --verbose --durations=10 --strict
42+
shell: bash -el {0}

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
# built documents.
7777
#
7878
# The short X.Y version.
79-
version = '0.3.1'
79+
version = '0.3.2'
8080
# The full version, including alpha/beta/rc tags.
81-
release = '0.3.1'
81+
release = '0.3.2'
8282

8383
# The language for content autogenerated by Sphinx. Refer to documentation
8484
# for a list of supported languages.

pygridtools/tests/__init__.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pkg_resources import resource_filename
1+
from importlib import resources
22

33
import pygridtools
44
from pygridgen.tests import requires
@@ -11,16 +11,15 @@
1111

1212
@requires(pytest, 'pytest')
1313
def test(*args):
14-
options = [resource_filename('pygridtools', '')]
14+
options = [resources('pygridtools', '')]
1515
options.extend(list(args))
1616
return pytest.main(options)
1717

1818

1919
@requires(pytest, 'pytest')
2020
def teststrict(*args):
2121
options = list(set([
22-
resource_filename('pygridtools', ''),
23-
'--pep8',
22+
resources('pygridtools', ''),
2423
'--mpl',
2524
'--doctest-modules'
2625
] + list(args)))

pygridtools/tests/test_core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import pytest
1313
import numpy.testing as nptest
14-
import pandas.util.testing as pdtest
14+
import pandas.testing as pdtest
1515

1616
from pygridtools import core
1717
from pygridgen.tests import raises

pygridtools/tests/test_gefdc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import pytest
1111
import numpy.testing as nptest
12-
import pandas.util.testing as pdtest
12+
import pandas.testing as pdtest
1313

1414
from pygridtools import gefdc
1515
from . import utils

pygridtools/tests/test_iotools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import pytest
1212
import numpy.testing as nptest
13-
import pandas.util.testing as pdtest
13+
import pandas.testing as pdtest
1414

1515
try:
1616
import ipywidgets

pygridtools/tests/utils.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
from pkg_resources import resource_filename
2-
from contextlib import contextmanager
3-
from functools import wraps
4-
from pathlib import Path
51
import filecmp
62

73

@@ -10,15 +6,13 @@
106
except ImportError:
117
pytest = None
128

13-
import numpy.testing as nptest
14-
import pandas.util.testing as pdtest
9+
10+
import pandas.testing as pdtest
1511

1612
import geopandas
1713

1814

1915
def assert_textfiles_equal(baselinefile, outputfile):
20-
expectedtext = Path(baselinefile).open('r').read()
21-
resulttext = Path(outputfile).open('r').read()
2216
assert filecmp.cmp(baselinefile, outputfile)
2317

2418

pygridtools/validate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def polygon(polyverts, min_points=3):
6666
def _explode_geom(row):
6767
# save each geo part in its own row
6868
gsr = geopandas.GeoSeries([
69-
poly for poly in geometry.shape(row['geometry'])
69+
poly for poly in geometry.shape(row['geometry']).geoms
7070
])
7171
meta = row['properties']
7272
return geopandas.GeoDataFrame(meta, geometry=gsr, index=gsr.index)

setup.cfg

-9
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,3 @@ description-file = readme.rst
55
markers =
66
mpl_image_compare
77

8-
pep8ignore =
9-
E501
10-
E131
11-
E128
12-
pygridtools/test*/* E241 E201
13-
docs/* ALL
14-
15-
[pep8]
16-
max-line-length = 120

setup.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
DESCRIPTION = "utilities to facilitate grid generation"
55
LONG_DESCRIPTION = DESCRIPTION
66
NAME = "pygridtools"
7-
VERSION = "0.3.1"
7+
VERSION = "0.3.2"
88
AUTHOR = "Paul Hobson (Geosyntec Consultants)"
99
AUTHOR_EMAIL = "[email protected]"
1010
URL = "https://github.com/Geosyntec/pygridtools"
1111
DOWNLOAD_URL = "https://github.com/Geosyntec/pygridtools/archive/master.zip"
1212
LICENSE = "BSD 3-clause"
1313
PACKAGES = find_packages()
14-
PLATFORMS = "Python 3.6 and later."
14+
PLATFORMS = "Python 3.9 and later."
1515
CLASSIFIERS = [
1616
"License :: OSI Approved :: BSD License",
1717
"Operating System :: OS Independent",
@@ -20,8 +20,7 @@
2020
"Topic :: Formats and Protocols :: Data Formats",
2121
"Topic :: Scientific/Engineering :: Earth Sciences",
2222
"Topic :: Software Development :: Libraries :: Python Modules",
23-
'Programming Language :: Python :: 3.6',
24-
'Programming Language :: Python :: 3.7',
23+
"Programming Language :: Python",
2524
]
2625
INSTALL_REQUIRES = ['numpy', 'scipy', 'matplotlib', 'fiona', 'pandas', 'geopandas']
2726
PACKAGE_DATA = {}

0 commit comments

Comments
 (0)