Skip to content

Commit

Permalink
Merge pull request #1 from IATI/setup
Browse files Browse the repository at this point in the history
Set up project
  • Loading branch information
tillywoodfield authored May 17, 2024
2 parents 39fc0c2 + 81f84ad commit 0498472
Show file tree
Hide file tree
Showing 25 changed files with 1,930 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI
on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dev requirements
run: pip install -r requirements_dev.txt
- name: Check black
run: black --check iati_sphinx_theme
- name: Check isort
run: isort --check-only iati_sphinx_theme
- name: Check flake8
run: flake8 iati_sphinx_theme
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Python
.ve
__pycache__
dist
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/conf.py
builder: dirhtml

python:
install:
- method: pip
path: .
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# sphinx-theme
# IATI Sphinx Theme

## Development

### Install dependencies
```
pip install -r requirements_dev.txt
```

### Update dependencies
```
python -m piptools compile --extra=dev -o requirements_dev.txt pyproject.toml
pip install -r requirements_dev.txt
```

### Run linting

```
black iati_sphinx_theme
isort iati_sphinx_theme
flake8 iati_sphinx_theme
```

### Documentation with live preview

1. Install the theme locally:
```
pip install -e .
```

2. Start the docs development server:
```
sphinx-autobuild docs docs/_build/html
```
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build
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 = .
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)
29 changes: 29 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "IATI Sphinx Theme"
copyright = "2024 IATI Secretariat"
author = "IATI Secretariat"

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

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.todo",
]

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 = "iati_sphinx_theme"
html_static_path = ["_static"]
10 changes: 10 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=================
IATI Sphinx Theme
=================

.. toctree::
:titlesonly:
:maxdepth: 2
:caption: Table of Contents

kitchen-sink/index
123 changes: 123 additions & 0 deletions docs/kitchen-sink/admonitions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
..
Copyright (c) 2021 Pradyun Gedam
Licensed under Creative Commons Attribution-ShareAlike 4.0 International License
SPDX-License-Identifier: CC-BY-SA-4.0
===========
Admonitions
===========

Sphinx provides several different types of admonitions.

``topic``
=========

.. topic:: This is a topic.

This is what admonitions are a special case of, according to the docutils
documentation.

``admonition``
==============

.. admonition:: The one with the custom titles

It's got a certain charm to it.

``attention``
=============

.. attention::

Climate change is real.

``caution``
===========

.. caution::

Cliff ahead: Don't drive off it.

``danger``
==========

.. danger::

Mad scientist at work!

``error``
=========

.. error::

Does not compute.

``hint``
========

.. hint::

Insulators insulate, until they are subject to ______ voltage.

``important``
=============

.. important::

Tech is not neutral, nor is it apolitical.

``note``
========

.. note::

This is a note.

``seealso``
===========

.. seealso::

Other relevant information.

``tip``
=======

.. tip::

25% if the service is good.

``todo``
========

.. todo::

This needs the ``sphinx.ext.todo`` extension.

``warning``
===========

.. warning::

Reader discretion is strongly advised.

``versionadded``
================

.. versionadded:: v0.1.1

Here's a version added message.

``versionchanged``
==================

.. versionchanged:: v0.1.1

Here's a version changed message.

``deprecated``
==============

.. deprecated:: v0.1.1

Here's a deprecation message.
29 changes: 29 additions & 0 deletions docs/kitchen-sink/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
..
Copyright (c) 2021 Pradyun Gedam
Licensed under Creative Commons Attribution-ShareAlike 4.0 International License
SPDX-License-Identifier: CC-BY-SA-4.0
*****************
API documentation
*****************

Using Sphinx's :ref:`sphinx.ext.autodoc` plugin, it is possible to auto-generate documentation of a Python module.

.. tip::
Avoid having in-function-signature type annotations with autodoc,
by setting the following options:

.. code-block:: python
# -- Options for autodoc ----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
# Automatically extract typehints when specified and place them in
# descriptions of the relevant function/method.
autodoc_typehints = "description"
# Don't show class signature with the class' name.
autodoc_class_signature = "separated"
.. automodule:: urllib.request
:members:
Loading

0 comments on commit 0498472

Please sign in to comment.