Skip to content

Commit

Permalink
integrate linter, docs, tox
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Jan 26, 2024
1 parent 46ee100 commit 4cf2978
Show file tree
Hide file tree
Showing 38 changed files with 2,286 additions and 1,314 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on: [push, pull_request]

jobs:
unit-tests:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install tox

- name: Run tests
run: tox -e unit-tests

unit-tests-notw:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install tox

- name: Run tests
run: tox -c tox_no_tweedledum.ini -e unit-tests

linters:
runs-on: ubuntu-latest
container:
image: cimg/python:3.8

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install tox

- name: Run linters
run: tox -e linters

# coverage:
# runs-on: ubuntu-latest
# container:
# image: cimg/python:3.8

# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Set up Python 3.8
# uses: actions/setup-python@v2
# with:
# python-version: 3.8

# - name: Install dependencies
# run: pip install tox

# - name: Run coverage
# run: tox -e coverage

typecheck:
runs-on: ubuntu-latest
container:
image: cimg/python:3.8

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: pip install tox

- name: Run typecheck
run: tox -e typecheck
31 changes: 31 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: docs

on: [push, pull_request, workflow_dispatch]

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme sphinx_rtd_dark_mode myst_nb
pip install latlon3
python setup.py install
- name: Sphinx build
run: |
sphinx-build docs/source _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ build
dist
*.egg-info
*.pyc
.tox
.tox
coverage.xml
.coverage
*_cache
33 changes: 33 additions & 0 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

## Prepare the env

```
pyenv virtualenv weatherrouting-env
pip install tox
```


## Pre-commit checks

```
tox
```


## Make docs

```
pip install sphinx sphinx_rtd_theme sphinx_rtd_dark_mode myst_nb
cd docs
make html
```


## Publish

```
rm dist/*
python setup.py sdist bdist_wheel
python -m twine upload dist/*
```
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
45 changes: 45 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys

sys.path.append(os.path.abspath(os.path.join("..", "..")))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "weatherrouting"
copyright = "2017-2024, Davide Gessa (dakk)"
author = "Davide Gessa (dakk)"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"sphinx_rtd_dark_mode",
"sphinx_rtd_theme",
"myst_nb",
]

templates_path = ["_templates"]
exclude_patterns = []
autodoc_source_dir = [
"../weatherrouting",
]
pygments_style = "lightbulb"
default_dark_mode = False

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]


# autosummary_imported_members = True
autosummary_generate = True
29 changes: 29 additions & 0 deletions docs/source/generated/weatherrouting.grib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
weatherrouting.grib
===================

.. automodule:: weatherrouting.grib











.. rubric:: Classes

.. autosummary::

Grib









29 changes: 29 additions & 0 deletions docs/source/generated/weatherrouting.polar.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
weatherrouting.polar
====================

.. automodule:: weatherrouting.polar











.. rubric:: Classes

.. autosummary::

Polar









Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
weatherrouting.routers.linearbestisorouter
==========================================

.. automodule:: weatherrouting.routers.linearbestisorouter











.. rubric:: Classes

.. autosummary::

LinearBestIsoRouter









Loading

0 comments on commit 4cf2978

Please sign in to comment.