Skip to content

Commit

Permalink
Version 0.23.0 (#1854)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Jun 15, 2024
1 parent efc1d24 commit b3a3967
Show file tree
Hide file tree
Showing 26 changed files with 196 additions and 242 deletions.
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = dotenv-linter
SPHINXPROJ = returns
SOURCEDIR = .
BUILDDIR = _build

Expand Down
5 changes: 0 additions & 5 deletions docs/_templates/layout.html

This file was deleted.

17 changes: 0 additions & 17 deletions docs/_templates/moreinfo.html

This file was deleted.

41 changes: 8 additions & 33 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
import os
import sys

import tomli

sys.path.insert(0, os.path.abspath('..'))


# -- Project information -----------------------------------------------------

def _get_project_meta() -> str:
import tomlkit # noqa: WPS433

with open('../pyproject.toml') as pyproject:
file_contents = pyproject.read()

return tomlkit.parse(file_contents)['tool']['poetry']
def _get_project_meta():
with open('../pyproject.toml', mode='rb') as pyproject:
return tomli.load(pyproject)['tool']['poetry']


pkg_meta = _get_project_meta()
Expand Down Expand Up @@ -60,9 +58,6 @@ def _get_project_meta() -> str:

# Used to build graphs:
'sphinxcontrib.mermaid',

# Used to generate tooltips for our references:
'hoverxref.extension',
]

autoclass_content = 'class'
Expand All @@ -79,10 +74,6 @@ def _get_project_meta() -> str:
# https://pypi.org/project/sphinx-autodoc-typehints/
always_document_param_types = True

# See https://sphinx-hoverxref.readthedocs.io/en/latest/configuration.html
hoverxref_auto_ref = True
hoverxref_domains = ['py']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down Expand Up @@ -116,20 +107,12 @@ def _get_project_meta() -> str:

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_typlog_theme'
html_theme = 'furo'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'logo_name': 'returns',
'description': (
'Make your functions return something meaningful, typed, and safe!'
),
'github_user': 'dry-python',
'github_repo': 'returns',
'color': '#E8371A',
}
html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -138,15 +121,7 @@ def _get_project_meta() -> str:

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
html_sidebars = {
'**': [
'logo.html',
'globaltoc.html',
'github.html',
'searchbox.html',
'moreinfo.html',
],
}
html_sidebars = {}


# -- Extension configuration -------------------------------------------------
Expand Down
30 changes: 15 additions & 15 deletions docs/pages/container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ And we can see how this state is evolving during the execution.
.. mermaid::
:caption: State evolution.

graph LR
F1["Container(Initial)"] --> F2["Container(UserId(1))"]
F2 --> F3["Container(UserAccount(156))"]
F3 --> F4["Container(FailedLoginAttempt(1))"]
F4 --> F5["Container(SentNotificationId(992))"]
graph LR
F1["Container(Initial)"] --> F2["Container(UserId(1))"]
F2 --> F3["Container(UserAccount(156))"]
F3 --> F4["Container(FailedLoginAttempt(1))"]
F4 --> F5["Container(SentNotificationId(992))"]


Working with a container
Expand All @@ -68,11 +68,11 @@ Here's how it looks:
.. mermaid::
:caption: Illustration of ``map`` method.

graph LR
F1["Container[A]"] -- "map(function)" --> F2["Container[B]"]
graph LR
F1["Container[A]"] -- "map(function)" --> F2["Container[B]"]

style F1 fill:green
style F2 fill:green
style F1 fill:green
style F2 fill:green

.. code:: python
Expand Down Expand Up @@ -108,13 +108,13 @@ Here's how it looks:
.. mermaid::
:caption: Illustration of ``bind`` method.

graph LR
F1["Container[A]"] -- "bind(function)" --> F2["Container[B]"]
F1["Container[A]"] -- "bind(function)" --> F3["Container[C]"]
graph LR
F1["Container[A]"] -- "bind(function)" --> F2["Container[B]"]
F1["Container[A]"] -- "bind(function)" --> F3["Container[C]"]

style F1 fill:green
style F2 fill:green
style F3 fill:red
style F1 fill:green
style F2 fill:green
style F3 fill:red

.. code:: python
Expand Down
12 changes: 6 additions & 6 deletions docs/pages/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ There's how execution flows:
.. mermaid::
:caption: RequiresContext execution flow.

graph LR
F1["first(1)"] --> F2["RequiresContext(inner)"]
F2 --> F3
F3["container('abc')"] --> F4["True"]
F4 --> F5
F5["bool_to_str(True)"] --> F6["'ok'"]
graph LR
F1["first(1)"] --> F2["RequiresContext(inner)"]
F2 --> F3
F3["container('abc')"] --> F4["True"]
F4 --> F5
F5["bool_to_str(True)"] --> F6["'ok'"]

The rule is: the dependencies are injected at the very last moment in time.
And then normal logical execution happens.
Expand Down
36 changes: 9 additions & 27 deletions docs/pages/contrib/mypy_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,64 +91,46 @@ Plugin definition
~~~~~~~~~~~~~~~~~

.. automodule:: returns.contrib.mypy._consts
:members:
:members:

.. autoclasstree:: returns.contrib.mypy.returns_plugin
:strict:
:strict:

.. automodule:: returns.contrib.mypy.returns_plugin
:members:
:members:

Kind
~~~~

.. autoclasstree:: returns.contrib.mypy._features.kind
:strict:

.. automodule:: returns.contrib.mypy._features.kind
:members:
:members:

Curry
~~~~~

.. autoclasstree:: returns.contrib.mypy._features.curry
:strict:

.. automodule:: returns.contrib.mypy._features.curry
:members:
:members:

Partial
~~~~~~~

.. autoclasstree:: returns.contrib.mypy._features.partial
:strict:

.. automodule:: returns.contrib.mypy._features.partial
:members:
:members:

Flow
~~~~

.. autoclasstree:: returns.contrib.mypy._features.flow
:strict:

.. automodule:: returns.contrib.mypy._features.flow
:members:
:members:

Pipe
~~~~

.. autoclasstree:: returns.contrib.mypy._features.pipe
:strict:

.. automodule:: returns.contrib.mypy._features.pipe
:members:
:members:

Do notation
~~~~~~~~~~~

.. autoclasstree:: returns.contrib.mypy._features.do_notation
:strict:

.. automodule:: returns.contrib.mypy._features.do_notation
:members:
:members:
62 changes: 31 additions & 31 deletions docs/pages/railway.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ or we can fix the situation.
.. mermaid::
:caption: Railway oriented programming.

graph LR
S1 -- bind --> S3
S1 -- bind --> F2
S3 -- map --> S5
S5 -- bind --> S7
S5 -- bind --> F6

F2 -- alt --> F4
F4 -- lash --> F6
F4 -- lash --> S5
F6 -- lash --> F8
F6 -- lash --> S7

style S1 fill:green
style S3 fill:green
style S5 fill:green
style S7 fill:green
style F2 fill:red
style F4 fill:red
style F6 fill:red
style F8 fill:red
graph LR
S1 -- bind --> S3
S1 -- bind --> F2
S3 -- map --> S5
S5 -- bind --> S7
S5 -- bind --> F6

F2 -- alt --> F4
F4 -- lash --> F6
F4 -- lash --> S5
F6 -- lash --> F8
F6 -- lash --> S7

style S1 fill:green
style S3 fill:green
style S5 fill:green
style S7 fill:green
style F2 fill:red
style F4 fill:red
style F6 fill:red
style F8 fill:red

Returning execution to the right track
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -69,11 +69,11 @@ Let's start from the first one:
.. mermaid::
:caption: Illustration of ``alt`` method.

graph LR
F1["Container[A]"] -- "alt(function)" --> F2["Container[B]"]
graph LR
F1["Container[A]"] -- "alt(function)" --> F2["Container[B]"]

style F1 fill:red
style F2 fill:red
style F1 fill:red
style F2 fill:red

.. code:: python
Expand All @@ -89,13 +89,13 @@ It can also lash your flow and get on the successful track again:
.. mermaid::
:caption: Illustration of ``lash`` method.

graph LR
F1["Container[A]"] -- "lash(function)" --> F2["Container[B]"]
F1["Container[A]"] -- "lash(function)" --> F3["Container[C]"]
graph LR
F1["Container[A]"] -- "lash(function)" --> F2["Container[B]"]
F1["Container[A]"] -- "lash(function)" --> F3["Container[C]"]

style F1 fill:red
style F2 fill:green
style F3 fill:red
style F1 fill:red
style F2 fill:green
style F3 fill:red

.. code:: python
Expand Down
Loading

0 comments on commit b3a3967

Please sign in to comment.