Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the docs #16

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5e08ef6
switch to furo theme
mcflugen Oct 10, 2022
118721e
add landlab logo that has transparency
mcflugen Oct 10, 2022
65c57dd
add landlab favicon
mcflugen Oct 10, 2022
92c2076
add a contributing section
mcflugen Oct 10, 2022
b5668dc
add a quickstart section
mcflugen Oct 10, 2022
c3734c5
add docs for authors, changes, license
mcflugen Oct 10, 2022
8ccba39
update main index page
mcflugen Oct 10, 2022
da9bea9
add an extras section for docs requirements
mcflugen Oct 10, 2022
5de36a7
add a readthedocs config file
mcflugen Oct 10, 2022
05bf3b6
upgrade to python 3.8+ syntax
mcflugen Oct 10, 2022
85e3f01
add workflow to build the docs
mcflugen Oct 10, 2022
31ded58
add a nox file
mcflugen Oct 10, 2022
1ee3774
add a code copy button to the docs
mcflugen Oct 11, 2022
c0b7643
reorganize docs pages
mcflugen Oct 12, 2022
22b6207
add intersphinx mapping for landlab
mcflugen Oct 12, 2022
fd02f3b
add a live-docs session
mcflugen Oct 12, 2022
dd40f01
remove lint--mostly trailing whitespace
mcflugen Oct 12, 2022
d23d23a
add a pre-commit config file
mcflugen Oct 12, 2022
48cf938
import intro section for the readme
mcflugen Oct 12, 2022
98295a1
run lint with nox; combine with black workflow
mcflugen Oct 12, 2022
25326d9
add pyupgrade to pre-commit hooks
mcflugen Oct 12, 2022
92d3002
add pytest-xdist to dev requirements
mcflugen Oct 12, 2022
da4c533
run CI tests with nox
mcflugen Oct 12, 2022
01b72f9
fix nox test session
mcflugen Oct 12, 2022
e04a3b5
upgrade to python 3.8+ syntax
mcflugen Oct 12, 2022
3790db8
update requirements files
mcflugen Oct 12, 2022
73fd4a2
fix path to files for pydocstyle
mcflugen Oct 12, 2022
560ec38
add flask docs to intersphinx mapping
mcflugen Oct 12, 2022
14e2f75
add some minimal docstrings
mcflugen Oct 12, 2022
47518ae
add an api folder to hold auto-generated api docs
mcflugen Oct 12, 2022
86d83bf
run sphinx-apidocs before building docs
mcflugen Oct 12, 2022
8afc890
add a requirements file for the dev extra
mcflugen Oct 12, 2022
3f3ecb4
run sphinx-apidoc as part of pre_build step
mcflugen Oct 12, 2022
0fe3ffc
set python version as a string
mcflugen Oct 13, 2022
655db89
remove python.version
mcflugen Oct 13, 2022
4a2770a
add a workflow to check for towncrier news fragments
mcflugen Oct 13, 2022
44a0858
add news fragments
mcflugen Oct 13, 2022
179ef42
add some badges for the docs
mcflugen Oct 13, 2022
80cae0c
add a link to landlab-rest on rtfd
mcflugen Oct 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/black.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
check-changelog-entry:
name: changelog entry
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
fetch-depth: 0

- name: Check changelog
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
run: |
if ! pipx run towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please see https://landlab.readthedocs.io/en/master/development/contribution/index.html?highlight=towncrier#news-entries for guidance."
false
fi
38 changes: 38 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Documentation

on: [push, pull_request]

jobs:
build:
name: Build documentation
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
channels: conda-forge
channel-priority: true

- name: Show conda installation info
run: |
conda info

- name: Install dependencies
run: pip install nox

- name: Build documentation
run: nox -s build-docs
6 changes: 3 additions & 3 deletions .github/workflows/flake8.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flake8
name: Lint

on: [push, pull_request]

Expand All @@ -23,5 +23,5 @@ jobs:

- name: Lint
run: |
pip install flake8
flake8 landlab_rest tests
pip install nox
nox -s lint
19 changes: 4 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,16 @@ jobs:
channels: conda-forge
channel-priority: true


- name: Show conda installation info
run: |
conda info
conda list

- name: Install dependencies
run: |
conda install mamba -c conda-forge
mamba install --file=requirements.txt

- name: Build and install package
run: |
pip install -e .

- name: Install testing requirements
run: pip install -e .[dev]
run: pip install nox

- name: Test
run: |
python -c 'import landlab_rest; print(landlab_rest.__version__)'
pytest --cov=landlab_rest --cov-report=xml:$(pwd)/coverage.xml -vvv
- name: Build documentation
run: nox -s test

- name: Coveralls
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
Expand Down
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
language_version: python3.8

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==21.8b0]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
files: \.py$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-builtin-literals
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: trailing-whitespace

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
files: landlab_rest/.*\.py$

- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:
- id: pyupgrade
args: [--py38-plus]
26 changes: 26 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2

sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: false

formats:
- htmlzip

python:
# version: "3.8"
install:
- requirements: requirements-docs.txt
- requirements: requirements.txt
- method: pip
path: .
system_packages: false

build:
os: ubuntu-22.04
tools:
python: "3.8"
jobs:
pre_build:
- sphinx-apidoc -e -force --no-toc -o docs/source/api landlab_rest
10 changes: 5 additions & 5 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
=======
Credits
=======

Development Lead
----------------

* Eric Hutton (@mcflugen)
* `Eric Hutton <https://github.com/mcflugen>`_

Contributors
------------

* Jenny Knuth
* Mark Piper
* Greg Tucker

* `Jenny Knuth <https://github.com/jennyknuth>`_
* `Mark Piper <https://github.com/mdpiper>`_
* `Greg Tucker <https://github.com/gregtucker>`_
9 changes: 5 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog for landlab-rest
==========================
=============
Release Notes
=============

.. towncrier-draft-entries:: Not yet released

.. towncrier release notes start

Expand Down Expand Up @@ -45,5 +48,3 @@ Other Changes and Additions
- Set up continuous integration on Travis.org. (`#5 <https://github.com/landlab/landlab-rest/issues/5>`_)
- Added unit tests. (`#5 <https://github.com/landlab/landlab-rest/issues/5>`_)
- Added smoke tests for the command line interface, ``start-sketchbook``. (`#7 <https://github.com/landlab/landlab-rest/issues/7>`_)


4 changes: 2 additions & 2 deletions LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright © `2022` `Landlab`
Copyright (c) `2022` `Eric Hutton`

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand All @@ -22,4 +22,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.
64 changes: 54 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. image:: https://readthedocs.org/projects/landlab-rest/badge/?version=latest
:target: https://landlab-rest.readthedocs.org

.. image:: https://github.com/landlab/landlab-rest/actions/workflows/test.yml/badge.svg
:target: https://github.com/landlab/landlab-rest/actions/workflows/test.yml

Expand All @@ -7,26 +10,65 @@
.. image:: https://github.com/landlab/landlab-rest/actions/workflows/black.yml/badge.svg
:target: https://github.com/landlab/landlab-rest/actions/workflows/black.yml

.. image:: https://github.com/landlab/landlab-rest/actions/workflows/docs.yml/badge.svg
:target: https://github.com/landlab/landlab-rest/actions/workflows/docs.yml

landlab REST
============

A RESTful interface to landlab graphs.
.. start-intro

A web service for creating *Landlab* graph structures. Send
requests to retrieve data (as json objects) that describe *Landlab*
model grids. This includes,

* *x* and *y* coordinates of a grid's nodes and corners
* connectivity the the various grid elements

Currently available grid types include :class:`~landlab.grid.raster.RasterModelGrid`,
:class:`~landlab.grid.hex.HexModelGrid` and :class:`~landlab.grid.radial.RadialModelGrid`.

.. end-intro

For more information, visit `landlab-rest's documentation <https://landlab-rest.readthedocs.org>`_.

Quickstart
----------

Use `conda` to install the necessary requirements and `landlab_rest`,
.. start-quickstart

.. code::
To get started you will need to install the *landlab-rest* package, which is currently distributed
on `PyPI`_.

1. Install *landlab-rest* into your current environment.

.. code:: bash

$ conda install --file=requirements.txt -c conda-forge
$ pip install .
pip install landlab-rest

2. Start the server.

.. code:: bash

start-sketchbook

3. You can now send queries to the *landlab-rest* service.

.. code:: bash

curl https://0.0.0.0:8080/graphs/

.. _PyPI: https://pypi.org/project/landlab-rest/

.. end-quickstart

.. start-running

Start the server,

.. code::

$ start-sketchbook
start-sketchbook

Look at the line containing `Serving on` to see what host and port the
server is running on. Alternatively, you can use the `--host` and `--port`
Expand All @@ -37,19 +79,19 @@ to get a `RasterModelGrid`,

.. code::

$ curl https://0.0.0.0:8080/graphs/raster
curl https://0.0.0.0:8080/graphs/raster

For a list of supported graphs

.. code::

$ curl https://0.0.0.0:8080/graphs/
curl https://0.0.0.0:8080/graphs/

You can pass parameters like,

.. code::

$ curl 'https://0.0.0.0:8080/graphs/raster?shape=4,5&spacing=2.,1.'
curl 'https://0.0.0.0:8080/graphs/raster?shape=4,5&spacing=2.,1.'


Docker
Expand All @@ -72,4 +114,6 @@ Once running, you can then send requests to the server. For example,

.. code::

$ curl https://0.0.0.0/graphs/raster
curl https://0.0.0.0/graphs/raster

.. end-running
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ help:
# 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)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/source/_static/favicon.ico
Binary file not shown.
Binary file added docs/source/_static/landlab_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/source/_templates/links.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ <h3>Useful Links</h3>
<li><a href="https://github.com/landlab//">landlab_rest @ GitHub</a></li>
<li><a href="https://github.com/landlab/landlab_rest/issues">Issue Tracker</a></li>
</ul>

2 changes: 2 additions & 0 deletions docs/source/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# auto-generated with sphinx-apidoc
landlab_*.rst
7 changes: 7 additions & 0 deletions docs/source/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
landlab_rest
============

.. toctree::
:maxdepth: 4

landlab_rest
1 change: 1 addition & 0 deletions docs/source/authors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../../AUTHORS.rst
Loading