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
61 changes: 61 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Documentation

on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'stac_check/**/*.py'
- 'README.md'
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- 'stac_check/**/*.py'
- 'README.md'
# Allow manual triggering
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
- name: Build documentation
run: |
sphinx-build -b html docs/ docs/_build/html
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/_build/html
retention-days: 7

# Only deploy when pushing to main (not on PRs)
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download built documentation
uses: actions/download-artifact@v4
with:
name: documentation
path: ./docs-build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs-build
force_orphan: true
commit_message: "Update documentation [skip ci]"
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)

## Unreleased

### Changed

- Migrated documentation from Read the Docs to GitHub Pages ([#128](https://github.com/stac-utils/stac-check/pull/128))
- Updated documentation build system to use Sphinx with sphinx_rtd_theme
- Added support for Markdown content in documentation using myst-parser
- Updated README with instructions for building documentation locally
- Added GitHub Actions workflow for automatic documentation deployment

## [v1.7.0] - 2025-06-01

### Added
Expand Down
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
FROM python:3.9-slim

WORKDIR /app

# Install build tools and dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
make \
build-essential \
&& rm -rf /var/lib/apt/lists/*

COPY . .

RUN pip install -e .
# Install the package in development mode with dev and docs extras
RUN pip install -e ".[dev,docs]"

CMD ["stac_check"]
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ run_docker = docker run -it --rm \
.PHONY: shell
shell:
$(run_docker) /bin/bash

.PHONY: docs
docs: ## Build documentation locally
pip install -e ".[docs]"
sphinx-build -b html -E docs/ docs/_build/html
@echo "Documentation built in docs/_build/html"

.PHONY: docker-docs
docker-docs: ## Build documentation inside Docker container
docker build -t stac_check .
docker run --rm -v $(PWD)/docs/_build:/app/docs/_build stac_check sphinx-build -b html -E docs/ docs/_build/html
@echo "Documentation built in docs/_build/html"
@echo "Docker documentation build complete."
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- markdownlint-disable MD033 MD041 -->

<p align="left">
<img src="assets/stac-check.png" width=560>
<img src="https://raw.githubusercontent.com/stac-utils/stac-check/main/assets/stac-check.png" width=560>
</p>

[![Downloads](https://static.pepy.tech/badge/stac-check?color=blue)](https://pepy.tech/project/stac-check)
Expand Down Expand Up @@ -45,7 +45,28 @@ The intent of this project is to provide a validation tool that also follows the

## Documentation

[stac-check.readthedocs.io](https://stac-check.readthedocs.io/en/latest/)
The documentation is hosted on GitHub Pages at [stac-utils.github.io/stac-check](https://stac-utils.github.io/stac-check/).

### Building Documentation Locally

To build the documentation locally:

```bash
# Install the package with documentation dependencies
pip install -e ".[docs]"

# Build the documentation
make docs
```

The built documentation will be available in the `docs/_build/html` directory.

Alternatively, you can build the documentation using Docker:

```bash
# Build the Docker image and documentation
make docker-docs
```

## Installation

Expand Down
Binary file added docs/_static/radiant-earth.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/stac-check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 37 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
Expand All @@ -8,25 +6,58 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

# -- Options for including images from README ----------------------------------
import os
import shutil

project = "stac-check"
copyright = "2025, Jonathan Healy"
author = "Jonathan Healy"
release = "1.5.0"

release = "1.7.0"

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

extensions: List[str] = []
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_rtd_theme",
"sphinx.ext.intersphinx",
"myst_parser",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

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

html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"
html_static_path = []

# Create _static directory if it doesn't exist
static_dir = os.path.join(os.path.dirname(__file__), "_static")
if not os.path.exists(static_dir):
os.makedirs(static_dir)

# Copy assets from project root to _static directory
assets_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "assets")
if os.path.exists(assets_dir):
for file in os.listdir(assets_dir):
src = os.path.join(assets_dir, file)
dst = os.path.join(static_dir, file)
if os.path.isfile(src):
shutil.copy2(src, dst)

# Now that we've copied files, update static path
html_static_path = ["_static"]

myst_heading_anchors = 3 # Generate anchors for h1, h2, and h3

# Configure myst-parser to handle images
myst_url_schemes = ("http", "https", "mailto", "ftp")

html_css_files = [
"custom.css",
]
117 changes: 14 additions & 103 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,112 +1,23 @@
``stac-check`` documentation
############################

``stac-check`` is a linting and validation tool for STAC assets.
.. include:: ../README.md
:parser: myst_parser.sphinx_
:start-after: # stac-check
:end-before: ## License

``stac-check`` is both a CLI tool and Python library. It adds additional linting and validation to the `stac-validator <https://github.com/stac-utils/stac-validator>`_ project.

The intent of this project is to provide a linting tool that also follows the official `STAC Best Practices document <https://github.com/radiantearth/stac-spec/blob/master/best-practices.md>`_.

This project was originally built with funding from the `Radiant Earth Foundation <https://radiant.earth/>`_ and further support has been provided by `Sparkgeo <https://sparkgeo.com/>`_ as well as other contributors.

Installation
------------

``stac-check`` can be installed from `pypi <https://pypi.org/project/stac-check/>`_:

.. code-block:: bash

$ pip install stac-check

to install for local development:

.. code-block:: bash

$ pip install -e .


CLI Usage
---------

``stac-check`` can be used as a Python library or a command line tool.

.. code-block:: shell

$ stac-check --help

Usage: stac-check [OPTIONS] FILE

Options:
--version Show the version and exit.
-l, --links Validate links for format and response.
-a, --assets Validate assets for format and response.
-m, --max-depth INTEGER Maximum depth to traverse when recursing. Omit this
argument to get full recursion. Ignored if
`recursive == False`.
-r, --recursive Recursively validate all related stac objects.
--no-assets-urls Disables the opening of href links when validating assets
(enabled by default).
--header KEY VALUE HTTP header to include in the requests. Can be used
multiple times.
--help Show this message and exit. Show this message and exit.

Examples
~~~~~~~~

.. code-block:: shell

$ stac-check sample_files/0.9.0/landsat8-sample.json


Python Library Usage
--------------------

``stac-check`` can be used as a library to validate and lint STAC Items, Collections, and Catalogs.
It can be used with local or remotely-hosted STAC objects as well as STAC objects represented as a Python dictionary.

Example - lint dictionary
~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: shell

from stac_check.lint import Linter

dict = {
"stac_version": "1.0.0",
"stac_extensions": [],
"type": "Feature",
"id": "20201211_223832_CS2",
"bbox": [
172.91173669923782,
1.3438851951615003,
172.95469614953714,
1.3690476620161975
],
"geometry": {
...
}
linter = Linter(file, assets=True)

for k,v in linter.create_best_practices_dict().items():
print(k,":",v)

STAC Versions supported
~~~~~~~~~~~~~~~~~~~~~~~

``stac-check`` supports the following STAC versions:

``[0.8.0, 0.8.1, 0.9.0, 1.0.0-beta.1, 1.0.0-beta.2, 1.0.0-rc.1, 1.0.0-rc.2, 1.0.0-rc.3, 1.0.0-rc.4, 1.0.0, 1.1.0]``
For more detailed documentation, please see the following pages:

.. toctree::
:maxdepth: 1

api
cli

:maxdepth: 2
:caption: Contents:

cli
api

.. Indices and tables
.. ==================
Indices and tables
=================

.. * :ref:`genindex`
.. * :ref:`modindex`
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
12 changes: 4 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
click>=8.0.0
requests>=2.19.1
jsonschema>=3.1.2b0
pytest>=6.2.4
stac-validator>=3.1.0
PyYAML>=5.4.1
python-dotenv>=0.17.1
types-setuptools>=57.4.0
sphinx>=4.0.0
sphinx_rtd_theme>=1.0.0
myst-parser>=0.18.0
sphinx-autodoc-typehints>=1.18.0
7 changes: 0 additions & 7 deletions pdoc/index.html

This file was deleted.

46 changes: 0 additions & 46 deletions pdoc/search.js

This file was deleted.

Loading