Skip to content

Commit

Permalink
chore: Switch docs to furo & add pre-commit (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
marksweb authored Jan 24, 2024
1 parent 409c4bc commit 0080d64
Show file tree
Hide file tree
Showing 11 changed files with 276 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
35 changes: 35 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docs

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest
name: docs
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: python -m pip install -r docs/requirements.txt
- run: python setup.py install
- run: codespell -w *.rst
- run: codespell -w --skip docs/spelling_wordlist docs
- name: Build docs
run: |
cd docs
sphinx-build -b dirhtml -n -d build/doctrees . build/dirhtml
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ci:
autofix_commit_msg: |
ci: auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
autoupdate_schedule: monthly

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/adamchainz/django-upgrade
rev: '1.4.0'
hooks:
- id: django-upgrade
args: [--target-version, "2.2"]

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

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
hooks:
- id: yesqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
20 changes: 20 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.11"

sphinx:
configuration: docs/conf.py
fail_on_warning: false

formats:
- epub
- pdf

python:
install:
- requirements: docs/requirements.txt
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
.venv
13 changes: 11 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -78,7 +78,16 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
try:
import furo

html_theme = 'furo'
html_theme_options = {
"navigation_with_keys": True,
}
except ImportError:
html_theme = 'default'


# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
9 changes: 9 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
furo
Sphinx>=4.2.0
sphinx-copybutton
sphinxext-opengraph
sphinxcontrib-spelling
sphinx-autobuild
codespell
pip-tools
docstrfmt
136 changes: 136 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
#
alabaster==0.7.16
# via sphinx
babel==2.14.0
# via sphinx
beautifulsoup4==4.12.3
# via furo
black==23.12.1
# via docstrfmt
build==1.0.3
# via pip-tools
certifi==2023.11.17
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# black
# docstrfmt
# pip-tools
codespell==2.2.6
# via -r requirements.in
colorama==0.4.6
# via sphinx-autobuild
docstrfmt==1.6.1
# via -r requirements.in
docutils==0.20.1
# via
# docstrfmt
# sphinx
furo==2023.9.10
# via -r requirements.in
idna==3.6
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.3
# via sphinx
libcst==1.1.0
# via docstrfmt
livereload==2.6.3
# via sphinx-autobuild
markupsafe==2.1.4
# via jinja2
mypy-extensions==1.0.0
# via
# black
# typing-inspect
packaging==23.2
# via
# black
# build
# sphinx
pathspec==0.12.1
# via black
pip-tools==7.3.0
# via -r requirements.in
platformdirs==4.1.0
# via
# black
# docstrfmt
pyenchant==3.2.2
# via sphinxcontrib-spelling
pygments==2.17.2
# via
# furo
# sphinx
pyproject-hooks==1.0.0
# via build
pyyaml==6.0.1
# via libcst
requests==2.31.0
# via sphinx
six==1.16.0
# via livereload
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.5
# via beautifulsoup4
sphinx==7.2.6
# via
# -r requirements.in
# docstrfmt
# furo
# sphinx-autobuild
# sphinx-basic-ng
# sphinx-copybutton
# sphinxcontrib-spelling
# sphinxext-opengraph
sphinx-autobuild==2021.3.14
# via -r requirements.in
sphinx-basic-ng==1.0.0b2
# via furo
sphinx-copybutton==0.5.2
# via -r requirements.in
sphinxcontrib-applehelp==1.0.8
# via sphinx
sphinxcontrib-devhelp==1.0.6
# via sphinx
sphinxcontrib-htmlhelp==2.0.5
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.7
# via sphinx
sphinxcontrib-serializinghtml==1.1.10
# via sphinx
sphinxcontrib-spelling==8.0.0
# via -r requirements.in
sphinxext-opengraph==0.9.1
# via -r requirements.in
tabulate==0.9.0
# via docstrfmt
toml==0.10.2
# via docstrfmt
tornado==6.4
# via livereload
typing-extensions==4.9.0
# via
# libcst
# typing-inspect
typing-inspect==0.9.0
# via libcst
urllib3==2.1.0
# via requests
wheel==0.42.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exclude =
**/migrations/,
build/,
.tox/,
docs/conf.py,
node_modules/,

[isort]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


INSTALL_REQUIREMENTS = [
"Django>=2.2,<4.0",
"Django>=2.2",
"django-cms",
"django-sekizai>=0.7",
"django-admin-sortable2>=0.6.4",
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements/dj32_cms40.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

Django>=3.2,<4.0

django-admin-sortable2
django-admin-sortable2<2
django_polymorphic

0 comments on commit 0080d64

Please sign in to comment.