Skip to content

Commit

Permalink
docs: Fix typos in the tutorial and contribution guide (litestar-org#…
Browse files Browse the repository at this point in the history
…3141)

* Fix typo: lowercase after colon or semicolon

* Consistently link to True object

* TODO-list -> TODO list

* TODO-item -> TODO item

* Contribution Guide: fix typos and update links
  • Loading branch information
hugovk authored and robswc committed Feb 27, 2024
1 parent 49b6fd1 commit 89308b9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Guidelines for writing code

- Code should be `Pythonic and zen <https://peps.python.org/pep-0020/>`_
- All code should be fully `typed <https://peps.python.org/pep-0484/>`_. This is enforced via
`mypy <https://mypy.readthedocs.io/en/stable/>`_ and `pyright <https://github.com/microsoft/pyright/>`_
`mypy <https://mypy.readthedocs.io/en/stable/>`_ and `Pyright <https://github.com/microsoft/pyright/>`_

* When requiring complex types, use a `type alias <https://docs.python.org/3/library/typing.html#type-aliases>`_.
Check ``litestar/types`` if a type alias for your use case already exists
Expand All @@ -76,7 +76,7 @@ Guidelines for writing code
across a function or method that doesn't conform to this standard, please update it as you go
- When adding a new public interface, it has to be included in the reference documentation located in
``docs/reference``. If applicable, add or modify examples in the docs related to the new functionality implemented,
following the guidelines established in `Adding examples`_
following the guidelines established in `Adding examples`_.


Writing and running tests
Expand Down Expand Up @@ -115,16 +115,16 @@ Our type checkers are run on Python 3.8 in CI, so you should make sure to run th
Project documentation
---------------------

The documentation is located in the ``/docs`` directory and is `ReST <https://docutils.sourceforge.io/rst.html>`_ and
The documentation is located in the ``/docs`` directory and is `reST <https://docutils.sourceforge.io/rst.html>`_ and
`Sphinx <https://www.sphinx-doc.org/en/master/>`_. If you're unfamiliar with any of those,
`ReStructuredText primer <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_ and
`reStructuredText primer <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_ and
`Sphinx quickstart <https://www.sphinx-doc.org/en/master/usage/quickstart.html>`_ are recommended reads.

Docs theme and appearance
+++++++++++++++++++++++++

We welcome contributions that enhance / improve the appearance and usability of the docs. We use the excellent
`Furo <https://pradyunsg.me/furo/quickstart/>`_ theme, which comes with a lot of options out of the box. If you wish to
`PyData Sphinx Theme <https://pydata-sphinx-theme.readthedocs.io/>`_ theme, which comes with a lot of options out of the box. If you wish to
contribute to the docs style / setup, or static site generation, you should consult the theme docs as a first step.

Running the docs locally
Expand All @@ -142,13 +142,13 @@ Writing and editing docs
We welcome contributions that enhance / improve the content of the docs. Feel free to add examples, clarify text,
restructure the docs, etc., but make sure to follow these guidelines:

- Write text in idiomatic english, using simple language
- Write text in idiomatic English, using simple language
- Opt for `Oxford commas <https://en.wikipedia.org/wiki/Serial_comma>`_ when listing a series of terms
- Keep examples simple and self contained
- Provide links where applicable
- Use `intersphinx <https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_ wherever possible when
referencing external libraries
- Provide diagrams using `mermaidjs <https://mermaid.js.org/>`_ where applicable and possible
- Provide diagrams using `Mermaid <https://mermaid.js.org/>`_ where applicable and possible

Adding examples
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -182,7 +182,7 @@ will be launched, and the requests specified in the comments will be run against
comments will be stripped from the result, and the output of the ``curl`` invocation inserted
after the example code-block.

The ``# run:`` syntax is nothing special; Everything after the colon will be passed to
The ``# run:`` syntax is nothing special; everything after the colon will be passed to
the ``curl`` command that's being invoked. The URL is built automatically, so the
specified path can just be a path relative to the app.

Expand Down Expand Up @@ -237,7 +237,7 @@ Creating a new release

1. Increment the version in ``pyproject.toml`` according to the `versioning scheme <https://litestar.dev/about/litestar-releases#version-numbering>`_
.. note::
The version should follow `semantic versioning <https://semver.org/>`_ and `PEP 440 <https://www.python.org/dev/peps/pep-0440/>`_.
The version should follow `semantic versioning <https://semver.org/>`_ and `PEP 440 <https://peps.python.org/pep-0440/>`_.

2. Commit and push.
2. `Draft a new release <https://github.com/litestar-org/litestar/releases/new>`_ on GitHub
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/todo-app/1-accessing-the-list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Intro
-----

The first thing you'll be setting up for our app is a route handler that returns a
single TODO-list. A TODO-list in this case will be a list of dictionaries representing
single TODO list. A TODO list in this case will be a list of dictionaries representing
the items on that TODO list.

.. literalinclude:: /examples/todo_app/get_list/dict.py
Expand Down Expand Up @@ -64,7 +64,7 @@ Currently ``get_list`` will always return all items on the list, but what if you
are interested in only those items with a specific status, for example all items that
are not yet marked as *done*?

For this you can employ query parameters; To define a query parameter, all that's needed
For this you can employ query parameters; to define a query parameter, all that's needed
is to add an otherwise unused parameter to the function. Litestar will recognize this
and infer that it's going to be used as a query parameter. When a request is being made,
the query parameter will be extracted from the URL, and passed to the function parameter
Expand Down Expand Up @@ -152,7 +152,7 @@ Converting and validating query parameters
++++++++++++++++++++++++++++++++++++++++++

As mentioned earlier, type annotations can be used for more than static type checking
in Litestar; They can also define and configure behaviour. In this case, you can get
in Litestar; they can also define and configure behaviour. In this case, you can get
Litestar to convert the query parameter to a boolean value, matching the values of the
``TodoItem.done`` attribute, and in the same step validate it, returning error responses
for you should the supplied value not be a valid boolean.
Expand Down Expand Up @@ -185,7 +185,7 @@ instead.

.. tip::
It is important to note that this conversion is not the result of calling
:class:`bool` on the raw value. ``bool("john")`` would be ``True``, since Python
:class:`bool` on the raw value. ``bool("john")`` would be :obj:`True`, since Python
considers all non-empty strings to be truthy.

Litestar however supports customary boolean representation commonly used in the HTTP
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/todo-app/2-interacting-with-the-list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ As in the previous chapter, this too can be improved by using


This is not only easier on the eyes and adds more structure to the code, but also gives
better interactive documentation; It will now present us with the field names and
better interactive documentation; it will now present us with the field names and
default values for the dataclass we have defined:

.. figure:: images/swagger-dict-vs-dataclass.png

Documentation for the ``add_item`` route with ``data`` typed as a ``dict`` vs
``dataclass``

Using a dataclass also gives you better validation: Omitting a key such as ``title``
Using a dataclass also gives you better validation: omitting a key such as ``title``
will result in a useful error response:


Expand All @@ -76,7 +76,7 @@ Create dynamic routes using path parameters

The next task on the list is updating an item's status. For this, a way to refer to a
specific item on the list is needed. This could be done using query parameters, but
there's an easier, and more semantically coherent way of expressing this: Path
there's an easier, and more semantically coherent way of expressing this: path
parameters.

.. code-block:: python
Expand All @@ -90,10 +90,10 @@ So far all the paths in your application are static, meaning they are expressed
constant string which does not change. In fact, the only path used so far is ``/``.

Path parameters allow you to construct dynamic paths and later refer to the dynamically
captured parts. This may sound complex at first, but it's actually quite simple; You can
captured parts. This may sound complex at first, but it's actually quite simple; you can
think of it as a regular expression that's being used on the requested path.

Path parameters consist of two parts: An expression inside the path, describing the
Path parameters consist of two parts: an expression inside the path, describing the
parameter, and a corresponding function parameter of the same name in the route handler
function, which will receive the path parameter's value.

Expand All @@ -114,7 +114,7 @@ as ``greeter(name="john")``, similar to how query parameters are injected.

By using this pattern and combining it with those from the earlier section about
receiving data you can now set up a route handler that takes in the title of a
TODO-item, an updated item in form of a dataclass instance, and updates the item in the
TODO item, an updated item in form of a dataclass instance, and updates the item in the
list.


Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/todo-app/3-assembling-the-app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Recap


A route handler set up with ``get("/")`` responds to ``GET`` requests and returns a list
of all items on our TODO-list. The optional query parameter ``done`` allows filtering
of all items on our TODO list. The optional query parameter ``done`` allows filtering
the items by status. The type annotation of ``bool`` converts the query parameter into
a :class:`bool`, and wrapping it in :class:`Optional <typing.Optional>` makes it optional.

Expand All @@ -39,7 +39,7 @@ a :class:`bool`, and wrapping it in :class:`Optional <typing.Optional>` makes it


A route handler set up with ``post("/")`` responds to ``POST`` requests and adds an item
to the TODO-list. The data for the new item is received via the request data, which the
to the TODO list. The data for the new item is received via the request data, which the
route handler accesses by specifying the ``data`` parameter. The type annotation of
``TodoItem`` means the request data will parsed as JSON, which is then used to create an
instance of the ``TodoItem`` dataclass, which - finally - gets passed into the function.
Expand Down

0 comments on commit 89308b9

Please sign in to comment.