Skip to content

Commit fec5320

Browse files
Use Furo theme for documentation (#12348)
Current readthedoc theme cannot fully utilize the width of browser especially when you are using a wide screen. I am choosing Furo since it's quite popular in python community (pip, black, etc). Other changes: * Use mypy instead of Mypy * Move introduction to index page, which makes better impression for newcomers. Closes #12374
1 parent 1772a4c commit fec5320

File tree

8 files changed

+56
-55
lines changed

8 files changed

+56
-55
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
paths:
99
- 'docs/**'
10+
- 'mypyc/doc/**'
1011
- '**/*.rst'
1112
- '**/*.md'
1213
- CREDITS
@@ -21,7 +22,7 @@ jobs:
2122
- uses: actions/checkout@v2
2223
- uses: actions/setup-python@v2
2324
with:
24-
python-version: '3.7'
25+
python-version: '3.10'
2526
- name: Install tox
2627
run: pip install --upgrade 'setuptools!=50' 'virtualenv>=20.6.0' tox==3.24.5
2728
- name: Setup tox environment

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
paths-ignore:
99
- 'docs/**'
10+
- 'mypyc/doc/**'
1011
- '**/*.rst'
1112
- '**/*.md'
1213
- .gitignore

docs/requirements-docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
sphinx>=4.2.0,<5.0.0
2-
sphinx-rtd-theme>=1.0.0,<2.0.0
2+
furo>=2022.3.4

docs/source/conf.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
master_doc = 'index'
4949

5050
# General information about the project.
51-
project = u'Mypy'
52-
copyright = u'2016, Jukka Lehtosalo'
51+
project = u'mypy'
52+
copyright = u'2012-2022 Jukka Lehtosalo and mypy contributors'
5353

5454
# The version info for the project you're documenting, acts as replacement for
5555
# |version| and |release|, also used in various other places throughout the
@@ -103,13 +103,7 @@
103103

104104
# The theme to use for HTML and HTML Help pages. See the documentation for
105105
# a list of builtin themes.
106-
try:
107-
import sphinx_rtd_theme
108-
except:
109-
html_theme = 'default'
110-
else:
111-
html_theme = 'sphinx_rtd_theme'
112-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
106+
html_theme = "furo"
113107

114108
# Theme options are theme-specific and customize the look and feel of a theme
115109
# further. For a list of options available for each theme, see the
@@ -128,7 +122,7 @@
128122

129123
# The name of an image file (relative to this directory) to place at the top
130124
# of the sidebar.
131-
#html_logo = None
125+
html_logo = "http://mypy-lang.org/static/mypy_light.svg"
132126

133127
# The name of an image file (within the static path) to use as favicon of the
134128
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -187,7 +181,7 @@
187181
#html_file_suffix = None
188182

189183
# Output file base name for HTML help builder.
190-
htmlhelp_basename = 'Mypydoc'
184+
htmlhelp_basename = 'mypydoc'
191185

192186

193187
# -- Options for LaTeX output ---------------------------------------------

docs/source/index.rst

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,43 @@
66
Welcome to mypy documentation!
77
==============================
88

9-
Mypy is a static type checker for Python 3 and Python 2.7.
9+
Mypy is a static type checker for Python 3 and Python 2.7. If you sprinkle
10+
your code with type annotations, mypy can type check your code and find common
11+
bugs. As mypy is a static analyzer, or a lint-like tool, the type
12+
annotations are just hints for mypy and don't interfere when running your program.
13+
You run your program with a standard Python interpreter, and the annotations
14+
are treated effectively as comments.
15+
16+
Using the Python 3 annotation syntax (using :pep:`484` and :pep:`526` notation)
17+
or a comment-based annotation syntax for Python 2 code, you will be able to
18+
efficiently annotate your code and use mypy to check the code for common errors.
19+
Mypy has a powerful and easy-to-use type system with modern features such as
20+
type inference, generics, callable types, tuple types, union types, and
21+
structural subtyping.
22+
23+
As a developer, you decide how to use mypy in your workflow. You can always
24+
escape to dynamic typing as mypy's approach to static typing doesn't restrict
25+
what you can do in your programs. Using mypy will make your programs easier to
26+
understand, debug, and maintain.
27+
28+
This documentation provides a short introduction to mypy. It will help you
29+
get started writing statically typed code. Knowledge of Python and a
30+
statically typed object-oriented language, such as Java, are assumed.
31+
32+
.. note::
33+
34+
Mypy is used in production by many companies and projects, but mypy is
35+
officially beta software. There will be occasional changes
36+
that break backward compatibility. The mypy development team tries to
37+
minimize the impact of changes to user code.
38+
39+
Contents
40+
--------
1041

1142
.. toctree::
1243
:maxdepth: 2
1344
:caption: First steps
1445

15-
introduction
1646
getting_started
1747
existing_code
1848

@@ -74,6 +104,13 @@ Mypy is a static type checker for Python 3 and Python 2.7.
74104
additional_features
75105
faq
76106

107+
.. toctree::
108+
:hidden:
109+
:caption: Project Links
110+
111+
GitHub <https://github.com/python/mypy>
112+
Website <http://mypy-lang.org/>
113+
77114
Indices and tables
78115
==================
79116

docs/source/introduction.rst

Lines changed: 0 additions & 32 deletions
This file was deleted.

mypyc/doc/conf.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# -- Project information -----------------------------------------------------
1818

1919
project = 'mypyc'
20-
copyright = '2020, mypyc team'
20+
copyright = '2020-2022, mypyc team'
2121
author = 'mypyc team'
2222

2323
# The version info for the project you're documenting, acts as replacement for
@@ -50,13 +50,7 @@
5050

5151
# The theme to use for HTML and HTML Help pages. See the documentation for
5252
# a list of builtin themes.
53-
try:
54-
import sphinx_rtd_theme # type: ignore
55-
except:
56-
html_theme = 'default'
57-
else:
58-
html_theme = 'sphinx_rtd_theme'
59-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
53+
html_theme = 'furo'
6054

6155
# Add any paths that contain custom static files (such as style sheets) here,
6256
# relative to this directory. They are copied after the builtin static files,

mypyc/doc/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ generate fast code.
4747

4848
performance_tips_and_tricks
4949

50+
.. toctree::
51+
:hidden:
52+
:caption: Project Links
53+
54+
GitHub <https://github.com/python/mypy>
55+
5056
Indices and tables
5157
==================
5258

0 commit comments

Comments
 (0)