Skip to content

Commit 609b10e

Browse files
committed
Refactor docs and switch to RTD theme
Our API docs are much more readable on it. Remove testimonials, they don't serve that much and take up space. Slightly refactor main docs page.
1 parent 9e14962 commit 609b10e

File tree

7 files changed

+36
-63
lines changed

7 files changed

+36
-63
lines changed

README.rst

+4-30
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
2929

30-
.. -spiel-end-
30+
.. teaser-end
3131
3232
For that, it gives you a class decorator and a way to declaratively define the attributes on that class:
3333

@@ -85,35 +85,7 @@ Which in turn encourages you to write *small classes* that do `one thing well <h
8585
Never again violate the `single responsibility principle <https://en.wikipedia.org/wiki/Single_responsibility_principle>`_ just because implementing ``__init__`` et al is a painful drag.
8686

8787

88-
.. -testimonials-
89-
90-
Testimonials
91-
============
92-
93-
**Amber Hawkie Brown**, Twisted Release Manager and Computer Owl:
94-
95-
Writing a fully-functional class using attrs takes me less time than writing this testimonial.
96-
97-
98-
**Glyph Lefkowitz**, creator of `Twisted <https://twistedmatrix.com/>`_, `Automat <https://pypi.org/project/Automat/>`_, and other open source software, in `The One Python Library Everyone Needs <https://glyph.twistedmatrix.com/2016/08/attrs.html>`_:
99-
100-
I’m looking forward to is being able to program in Python-with-attrs everywhere.
101-
It exerts a subtle, but positive, design influence in all the codebases I’ve see it used in.
102-
103-
104-
**Kenneth Reitz**, creator of `Requests <https://github.com/psf/requests>`_ (`on paper no less <https://twitter.com/hynek/status/866817877650751488>`_!):
105-
106-
attrs—classes for humans. I like it.
107-
108-
109-
**Łukasz Langa**, creator of `Black <https://github.com/psf/black>`_, prolific Python core developer, and release manager for Python 3.8 and 3.9:
110-
111-
I'm increasingly digging your attr.ocity. Good job!
112-
113-
114-
.. -end-
115-
116-
.. -project-information-
88+
.. -getting-help-
11789
11890
Getting Help
11991
============
@@ -123,6 +95,8 @@ Please use the ``python-attrs`` tag on `StackOverflow <https://stackoverflow.com
12395
Answering questions of your fellow developers is also great way to help the project!
12496

12597

98+
.. -project-information-
99+
126100
Project Information
127101
===================
128102

docs/_static/attrs_logo_white.png

5.45 KB
Loading

docs/conf.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,15 @@ def find_version(*file_paths):
9292
# The theme to use for HTML and HTML Help pages. See the documentation for
9393
# a list of builtin themes.
9494

95-
html_theme = "alabaster"
95+
html_theme = "sphinx_rtd_theme"
9696
html_theme_options = {
97-
"font_family": '"Avenir Next", Calibri, "PT Sans", sans-serif',
98-
"head_font_family": '"Avenir Next", Calibri, "PT Sans", sans-serif',
99-
"font_size": "18px",
100-
"page_width": "980px",
101-
"show_relbars": True,
97+
"canonical_url": "https://www.attrs.org/",
98+
"logo_only": True,
10299
}
103100

104101
# The name of an image file (relative to this directory) to place at the top
105102
# of the sidebar.
106-
html_logo = "_static/attrs_logo.svg"
103+
html_logo = "_static/attrs_logo_white.png"
107104

108105
# The name of an image file (within the static path) to use as favicon of the
109106
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32

docs/index.rst

+17-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Release v\ |release| (`What's new? <changelog>`).
66

77
.. include:: ../README.rst
88
:start-after: teaser-begin
9-
:end-before: -spiel-end-
9+
:end-before: teaser-end
1010

1111

1212
Getting Started
@@ -17,7 +17,7 @@ The recommended installation method is `pip <https://pip.pypa.io/en/stable/>`_-i
1717

1818
.. code-block:: console
1919
20-
$ pip install attrs
20+
$ python -m pip install attrs
2121
2222
The next three steps should bring you up and running in no time:
2323

@@ -49,20 +49,8 @@ Day-to-Day Usage
4949

5050

5151
.. include:: ../README.rst
52-
:start-after: -testimonials-
53-
:end-before: -end-
54-
55-
.. include:: ../README.rst
56-
:start-after: -project-information-
57-
58-
.. toctree::
59-
:maxdepth: 1
60-
61-
license
62-
backward-compatibility
63-
python-2
64-
contributing
65-
changelog
52+
:start-after: -getting-help-
53+
:end-before: -project-information-
6654

6755

6856
----
@@ -86,6 +74,19 @@ Full Table of Contents
8674
glossary
8775

8876

77+
.. include:: ../README.rst
78+
:start-after: -project-information-
79+
80+
.. toctree::
81+
:maxdepth: 1
82+
83+
license
84+
backward-compatibility
85+
python-2
86+
contributing
87+
changelog
88+
89+
8990
Indices and tables
9091
==================
9192

docs/overview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In order to fulfill its ambitious goal of bringing back the joy to writing class
66

77
.. include:: ../README.rst
88
:start-after: -code-begin-
9-
:end-before: -testimonials-
9+
:end-before: -getting-help-
1010

1111

1212
.. _philosophy:

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
]
3737
INSTALL_REQUIRES = []
3838
EXTRAS_REQUIRE = {
39-
"docs": ["sphinx", "zope.interface"],
39+
"docs": ["sphinx", "sphinx-rtd-theme", "zope.interface"],
4040
"tests": [
4141
# 5.0 introduced toml; parallel was broken until 5.0.2
4242
"coverage[toml]>=5.0.2",

src/attr/_make.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def attrib(
134134
135135
:type default: Any value
136136
137-
:param callable factory: Syntactic sugar for
138-
``default=attr.Factory(callable)``.
137+
:param factory: Syntactic sugar for ``default=attr.Factory(callable)``.
138+
:type factory: `callable`
139139
140140
:param validator: `callable` that is called by ``attrs``-generated
141141
``__init__`` methods after the instance has been initialized. They
@@ -145,15 +145,15 @@ def attrib(
145145
The return value is *not* inspected so the validator has to throw an
146146
exception itself.
147147
148-
If a ``list`` is passed, its items are treated as validators and must
148+
If a `list` is passed, its items are treated as validators and must
149149
all pass.
150150
151151
Validators can be globally disabled and re-enabled using
152152
`get_run_validators`.
153153
154154
The validator can also be set using decorator notation as shown below.
155155
156-
:type validator: ``callable`` or a ``list`` of ``callable``\\ s.
156+
:type validator: `callable` or a `list` of `callable`\\ s.
157157
158158
:param repr: Include this attribute in the generated ``__repr__``
159159
method. If ``True``, include the attribute; if ``False``, omit it. By
@@ -162,7 +162,7 @@ def attrib(
162162
value and returns a string. Note that the resulting string is used
163163
as-is, i.e. it will be used directly *instead* of calling ``repr()``
164164
(the default).
165-
:type repr: a ``bool`` or a ``callable`` to use a custom function.
165+
:type repr: a `bool` or a `callable` to use a custom function.
166166
:param bool eq: If ``True`` (default), include this attribute in the
167167
generated ``__eq__`` and ``__ne__`` methods that check two instances
168168
for equality.
@@ -174,16 +174,17 @@ def attrib(
174174
method. If ``None`` (default), mirror *eq*'s value. This is the
175175
correct behavior according the Python spec. Setting this value to
176176
anything else than ``None`` is *discouraged*.
177-
:type hash: ``bool`` or ``None``
177+
:type hash: `bool` or `None`
178178
:param bool init: Include this attribute in the generated ``__init__``
179179
method. It is possible to set this to ``False`` and set a default
180180
value. In that case this attributed is unconditionally initialized
181181
with the specified default value or factory.
182-
:param callable converter: `callable` that is called by
182+
:param converter: `callable` that is called by
183183
``attrs``-generated ``__init__`` methods to convert attribute's value
184184
to the desired format. It is given the passed-in value, and the
185185
returned value will be used as the new value of the attribute. The
186186
value is converted before being passed to the validator, if any.
187+
:type converter: `callable`
187188
:param metadata: An arbitrary mapping, to be used by third-party
188189
components. See `extending_metadata`.
189190
:param type: The type of the attribute. In Python 3.6 or greater, the
@@ -856,7 +857,7 @@ def attrs(
856857
`object.__hash__`, and the `GitHub issue that led to the default \
857858
behavior <https://github.com/python-attrs/attrs/issues/136>`_ for more
858859
details.
859-
:type hash: ``bool`` or ``None``
860+
:type hash: `bool` or `None`
860861
:param bool init: Create a ``__init__`` method that initializes the
861862
``attrs`` attributes. Leading underscores are stripped for the
862863
argument name. If a ``__attrs_post_init__`` method exists on the

0 commit comments

Comments
 (0)