Skip to content

Commit

Permalink
Merge pull request #1 from phobson/gha-workflows
Browse files Browse the repository at this point in the history
Gha workflows
  • Loading branch information
phobson authored Oct 25, 2024
2 parents 53c5792 + 1b8bcb2 commit e9e3fc4
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 31 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/python-run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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

name: Run basic unit tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
with:
# the create command looks like this:
micromamba-version: '2.0.2-2'
environment-name: test-env
create-args: >-
python=${{ matrix.python-version }}
gridgen
numpy
matplotlib
pyproj
pytest
coverage
docopt
requests
pyyaml
init-shell: bash
cache-environment: true
post-cleanup: 'all'
- name: Run Python tests
run: python check_pygridtools.py --verbose --durations=10 --strict
shell: bash -el {0}
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
# built documents.
#
# The short X.Y version.
version = '0.3.1'
version = '0.3.2'
# The full version, including alpha/beta/rc tags.
release = '0.3.1'
release = '0.3.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 3 additions & 4 deletions pygridtools/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pkg_resources import resource_filename
from importlib import resources

import pygridtools
from pygridgen.tests import requires
Expand All @@ -11,16 +11,15 @@

@requires(pytest, 'pytest')
def test(*args):
options = [resource_filename('pygridtools', '')]
options = [resources('pygridtools', '')]
options.extend(list(args))
return pytest.main(options)


@requires(pytest, 'pytest')
def teststrict(*args):
options = list(set([
resource_filename('pygridtools', ''),
'--pep8',
resources('pygridtools', ''),
'--mpl',
'--doctest-modules'
] + list(args)))
Expand Down
2 changes: 1 addition & 1 deletion pygridtools/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pytest
import numpy.testing as nptest
import pandas.util.testing as pdtest
import pandas.testing as pdtest

from pygridtools import core
from pygridgen.tests import raises
Expand Down
2 changes: 1 addition & 1 deletion pygridtools/tests/test_gefdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import pytest
import numpy.testing as nptest
import pandas.util.testing as pdtest
import pandas.testing as pdtest

from pygridtools import gefdc
from . import utils
Expand Down
2 changes: 1 addition & 1 deletion pygridtools/tests/test_iotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pytest
import numpy.testing as nptest
import pandas.util.testing as pdtest
import pandas.testing as pdtest

try:
import ipywidgets
Expand Down
10 changes: 2 additions & 8 deletions pygridtools/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from pkg_resources import resource_filename
from contextlib import contextmanager
from functools import wraps
from pathlib import Path
import filecmp


Expand All @@ -10,15 +6,13 @@
except ImportError:
pytest = None

import numpy.testing as nptest
import pandas.util.testing as pdtest

import pandas.testing as pdtest

import geopandas


def assert_textfiles_equal(baselinefile, outputfile):
expectedtext = Path(baselinefile).open('r').read()
resulttext = Path(outputfile).open('r').read()
assert filecmp.cmp(baselinefile, outputfile)


Expand Down
2 changes: 1 addition & 1 deletion pygridtools/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def polygon(polyverts, min_points=3):
def _explode_geom(row):
# save each geo part in its own row
gsr = geopandas.GeoSeries([
poly for poly in geometry.shape(row['geometry'])
poly for poly in geometry.shape(row['geometry']).geoms
])
meta = row['properties']
return geopandas.GeoDataFrame(meta, geometry=gsr, index=gsr.index)
Expand Down
9 changes: 0 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,3 @@ description-file = readme.rst
markers =
mpl_image_compare

pep8ignore =
E501
E131
E128
pygridtools/test*/* E241 E201
docs/* ALL

[pep8]
max-line-length = 120
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
DESCRIPTION = "utilities to facilitate grid generation"
LONG_DESCRIPTION = DESCRIPTION
NAME = "pygridtools"
VERSION = "0.3.1"
VERSION = "0.3.2"
AUTHOR = "Paul Hobson (Geosyntec Consultants)"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/Geosyntec/pygridtools"
DOWNLOAD_URL = "https://github.com/Geosyntec/pygridtools/archive/master.zip"
LICENSE = "BSD 3-clause"
PACKAGES = find_packages()
PLATFORMS = "Python 3.6 and later."
PLATFORMS = "Python 3.9 and later."
CLASSIFIERS = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
Expand All @@ -20,8 +20,7 @@
"Topic :: Formats and Protocols :: Data Formats",
"Topic :: Scientific/Engineering :: Earth Sciences",
"Topic :: Software Development :: Libraries :: Python Modules",
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
"Programming Language :: Python",
]
INSTALL_REQUIRES = ['numpy', 'scipy', 'matplotlib', 'fiona', 'pandas', 'geopandas']
PACKAGE_DATA = {}
Expand Down

0 comments on commit e9e3fc4

Please sign in to comment.