Skip to content

Commit a5f6431

Browse files
author
Sunny Rangnani
committed
configure readthedocs.yml
1 parent e677d46 commit a5f6431

File tree

16 files changed

+538
-42
lines changed

16 files changed

+538
-42
lines changed

.readthedocs.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
# You can also specify other tool versions:
13+
# nodejs: "20"
14+
# rust: "1.70"
15+
# golang: "1.20"
16+
jobs:
17+
post_create_environment:
18+
# Install poetry
19+
# https://python-poetry.org/docs/#installing-manually
20+
- pip install poetry
21+
post_install:
22+
# Install dependencies with 'docs' dependency group
23+
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
24+
# VIRTUAL_ENV needs to be set manually for now.
25+
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
26+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install
27+
28+
# Build documentation in the "docs/" directory with Sphinx
29+
sphinx:
30+
configuration: docs/conf.py
31+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
32+
# builder: "dirhtml"
33+
# Fail on all warnings to avoid broken references
34+
# fail_on_warning: true
35+
36+
# Optionally build your docs in additional formats such as PDF and ePub
37+
formats:
38+
- pdf
39+
- epub
40+
41+
# Optional but recommended, declare the Python requirements required
42+
# to build your documentation
43+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
44+
# python:
45+
# install:
46+
# - requirements: docs/requirements.txt

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2011, SD Elements
1+
Copyright (c), SD Elements
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ doctest:
9191
lint:
9292
poetry run black .
9393
poetry run isort .
94-
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,**/migrations/*,tests/ --statistics --count
94+
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=**/migrations/*,tests/ --statistics --count
9595

9696
bandit:
9797
poetry run bandit -c pyproject.toml -r .

docs/conf.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@
1212
# serve to show the default.
1313

1414
import os
15-
import sys
15+
16+
import django
17+
18+
# import sys
19+
1620

1721
# If extensions (or modules to document with autodoc) are in another directory,
1822
# add these directories to sys.path here. If the directory is relative to the
1923
# documentation root, use os.path.abspath to make it absolute, like shown here.
20-
sys.path.append(os.path.dirname(__file__))
21-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
24+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")
25+
django.setup()
2226

2327
# -- General configuration -----------------------------------------------------
2428

2529
# Add any Sphinx extension module names here, as strings. They can be extensions
2630
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
27-
extensions = [
28-
"sphinx.ext.autodoc",
29-
]
31+
extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme"]
3032

3133
# Add any paths that contain templates here, relative to this directory.
3234
templates_path = ["_templates"]
@@ -42,7 +44,7 @@
4244

4345
# General information about the project.
4446
project = "django-security"
45-
copyright = "2013, SD Elements"
47+
copyright = "2024, SD Elements"
4648

4749
# The version info for the project you're documenting, acts as replacement for
4850
# |version| and |release|, also used in various other places throughout the
@@ -95,7 +97,7 @@
9597

9698
# The theme to use for HTML and HTML Help pages. Major themes that come with
9799
# Sphinx are currently 'default' and 'sphinxdoc'.
98-
html_theme = "default"
100+
html_theme = "sphinx_rtd_theme"
99101

100102
# Theme options are theme-specific and customize the look and feel of a theme
101103
# further. For a list of options available for each theme, see the

poetry.lock

Lines changed: 465 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ ua_parser = "0.18.0"
4646

4747
[tool.poetry.dev-dependencies]
4848
pre-commit = "3.7.1"
49+
# docs
50+
sphinx = "^5.3.0"
51+
sphinx_rtd_theme = "^1.1.1"
52+
readthedocs-sphinx-search = "^0.1.1"
4953
# lint
5054
black = "24.4.2"
5155
flake8 = "7.0.0"

security/auth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright (c) 2011, SD Elements. See LICENSE.txt for details.
2-
31
from django.core.validators import RegexValidator
42
from django.forms import ValidationError
53
from django.utils.translation import gettext as _

security/auth_throttling/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Copyright (c) 2011, SD Elements. See ../LICENSE.txt for details.
2-
31
import hashlib
42
import logging
5-
import time # Monkeypatched by the tests.
3+
import time
64
from math import ceil
75

86
from django.contrib.auth import REDIRECT_FIELD_NAME

security/auth_throttling/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright (c) 2011, SD Elements. See ../LICENSE.txt for details.
2-
31
import logging
42

53
from django.contrib.auth.models import User

security/forms.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright (c) 2011, SD Elements. See LICENSE.txt for details.
2-
31
import django.contrib.auth.forms
42
from django import forms
53
from django.utils.translation import gettext_lazy as _

0 commit comments

Comments
 (0)