Skip to content

Commit

Permalink
Added pre-commit (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Jan 2, 2023
1 parent 3efc5d4 commit a830c0b
Show file tree
Hide file tree
Showing 23 changed files with 97 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Deploy main
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'main') ||
(github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
(github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,24 @@ on:
- cron: '0 18 * * SUN'

jobs:
pre_commit:
name: Run pre-commit hooks
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "1"
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit
uses: pre-commit/action@v3.0.0
test_suite:
name: Pytest on ${{ matrix.os }} with Python ${{ matrix.python-version }}
needs: [pre_commit]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is the configuration for pre-commit, a local framework for managing pre-commit hooks
# Check out the docs at: https://pre-commit.com/

default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
exclude: (\.min\.js$|\.svg$)
- id: trailing-whitespace
exclude: \.svg$
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8 # See 'setup.cfg' for args
args: [holoviews]
files: holoviews/
- repo: https://github.com/hoxbro/clean_notebook
rev: 0.1.5
hooks:
- id: clean-notebook
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Bug fixes:
Compatibility:

- Compatibility with HoloViews 1.14.8 ([#556](https://github.com/holoviz/geoviews/pull/556))
- Compatibility with Python 3.10 by replacing LooseVersion with packaging.Version ([#555](https://github.com/holoviz/geoviews/pull/555))
- Compatibility with Python 3.10 by replacing LooseVersion with packaging.Version ([#555](https://github.com/holoviz/geoviews/pull/555))

Version 1.9.3
=============
Expand Down Expand Up @@ -164,7 +164,7 @@ Bug fixes and minor improvements:
Version 1.6.4
=============

Minor bugfix release. Includes contributions from @philippjfr, @ahuang11, @zassa, and @ceball
Minor bugfix release. Includes contributions from @philippjfr, @ahuang11, @zassa, and @ceball

Bug fixes and minor improvements:

Expand Down Expand Up @@ -241,7 +241,7 @@ Enhancements:

Bug fixes:

- Improved handling of Point geometries in geopandas dataframe ([#204](https://github.com/holoviz/geoviews/pull/204))
- Improved handling of Point geometries in geopandas dataframe ([#204](https://github.com/holoviz/geoviews/pull/204))
- Fixes for projecting draw tool data ([#205](https://github.com/holoviz/geoviews/pull/205))
- Improvements and fixes for handling of QuadMesh projections ([#250](https://github.com/holoviz/geoviews/pull/250))
- Fixes for Image longitude wrapping ([#260](https://github.com/holoviz/geoviews/pull/260))
Expand Down Expand Up @@ -287,8 +287,8 @@ New components:

New features:

- Hover tool now supports displaying geographic coordinates as longitude and latitude ([#158](https://github.com/holoviz/geoviews/pull/158))
- Hover tool now supports displaying geographic coordinates as longitude and latitude ([#158](https://github.com/holoviz/geoviews/pull/158))

- Added a new ``geoviews.tile_sources`` module with a predefined set of tile sources ([#165](https://github.com/holoviz/geoviews/pull/165))

- Wrapped the xESMF library as a regridding and interpolation operation for rectilinear and curvilinear grids ([#127](https://github.com/holoviz/geoviews/pull/127))
Expand Down Expand Up @@ -325,7 +325,7 @@ Version 1.4.0
- Allow specifying WMTS element with just the URL ([#89](https://github.com/holoviz/geoviews/pull/89))
- Added GeoPandas interface to plot geometries more easily ([#88](https://github.com/holoviz/geoviews/pull/88))
- Added further projection operations allowing most geographic element types to be explicitly projected ([#88](https://github.com/holoviz/geoviews/pull/88))
- Enabled MercatorTicker on geographic bokeh plots ensuring axes are labelled with latitudes and longitudes ([#64](https://github.com/holoviz/geoviews/pull/64))
- Enabled MercatorTicker on geographic bokeh plots ensuring axes are labelled with latitudes and longitudes ([#64](https://github.com/holoviz/geoviews/pull/64))



Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ global-exclude *~
global-exclude *.ipynb_checkpoints/*
graft examples
graft geoviews/examples
graft geoviews/dist
graft geoviews/dist
2 changes: 1 addition & 1 deletion doc/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ GeoViews is completely open source, available under a BSD license freely for bot

GeoViews is part of the `HoloViz <https://holoviz.org>`_ family of tools. The `holoviz.org <https://holoviz.org>`_ website shows how to use GeoViews together with other libraries to solve complex problems, with detailed tutorials and examples. You can see a variety of projects using GeoViews at `examples.pyviz.org <https://examples.pyviz.org>`_, and you can compare GeoViews to other available tools at `pyviz.org <https://pyviz.org>`_.

If you have any questions or usage issues visit the `GeoViews Discourse <https://discourse.holoviz.org/c/geoviews/>`_ site.
If you have any questions or usage issues visit the `GeoViews Discourse <https://discourse.holoviz.org/c/geoviews/>`_ site.

If you like GeoViews and have built something you want to share, tweet a link or screenshot of your latest creation at @HoloViews, along with any other library you used (@HoloViz_org, @Panel_org, @Datashader, @Bokeh, @Matplotlib, etc.). Thanks!
6 changes: 3 additions & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ will first need to have installed the `dependencies of cartopy <http://scitools.
or else have set up your system to be able to build them.


If you have any `issues <https://github.com/holoviz/geoviews/issues>`_ or wish
to `contribute code <https://help.github.com/articles/about-pull-requests>`_., you can visit
our `GitHub site <https://github.com/holoviz/geoviews>`_ or file a topic on
If you have any `issues <https://github.com/holoviz/geoviews/issues>`_ or wish
to `contribute code <https://help.github.com/articles/about-pull-requests>`_., you can visit
our `GitHub site <https://github.com/holoviz/geoviews>`_ or file a topic on
the `HoloViz Discourse <https://discourse.holoviz.org/>`_.

.. toctree::
Expand Down
30 changes: 15 additions & 15 deletions doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Bug fixes:
Compatibility:

- Compatibility with HoloViews 1.14.8 (`#556 <https://github.com/holoviz/geoviews/pull/556>`_)
- Compatibility with Python 3.10 by replacing LooseVersion with packaging.Version (`#555 <https://github.com/holoviz/geoviews/pull/555>`_)
- Compatibility with Python 3.10 by replacing LooseVersion with packaging.Version (`#555 <https://github.com/holoviz/geoviews/pull/555>`_)


Version 1.9.3
Expand Down Expand Up @@ -167,7 +167,7 @@ Bug fixes and minor improvements:
Version 1.6.4
-------------

Minor bugfix release. Includes contributions from @philippjfr, @ahuang11, @zassa, and @ceball
Minor bugfix release. Includes contributions from @philippjfr, @ahuang11, @zassa, and @ceball

Bug fixes and minor improvements:

Expand Down Expand Up @@ -254,7 +254,7 @@ Enhancements:
Bug fixes:


* Improved handling of Point geometries in geopandas dataframe (`#204 <https://github.com/holoviz/geoviews/pull/204>`_)
* Improved handling of Point geometries in geopandas dataframe (`#204 <https://github.com/holoviz/geoviews/pull/204>`_)
* Fixes for projecting draw tool data (`#205 <https://github.com/holoviz/geoviews/pull/205>`_)
* Improvements and fixes for handling of QuadMesh projections (`#250 <https://github.com/holoviz/geoviews/pull/250>`_)
* Fixes for Image longitude wrapping (`#260 <https://github.com/holoviz/geoviews/pull/260>`_)
Expand Down Expand Up @@ -288,37 +288,37 @@ Major feature:
New components:


*
*
Added `Graph element <http://holoviews.org/reference/elements/bokeh/Graph.html>`_ to plot networks of connected nodes (`#115 <https://github.com/holoviz/geoviews/pull/115>`_)

*
*
Added `TriMesh element <http://holoviews.org/reference/elements/bokeh/TriMesh.html>`_ and datashading operation to plot small and large irregular triangular meshes (`#115 <https://github.com/holoviz/geoviews/pull/115>`_)

*
*
Added `QuadMesh element <http://holoviews.org/reference/elements/bokeh/QuadMesh.html>`_ and datashading operation to plot small and large, irregular rectilinear and curvilinear meshes (`#116 <https://github.com/holoviz/geoviews/pull/116>`_)

*
*
Added `VectorField element <http://holoviews.org/reference/elements/bokeh/VectorField.html>`_ and datashading operation to plot small and large quiver plots and other collections of vectors (`#122 <https://github.com/holoviz/geoviews/pull/122>`_)

*
*
Added `HexTiles element <http://holoviews.org/reference/elements/bokeh/HexTiles.html>`_ to plot data binned into a hexagonal grid (`#147 <https://github.com/holoviz/geoviews/pull/147>`_)

*
*
Added `Labels element <http://holoviews.org/reference/elements/bokeh/Labels.html>`_ to plot a large number of text labels at once (as data rather than as annotations) (`#147 <https://github.com/holoviz/geoviews/pull/147>`_)

New features:


*
Hover tool now supports displaying geographic coordinates as longitude and latitude (`#158 <https://github.com/holoviz/geoviews/pull/158>`_)
*
Hover tool now supports displaying geographic coordinates as longitude and latitude (`#158 <https://github.com/holoviz/geoviews/pull/158>`_)

*
*
Added a new ``geoviews.tile_sources`` module with a predefined set of tile sources (`#165 <https://github.com/holoviz/geoviews/pull/165>`_)

*
*
Wrapped the xESMF library as a regridding and interpolation operation for rectilinear and curvilinear grids (`#127 <https://github.com/holoviz/geoviews/pull/127>`_)

*
*
HoloViews operations including ``datashade`` and ``rasterize`` now retain geographic ``crs`` coordinate system (`#118 <https://github.com/holoviz/geoviews/pull/118>`_)

Enhancements:
Expand Down Expand Up @@ -351,7 +351,7 @@ Version 1.4.0
* Allow specifying WMTS element with just the URL (`#89 <https://github.com/holoviz/geoviews/pull/89>`_)
* Added GeoPandas interface to plot geometries more easily (`#88 <https://github.com/holoviz/geoviews/pull/88>`_)
* Added further projection operations allowing most geographic element types to be explicitly projected (`#88 <https://github.com/holoviz/geoviews/pull/88>`_)
* Enabled MercatorTicker on geographic bokeh plots ensuring axes are labelled with latitudes and longitudes (`#64 <https://github.com/holoviz/geoviews/pull/64>`_)
* Enabled MercatorTicker on geographic bokeh plots ensuring axes are labelled with latitudes and longitudes (`#64 <https://github.com/holoviz/geoviews/pull/64>`_)

Version 1.3.2
-------------
Expand Down
8 changes: 3 additions & 5 deletions examples/Homepage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
1 change: 0 additions & 1 deletion geoviews/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
from .geom_dict import GeomDictInterface # noqa (API import)
from .geopandas import GeoPandasInterface # noqa (API import)
from .iris import CubeInterface # noqa (API import)

2 changes: 1 addition & 1 deletion geoviews/data/geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def init(cls, eltype, data, kdims, vdims):
"DataFrames not %s." % type(data))
elif 'geometry' not in data:
cls.geo_column(data)

if vdims is None:
vdims = [col for col in data.columns if not isinstance(data[col], GeoSeries)]

Expand Down
8 changes: 4 additions & 4 deletions geoviews/data/iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def applies(cls, obj):
@classmethod
def init(cls, eltype, data, kdims, vdims):
import iris

if kdims:
kdims = [asdim(kd) for kd in kdims]
kdim_names = [kd.name for kd in kdims]
Expand Down Expand Up @@ -170,7 +170,7 @@ def coords(cls, dataset, dim, ordered=False, expanded=False):
data = data[::-1]
return data


@classmethod
def mask(cls, dataset, mask, mask_val=np.nan):
masked = dataset.data.copy()
Expand Down Expand Up @@ -213,7 +213,7 @@ def assign(cls, dataset, new_data):
def packed(cls, dataset):
return False


@classmethod
def dtype(cls, dataset, dimension):
name = dataset.get_dimension(dimension, strict=True).name
Expand Down Expand Up @@ -246,7 +246,7 @@ def values(cls, dataset, dim, expanded=True, flat=True, compute=True, keep_index
@classmethod
def reindex(cls, dataset, kdims=None, vdims=None):
import iris

dropped_kdims = [kd for kd in dataset.kdims if kd not in kdims]
constant = {}
for kd in dropped_kdims:
Expand Down
2 changes: 1 addition & 1 deletion geoviews/element/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ def geom(self, union=False):
else:
geom = MultiLineString(lines)
return unary_union(geom) if union else geom


class Shape(Dataset):
"""
Expand Down
4 changes: 2 additions & 2 deletions geoviews/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class PointTableLinkCallback(LinkCallback):
source_cds.properties.data.change.emit()
source_cds.data = source_cds.data
"""


class VertexTableLinkCallback(LinkCallback):

Expand Down Expand Up @@ -291,7 +291,7 @@ class RectanglesTableLinkCallback(HvRectanglesTableLinkCallback):
source_cds.data['width'] = ws
source_cds.data['height'] = hs
"""

VertexTableLink.register_callback('bokeh', VertexTableLinkCallback)
PointTableLink.register_callback('bokeh', PointTableLinkCallback)
RectanglesTableLink.register_callback('bokeh', RectanglesTableLinkCallback)
2 changes: 1 addition & 1 deletion geoviews/models/poly_draw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class PolyVertexDrawToolView extends PolyDrawToolView {

if (styles != null) {
for (const key of keys(styles)) {
point_cds.data[key] = styles[key]
point_cds.data[key] = styles[key]
point_glyph[key] = {field: key}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion geoviews/models/poly_edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class PolyVertexEditToolView extends PolyEditToolView {
for (const key of keys((this.model as any).end_style))
styles[key] = [(this.model as any).end_style[key]]
for (const key of keys((this.model as any).node_style)) {
for (let index = 0; index < (xs.length-2); index++) {
for (let index = 0; index < (xs.length-2); index++) {
styles[key].push((this.model as any).node_style[key])
}
}
Expand Down
2 changes: 1 addition & 1 deletion geoviews/operation/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class weighted_regrid(regrid):
files when you are done.""")

_files = []

_weights = {}

_per_element = True
Expand Down
2 changes: 1 addition & 1 deletion geoviews/operation/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _process(self, element, key=None):
y0, y1 = self.p.y_range or element.range(1)
bounds = bounds_to_poly((x0, y0, x1, y1))

# Initialize or lookup cache with STRTree
# Initialize or lookup cache with STRTree
if element._plot_id in self._cache:
cache = self._cache[element._plot_id]
domain, tree, geom_dicts, geom_cache, area_cache = cache
Expand Down
2 changes: 1 addition & 1 deletion geoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _update_ranges(self, element, ranges):
self.handles['x_range'].bounds = self.projection.x_limits
self.handles['y_range'].bounds = self.projection.y_limits
if self.projection is GOOGLE_MERCATOR:
# Avoid zooming in beyond tile and axis resolution (causing JS errors)
# Avoid zooming in beyond tile and axis resolution (causing JS errors)
options = self._traverse_options(element, 'plot', ['default_span'], defaults=False)
min_interval = options['default_span'][0] if options.get('default_span') else 5
for r in ('x_range', 'y_range'):
Expand Down
2 changes: 1 addition & 1 deletion geoviews/tests/data/test_iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_irregular_grid_data_values_inverted_y(self):

def test_dataset_transform_add_hm(self):
raise SkipTest("Not supported")



class ImageElement_IrisInterfaceTests(BaseImageElementInterfaceTests):
Expand Down
4 changes: 2 additions & 2 deletions geoviews/tests/test_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_multi_geom_conversion(self):
[0., 1.],
[0., 0.],
[1., 0.]
])
])
)
self.assertEqual(
np.array(geom.geoms[1].exterior.coords),
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_multi_geom_conversion(self):
[1, 1],
[2, 0]
])
)
)
self.assertEqual(
np.array(geom.geoms[1].coords),
np.array([
Expand Down
Loading

0 comments on commit a830c0b

Please sign in to comment.