Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ jobs:
with:
version: "latest"

# Ensure docs build without warnings
# - name: Check docs
# run: uv run --group docs mkdocs build --strict
- name: Ensure docs build without warnings
run: uv run --group docs mkdocs build --strict

# Use ruff-action so we get annotations in the Github UI
- uses: astral-sh/ruff-action@v3
Expand Down
65 changes: 44 additions & 21 deletions .github/workflows/deploy_mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
name: Publish docs via GitHub Pages
name: Publish Python docs

# Only run on new tags starting with `v`
on:
push:
branches:
- main
paths:
# Only rebuild website when docs have changed
- 'README.md'
- 'docs/**'
- 'mkdocs.yml'
- 'rio_stac/**.py'
- .github/workflows/deploy_mkdocs.yml
tags:
- "v*"
workflow_dispatch:

# https://stackoverflow.com/a/77412363
permissions:
contents: write
pages: write

jobs:
build:
name: Deploy docs
name: Deploy Python docs
runs-on: ubuntu-latest
# Used for configuring social plugin in mkdocs.yml
# Unclear if this is always set in github actions
env:
CI: "TRUE"
steps:
- name: Checkout main
uses: actions/checkout@v5
- uses: actions/checkout@v4
# We need to additionally fetch the gh-pages branch for mike deploy
with:
fetch-depth: 0

- name: Set up Python 3.12
uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v5
with:
python-version: 3.12
enable-cache: true

- name: Install dependencies
- name: Deploy docs
env:
GIT_COMMITTER_NAME: CI
GIT_COMMITTER_EMAIL: ci-bot@example.com
run: |
python -m pip install --upgrade pip
python -m pip install -e .["doc"]
# Get most recent git tag
# https://stackoverflow.com/a/7261049
# https://stackoverflow.com/a/3867811
# We don't use {{github.ref_name}} because if triggered manually, it
# will be a branch name instead of a tag version.
VERSION=$(git describe --tags --match="v*" --abbrev=0)
echo $VERSION

- name: Deploy docs
run: mkdocs gh-deploy -f docs/mkdocs.yml --force
# Only push publish docs as latest version if no letters in git tag
# after the first character
# (usually the git tag will have v as the first character)
# Note the `cut` index is 1-ordered
if echo $VERSION | cut -c 2- | grep -q "[A-Za-z]"; then
echo "Is beta version"
# For beta versions publish but don't set as latest
uv run --group docs mike deploy $VERSION --update-aliases --push
else
echo "Is NOT beta version"
uv run --group docs mike deploy $VERSION latest --update-aliases --push
fi
File renamed without changes.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md → DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *b
```bash
$ pre-commit install
```

## Documentation

### Building locally

```
uv run --group docs mkdocs serve
```

### Publishing docs

Documentation is automatically published when a new tag with `v*` is pushed to `main`. Alternatively, you can manually publish docs by triggering the docs publish workflow from the GitHub actions UI.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
1 change: 1 addition & 0 deletions docs/DEVELOP.md
3 changes: 3 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API Documentation

::: async_pmtiles
Binary file added docs/assets/logo_no_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/blog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Blog

1 change: 0 additions & 1 deletion docs/docs/contributing.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/docs/index.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/docs/release-notes.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/index.md
71 changes: 0 additions & 71 deletions docs/mkdocs.yml

This file was deleted.

18 changes: 18 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "base.html" %}

{% block content %}
{% if page.nb_url %}
<a href="{{ page.nb_url }}" title="Download Notebook" class="md-content__button md-icon">
{% include ".icons/material/download.svg" %}
</a>
{% endif %}

{{ super() }}
{% endblock content %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
File renamed without changes.
149 changes: 149 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Project Information
site_name: async-pmtiles
site_description: "Asynchronous PMTiles reader for Python."
site_author: Development Seed

# Repository
repo_name: "developmentseed/async-pmtiles"
repo_url: "http://github.com/developmentseed/async-pmtiles"
edit_uri: "blob/main/docs/"
# Note: trailing slash recommended with mike:
# https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/#publishing-a-new-version
site_url: "https://developmentseed.org/async-pmtiles/"
docs_dir: docs

# Social links
extra:
social:
- icon: "fontawesome/brands/github"
link: "https://github.com/developmentseed"
- icon: "fontawesome/brands/linkedin"
link: "https://www.linkedin.com/company/development-seed"
version:
alias: true
provider: mike

# Layout
nav:
- Home: "index.md"
- Usage: "usage.md"
- API Reference: "api.md"
- Changelog: "CHANGELOG.md"
- Contributing: "DEVELOP.md"

watch:
- src/
- docs/
- README.md

theme:
language: en
name: material
custom_dir: docs/overrides
logo: assets/logo_no_text.png
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
primary: "red"
accent: "light red"
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: "red"
accent: "light red"
toggle:
icon: material/brightness-4
name: Switch to system preference

font:
text: "Nunito Sans"
code: "Fira Code"

features:
- content.code.annotate
- content.code.copy
- navigation.indexes
- navigation.instant
- navigation.tracking
- search.suggest
- search.share

plugins:
- autorefs:
resolve_closest: true
- blog
- search
- social:
enabled: !ENV [CI, false]
- mike:
alias_type: "copy"
canonical_version: "latest"
- mkdocstrings:
enable_inventory: true
handlers:
python:
paths: [src]
options:
docstring_section_style: list
docstring_style: google
inherited_members: true
line_length: 80
separate_signature: true
show_root_heading: true
show_signature_annotations: true
show_source: false
show_symbol_type_toc: true
signature_crossrefs: true
extensions:
- griffe_inherited_docstrings

inventories:
- https://affine.readthedocs.io/en/latest/objects.inv
- https://developmentseed.org/async-tiff/latest/objects.inv
- https://developmentseed.org/morecantile/objects.inv
- https://developmentseed.org/obstore/latest/objects.inv
- https://docs.python.org/3/objects.inv
- https://numpy.org/doc/stable/objects.inv
- https://pyproj4.github.io/pyproj/stable/objects.inv
- https://rasterio.readthedocs.io/en/stable/objects.inv

# https://github.com/developmentseed/titiler/blob/50934c929cca2fa8d3c408d239015f8da429c6a8/docs/mkdocs.yml#L115-L140
markdown_extensions:
- admonition
- attr_list
- codehilite:
guess_lang: false
- def_list
- footnotes
- md_in_html
- pymdownx.arithmatex
- pymdownx.betterem
- pymdownx.caret:
insert: false
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.escapeall:
hardbreak: true
nbsp: true
- pymdownx.magiclink:
hide_protocol: true
repo_url_shortener: true
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
- toc:
permalink: true
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ dev = [
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
]
docs = [
# Workaround for https://github.com/mkdocs/mkdocs/issues/4032
"click<8.3",
"mkdocs-material[imaging]>=9.5.49",
"mkdocs>=1.6.1",
"mkdocstrings[python]>=1.0",
"mike>=2.1.3",
"griffe-inherited-docstrings>=1.0.1",
# We use ruff format ourselves, but mkdocstrings requires black to be
# installed to format signatures in the docs
"black>=26",
]

[tool.ruff]
select = ["ALL"]
Expand Down
Loading