Skip to content

Commit 140e863

Browse files
authored
fix: Docs build (#71)
* Added description content type * Change version on docs with bumpversion * Updated docs build & theme * Update repo URL.
1 parent ab1d10e commit 140e863

File tree

7 files changed

+184
-23
lines changed

7 files changed

+184
-23
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ __pycache__/
1616
build/
1717
dist/
1818
env/
19+
/*docs/env*/
20+
/*docs/_build*/
1921

2022
local.sqlite

docs/Makefile

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
9+
VENV = env/bin/activate
10+
PORT = 8001
911

1012
# Internal variables.
1113
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -30,34 +32,49 @@ help:
3032
clean:
3133
-rm -rf $(BUILDDIR)/*
3234

35+
install:
36+
@echo "... setting up virtualenv"
37+
python3 -m venv env
38+
. $(VENV); pip install -r requirements.txt
39+
40+
@echo "\n" \
41+
"-------------------------------------------------------------------------------------------------- \n" \
42+
"* watch, build and serve the documentation: make run \n" \
43+
"* check spelling: make spelling \n" \
44+
"\n" \
45+
"enchant must be installed in order for pyenchant (and therefore spelling checks) to work. See \n" \
46+
"http://docs.django-cms.org/en/latest/contributing/documentation.html#install-the-spelling-software \n" \
47+
"-------------------------------------------------------------------------------------------------- \n" \
48+
49+
3350
html:
34-
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
51+
. $(VENV); $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
3552
@echo
3653
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
3754

3855
dirhtml:
39-
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
56+
. $(VENV); $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
4057
@echo
4158
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
4259

4360
pickle:
44-
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
61+
. $(VENV); $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
4562
@echo
4663
@echo "Build finished; now you can process the pickle files."
4764

4865
json:
49-
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
66+
. $(VENV); $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
5067
@echo
5168
@echo "Build finished; now you can process the JSON files."
5269

5370
htmlhelp:
54-
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
71+
. $(VENV); $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
5572
@echo
5673
@echo "Build finished; now you can run HTML Help Workshop with the" \
5774
".hhp project file in $(BUILDDIR)/htmlhelp."
5875

5976
qthelp:
60-
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
77+
. $(VENV); $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
6178
@echo
6279
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
6380
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@@ -66,24 +83,27 @@ qthelp:
6683
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-classy-tags.qhc"
6784

6885
latex:
69-
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
86+
. $(VENV); $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
7087
@echo
7188
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
7289
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
7390
"run these through (pdf)latex."
7491

7592
changes:
76-
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
93+
. $(VENV); $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
7794
@echo
7895
@echo "The overview file is in $(BUILDDIR)/changes."
7996

8097
linkcheck:
81-
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
98+
. $(VENV); $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
8299
@echo
83100
@echo "Link check complete; look for any errors in the above output " \
84101
"or in $(BUILDDIR)/linkcheck/output.txt."
85102

86103
doctest:
87-
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
104+
. $(VENV); $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
88105
@echo "Testing of doctests in the sources finished, look at the " \
89106
"results in $(BUILDDIR)/doctest/output.txt."
107+
108+
run:
109+
. $(VENV); sphinx-autobuild $(ALLSPHINXOPTS) build/html --host 0.0.0.0 --port $(PORT)

docs/conf.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
1212

13-
import os
14-
import sys
13+
import datetime
1514

1615

1716
# If extensions (or modules to document with autodoc) are in another directory,
@@ -25,7 +24,9 @@
2524
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2625
extensions = ["sphinx.ext.intersphinx"]
2726

28-
intersphinx_mapping = {'django': ('http://readthedocs.org/projects/eric/django/docs/', None)}
27+
intersphinx_mapping = {
28+
'django': ('https://docs.djangoproject.com/en/3.2/', 'https://docs.djangoproject.com/en/3.2/_objects/'),
29+
}
2930

3031
# Add any paths that contain templates here, relative to this directory.
3132
templates_path = ['_templates']
@@ -39,18 +40,19 @@
3940
# The master toctree document.
4041
master_doc = 'index'
4142

43+
current_year = datetime.datetime.now().year
4244
# General information about the project.
4345
project = 'django-classy-tags'
44-
copyright = '2010, Jonas Obrist'
46+
copyright = f'2010-{current_year}, Jonas Obrist'
4547

4648
# The version info for the project you're documenting, acts as replacement for
4749
# |version| and |release|, also used in various other places throughout the
4850
# built documents.
4951
#
5052
# The short X.Y version.
51-
version = '0.3'
53+
version = '3.0.0'
5254
# The full version, including alpha/beta/rc tags.
53-
release = '0.3.0'
55+
release = '3.0.0'
5456

5557
# The language for content autogenerated by Sphinx. Refer to documentation
5658
# for a list of supported languages.
@@ -94,7 +96,15 @@
9496

9597
# The theme to use for HTML and HTML Help pages. Major themes that come with
9698
# Sphinx are currently 'default' and 'sphinxdoc'.
97-
html_theme = 'default'
99+
try:
100+
import furo
101+
102+
html_theme = 'furo'
103+
html_theme_options = {
104+
"navigation_with_keys": True,
105+
}
106+
except ImportError:
107+
html_theme = 'default'
98108

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

docs/requirements.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MarkupSafe
2+
Pygments
3+
furo
4+
Sphinx>=4.2.0
5+
sphinxcontrib-spelling
6+
pyenchant>3
7+
sphinx-autobuild
8+
datetime
9+
pip-tools

docs/requirements.txt

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#
2+
# This file is autogenerated by pip-compile with python 3.9
3+
# To update, run:
4+
#
5+
# pip-compile
6+
#
7+
--trusted-host pypi.python.org
8+
--trusted-host pypi.org
9+
--trusted-host files.pythonhosted.org
10+
11+
alabaster==0.7.12
12+
# via sphinx
13+
babel==2.9.1
14+
# via sphinx
15+
beautifulsoup4==4.10.0
16+
# via furo
17+
certifi==2021.10.8
18+
# via requests
19+
charset-normalizer==2.0.10
20+
# via requests
21+
click==8.0.3
22+
# via pip-tools
23+
colorama==0.4.4
24+
# via sphinx-autobuild
25+
datetime==4.3
26+
# via -r requirements.in
27+
docutils==0.17.1
28+
# via sphinx
29+
furo==2022.1.2
30+
# via -r requirements.in
31+
idna==3.3
32+
# via requests
33+
imagesize==1.3.0
34+
# via sphinx
35+
importlib-metadata==4.10.1
36+
# via sphinx
37+
jinja2==3.0.3
38+
# via sphinx
39+
livereload==2.6.3
40+
# via sphinx-autobuild
41+
markupsafe==2.0.1
42+
# via
43+
# -r requirements.in
44+
# jinja2
45+
packaging==21.3
46+
# via sphinx
47+
pep517==0.12.0
48+
# via pip-tools
49+
pip-tools==6.4.0
50+
# via -r requirements.in
51+
pyenchant==3.2.2
52+
# via
53+
# -r requirements.in
54+
# sphinxcontrib-spelling
55+
pygments==2.11.2
56+
# via
57+
# -r requirements.in
58+
# furo
59+
# sphinx
60+
pyparsing==3.0.7
61+
# via packaging
62+
pytz==2021.3
63+
# via
64+
# babel
65+
# datetime
66+
requests==2.27.1
67+
# via sphinx
68+
six==1.16.0
69+
# via livereload
70+
snowballstemmer==2.2.0
71+
# via sphinx
72+
soupsieve==2.3.1
73+
# via beautifulsoup4
74+
sphinx==4.4.0
75+
# via
76+
# -r requirements.in
77+
# furo
78+
# sphinx-autobuild
79+
# sphinxcontrib-spelling
80+
sphinx-autobuild==2021.3.14
81+
# via -r requirements.in
82+
sphinxcontrib-applehelp==1.0.2
83+
# via sphinx
84+
sphinxcontrib-devhelp==1.0.2
85+
# via sphinx
86+
sphinxcontrib-htmlhelp==2.0.0
87+
# via sphinx
88+
sphinxcontrib-jsmath==1.0.1
89+
# via sphinx
90+
sphinxcontrib-qthelp==1.0.3
91+
# via sphinx
92+
sphinxcontrib-serializinghtml==1.1.5
93+
# via sphinx
94+
sphinxcontrib-spelling==7.3.2
95+
# via -r requirements.in
96+
tomli==2.0.0
97+
# via pep517
98+
tornado==6.1
99+
# via livereload
100+
urllib3==1.26.8
101+
# via requests
102+
wheel==0.37.1
103+
# via pip-tools
104+
zipp==3.7.0
105+
# via importlib-metadata
106+
zope.interface==5.4.0
107+
# via datetime
108+
109+
# The following packages are considered to be unsafe in a requirements file:
110+
# pip
111+
# setuptools

setup.cfg

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,24 @@ replace = version='{new_version}'
1111
search = __version__ = '{current_version}'
1212
replace = __version__ = '{new_version}'
1313

14+
[bumpversion:file:docs/conf.py]
15+
search = '{current_version}'
16+
replace = '{new_version}'
17+
1418
[bumpversion:file:CHANGELOG.rst]
15-
search =
19+
search =
1620
unreleased
1721
==========
18-
replace =
22+
replace =
1923
unreleased
2024
==========
21-
25+
2226
{new_version} {utcnow:%%Y-%%m-%%d}
2327
================
2428

2529
[flake8]
2630
max-line-length = 119
27-
exclude =
31+
exclude =
2832
*.egg-info,
2933
.eggs,
3034
.env,

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
from pathlib import Path
3+
24
from setuptools import find_packages, setup
35

46

@@ -29,6 +31,8 @@
2931
'Topic :: Software Development :: Libraries',
3032
]
3133

34+
this_directory = Path(__file__).parent
35+
long_description = (this_directory / "README.rst").read_text()
3236

3337
setup(
3438
name='django-classy-tags',
@@ -37,10 +41,11 @@
3741
author_email='[email protected]',
3842
maintainer='Django CMS Association and contributors',
3943
maintainer_email='[email protected]',
40-
url='http://github.com/ojii/django-classy-tags',
44+
url='https://github.com/django-cms/django-classy-tags',
4145
license='BSD',
4246
description='Class based template tags for Django',
43-
long_description=open('README.rst').read(),
47+
long_description=long_description,
48+
long_description_content_type='text/x-rst',
4449
packages=find_packages(exclude=['tests']),
4550
python_requires='>=3.7',
4651
include_package_data=True,

0 commit comments

Comments
 (0)