Skip to content

Commit

Permalink
Add .editorconfig to standardize formatting of py and rst files
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasLM committed Sep 30, 2021
1 parent 56e9343 commit 8a719cf
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 348 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
@@ -0,0 +1,15 @@
# top-most EditorConfig file
root = true

[*.{py,rst}]
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.py]
max_line_length = 79

[*.rst]
max_line_length = 99
45 changes: 20 additions & 25 deletions doc/hacking/contributing.rst
Expand Up @@ -9,8 +9,8 @@ Pull requests
-------------

The development of Spinach happens on GitHub, the main repository is
`https://github.com/NicolasLM/spinach <https://github.com/NicolasLM/spinach>`_.
To contribute to Spinach:
`https://github.com/NicolasLM/spinach <https://github.com/NicolasLM/spinach>`_. To contribute to
Spinach:

* Fork ``NicolasLM/spinach``
* Clone your fork
Expand All @@ -19,50 +19,45 @@ To contribute to Spinach:
* Push your changes to your fork ``git push origin my_feature``
* Create a GitHub pull request against ``NicolasLM/spinach``'s master branch

.. note:: Avoid including multiple commits in your pull request, unless it adds
value to a future reader. If you need to modify a commit,
``git commit --amend`` is your friend. Write a meaningful commit
message, see `How to write a commit message
<http://chris.beams.io/posts/git-commit/>`_.
.. note:: Avoid including multiple commits in your pull request, unless it adds value to a future
reader. If you need to modify a commit, ``git commit --amend`` is your friend. Write
a meaningful commit message, see `How to write a commit message
<http://chris.beams.io/posts/git-commit/>`_.

Python sources
--------------

The code base follows `pep8 <https://www.python.org/dev/peps/pep-0008/>`_
guidelines with lines wrapping at the 79th character. You can verify that the
code follows the conventions with::
The code base follows `pep8 <https://www.python.org/dev/peps/pep-0008/>`_ guidelines with lines
wrapping at the 79th character. You can verify that the code follows the conventions with::

$ pycodestyle --ignore=E252,W503,W504 spinach tests

Running tests is an invaluable help when adding a new feature or when
refactoring. Try to add the proper test cases in ``tests/`` together with your
patch. The test suite can be run with pytest::
Running tests is an invaluable help when adding a new feature or when refactoring. Try to add the
proper test cases in ``tests/`` together with your patch. The test suite can be run with pytest::

$ pytest tests

Because the Redis broker tests require a running Redis server, there is also a
convenience `tox.ini` that runs all the tests and pep8 checks for you after
starting Redis in a container via docker-compose. Simply running::
Because the Redis broker tests require a running Redis server, there is also a convenience
`tox.ini` that runs all the tests and pep8 checks for you after starting Redis in a container via
docker-compose. Simply running::

$ tox

will build a virtualenv, install Spinach and its dependencies into it,
start the Redis server in the container, and run tests and pycodestyle,
tearing down the Redis server container when done.
will build a virtualenv, install Spinach and its dependencies into it, start the Redis server in
the container, and run tests and pycodestyle, tearing down the Redis server container when done.

Compatibility
-------------

Spinach runs on all versions of Python starting from 3.6. Tests are run via
GitHub actions to ensure that.
Spinach runs on all versions of Python starting from 3.6. Tests are run via GitHub actions to
ensure that.

Documentation sources
---------------------

Documentation is located in the ``doc`` directory of the repository. It is
written in `reStructuredText
<http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_ and
built with `Sphinx <http://www.sphinx-doc.org/en/stable/index.html>`_.
Documentation is located in the ``doc`` directory of the repository. It is written in
`reStructuredText <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_ and built
with `Sphinx <http://www.sphinx-doc.org/en/stable/index.html>`_.

If you modify the docs, make sure it builds without errors::

Expand Down
5 changes: 2 additions & 3 deletions doc/hacking/internals.rst
Expand Up @@ -3,8 +3,7 @@
Internals
=========

This page provides the basic information needed to start reading and modifying
the source code of Spinach. It presents how it works inside and how the project
is designed.
This page provides the basic information needed to start reading and modifying the source code of
Spinach. It presents how it works inside and how the project is designed.

.. todo:: Document how Spinach works internally
19 changes: 8 additions & 11 deletions doc/index.rst
Expand Up @@ -25,20 +25,17 @@ Quickstart

.. literalinclude:: ../examples/quickstart.py

The :class:`Engine` is the central part of Spinach, it allows to define tasks,
schedule jobs to execute in the background and start background workers.
:ref:`More details <engine>`.
The :class:`Engine` is the central part of Spinach, it allows to define tasks, schedule jobs to
execute in the background and start background workers. :ref:`More details <engine>`.

The Broker is the backend that background workers use to retrieve jobs to
execute. Spinach provides two brokers: MemoryBroker for development and
RedisBroker for production.
The Broker is the backend that background workers use to retrieve jobs to execute. Spinach provides
two brokers: MemoryBroker for development and RedisBroker for production.

The :meth:`Engine.task` decorator is used to register tasks. It requires at
least a `name` to identify the task, but other options can be given to
customize how the task behaves. :ref:`More details <tasks>`.
The :meth:`Engine.task` decorator is used to register tasks. It requires at least a `name` to
identify the task, but other options can be given to customize how the task behaves. :ref:`More
details <tasks>`.

Background jobs can then be scheduled by using either the task name or the task
function::
Background jobs can then be scheduled by using either the task name or the task function::

spin.schedule('compute', 5, 3) # identify a task by its name
spin.schedule(compute, 5, 3) # identify a task by its function
Expand Down
4 changes: 2 additions & 2 deletions doc/user/asyncio.rst
Expand Up @@ -45,7 +45,7 @@ Example


.. note:: If an application defines both sync and async tasks, each kind of task should go in its
own :ref:`queue <queues>` so that sync tasks are picked by threaded workers and async
tasks by asyncio workers.
own :ref:`queue <queues>` so that sync tasks are picked by threaded workers and async tasks by
asyncio workers.

.. note:: Not all contrib :ref:`integrations <integrations>` may work with asynchronous workers.

0 comments on commit 8a719cf

Please sign in to comment.