Skip to content

Commit

Permalink
add Black (pre-commit hook) and flake8 (PR annotations) runs (#96)
Browse files Browse the repository at this point in the history
* add black pre-commit hook and reformat files using black

* add github action workflow with flake8 on PRs
  • Loading branch information
JessicaS11 committed Sep 10, 2020
1 parent 31b27e5 commit 49dca47
Show file tree
Hide file tree
Showing 19 changed files with 2,934 additions and 1,259 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/flake8_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# use the flake8 linter to annotate improperly formatted code
# from: https://github.com/marketplace/actions/run-flake8-on-your-pr-with-annotations
name: Run flake8 linter on PRs

on:
pull_request:
branches:
- development
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Annotate PR after running flake8
uses: TrueBrain/actions-flake8@master
with:
max_line_length: 90
# https://github.com/marketplace/actions/run-flake8-on-your-pr-with-annotations?version=1.0.1
# uses: tayfun/flake8-your-pr@master
# secrets: ["GITHUB_TOKEN"]
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
56 changes: 31 additions & 25 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))

sys.path.insert(0, os.path.abspath("../.."))
import datetime

import icepyx
Expand All @@ -21,9 +22,9 @@

# -- Project information -----------------------------------------------------

project = 'icepyx'
project = "icepyx"
year = datetime.date.today().year
copyright = '2019-{}, The icepyx Developers'.format(year)
copyright = "2019-{}, The icepyx Developers".format(year)

# -- General configuration ---------------------------------------------------

Expand All @@ -35,24 +36,23 @@
"sphinx.ext.autosectionlabel",
"numpydoc",
"nbsphinx",
"recommonmark"

"recommonmark",
]
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
".rst": "restructuredtext",
".txt": "markdown",
".md": "markdown",
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['**.ipynb_checkpoints']
exclude_patterns = ["**.ipynb_checkpoints"]

# location of master document (by default sphinx looks for contents.rst)
master_doc = 'index'
master_doc = "index"


# -- Configuration options ---------------------------------------------------
Expand All @@ -68,24 +68,30 @@
# html_theme = 'alabaster'
html_theme = "sphinx_rtd_theme"
html_theme_options = {
'logo_only': True,
'display_version': False,
'prev_next_buttons_location': None,
'navigation_depth': 4,
'collapse_navigation': True
"logo_only": True,
"display_version": False,
"prev_next_buttons_location": None,
"navigation_depth": 4,
"collapse_navigation": True,
}
html_logo = '_static/icepyx_v2_oval_orig_nobackgr.png'
html_favicon = '_static/icepyx_v2_oval_tiny-uml_nobackgr.png'
html_static_path = ['_static']
html_logo = "_static/icepyx_v2_oval_orig_nobackgr.png"
html_favicon = "_static/icepyx_v2_oval_tiny-uml_nobackgr.png"
html_static_path = ["_static"]

html_context = {
'menu_links_name': '',
'menu_links': [
('<i class="fa fa-github fa-fw"></i> icepyx Github', 'https://github.com/icesat2py/icepyx'),
('<i class="fa fa-comments fa-fw"></i> Pangeo Discourse', 'https://discourse.pangeo.io/t/icepyx-python-tools-for-icesat-2-data/404/2')

]
"menu_links_name": "",
"menu_links": [
(
'<i class="fa fa-github fa-fw"></i> icepyx Github',
"https://github.com/icesat2py/icepyx",
),
(
'<i class="fa fa-comments fa-fw"></i> Pangeo Discourse',
"https://discourse.pangeo.io/t/icepyx-python-tools-for-icesat-2-data/404/2",
),
],
}


def setup(app):
app.add_stylesheet("style.css")
2 changes: 1 addition & 1 deletion icepyx/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .core import icesat2data
from .core import icesat2data
Loading

0 comments on commit 49dca47

Please sign in to comment.