Skip to content

Commit 4d077a8

Browse files
committed
improve docs
1 parent b07f013 commit 4d077a8

File tree

5 files changed

+87
-79
lines changed

5 files changed

+87
-79
lines changed

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# -- Options for HTML output ----------------------------------------------
5555

5656
html_theme_path = [alabaster.get_path()]
57-
html_static_path = []
57+
html_static_path = ["images"]
5858

5959
# The theme to use for HTML and HTML Help pages. See the documentation for
6060
# a list of builtin themes.
@@ -76,13 +76,15 @@
7676
"github_repo": "experiments.py",
7777
"github_user": "reddit",
7878
"github_banner": True,
79+
"logo": "ddg-logo.png",
7980
"logo_name": True,
8081
"show_powered_by": False,
8182
"show_related": False,
8283
"show_relbars": True,
8384
"page_width": "960px",
8485
}
8586

87+
8688
# The name of an image file (within the static path) to use as favicon of the
8789
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
8890
# pixels large.

docs/images/ddg-logo.png

52.4 KB
Loading

docs/images/favicon.png

2.79 KB
Loading

docs/index.rst

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
Prerequisite packages
8-
-------
8+
---------------------
99
.. code-block:: python
1010
1111
baseplate>=2.0.0
@@ -18,13 +18,13 @@ Prerequisite packages
1818
reddit-v2-events
1919
2020
Prerequisite infrastructure
21-
-------
21+
---------------------------
2222
Set up your service to pull down & synchronize experiment configurations from Zookeeper via the Baseplate `live-data watcher sidecar
2323
<https://baseplate.readthedocs.io/en/stable/api/baseplate/lib/live_data.html?highlight=sidecar#watcher-daemon>`_ (minimum v2.4.13).
2424
You'll have to make sure that your service is authorized to fetch the appropriate secret from Vault.
2525

26-
Prerequisite configuration:
27-
-------
26+
Prerequisite configuration
27+
---------------------------
2828
Setup :code:`reddit-experiments` in your application's configuration file:
2929

3030
.. code-block:: ini
@@ -50,7 +50,7 @@ Setup :code:`reddit-experiments` in your application's configuration file:
5050
5151
5252
Integrate :code:`reddit-experiments` into Baseplate service
53-
-------
53+
-----------------------------------------------------------
5454
In your service's initialization process, add a :code:`decider` instance to baseplate's context:
5555
(Note the use of the :code:`ExperimentLogger`, which is used to publish exposure V2 events,
5656
an example can be seen `here <https://github.snooguts.net/reddit/reddit-service-graphql/blob/3734b51732c29d07eef32aced86677cce5064dbb/graphql-py/graphql_api/events/utils.py#L205>`_)
@@ -78,11 +78,11 @@ an example can be seen `here <https://github.snooguts.net/reddit/reddit-service-
7878
baseplate.configure_context({
7979
"decider": DeciderClient(
8080
prefix="experiments.",
81-
event_logger=EventLogger,
81+
event_logger=ExperimentLogger,
8282
request_field_extractor=my_field_extractor # optional
8383
})
8484
85-
Make sure :code:`edge_context` is accessible on :code:`request` object like so:
85+
Make sure :code:`EdgeContext` is accessible on :code:`request` object like so:
8686
8787
.. code-block:: python
8888
@@ -108,14 +108,15 @@ Make sure :code:`edge_context` is accessible on :code:`request` object like so:
108108
109109
# Customized fields can be defined below to be extracted from a baseplate request
110110
# and will override above edge_context fields.
111+
# These fields may be used for targeting.
111112
112113
def my_field_extractor(request):
113114
# an example of customized baseplate request field extractor:
114115
return {"foo": request.headers.get("Foo"), "bar": "something"}
115116
116117
117-
Usage
118-
-------
118+
Basic Usage
119+
-----------
119120
Use the attached :py:class:`~reddit_decider.Decider` object in request to call
120121
:code:`decider.get_variant()` (automatically sends an expose event)::
121122
@@ -130,20 +131,25 @@ or optionally, if manual exposure is necessary, use::
130131
...
131132
request.decider.expose(experiment_name='experiment_name', variant_name=variant)
132133
133-
Configuration Classes
134-
-------------
135134
136-
.. autofunction:: decider_client_from_config
135+
Decider API
136+
-----------
137+
138+
.. autoclass:: Decider
139+
:members:
137140
141+
Configuration Class
142+
-------------------
138143
139144
.. autoclass:: DeciderClient
140145
146+
Configuration function
147+
----------------------
141148
142-
.. autoclass:: DeciderContextFactory
149+
.. autofunction:: decider_client_from_config
143150
144151
145-
Decider API
146-
-------
152+
Configuration Context Factory
153+
-----------------------------
147154
148-
.. autoclass:: Decider
149-
:members:
155+
.. autoclass:: DeciderContextFactory

0 commit comments

Comments
 (0)