From cd2cf56634f4deef3563495312d434668147c18c Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Thu, 26 Mar 2020 17:12:39 -0700 Subject: [PATCH 01/15] Add docs.txt to requirements (#242) Co-authored-by: Polina Nguen --- requirements/docs.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements/docs.txt diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 00000000..4e4893d1 --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,3 @@ +sphinx==2.4.4 +sphinx-rtd-theme==0.4.3 +m2r==0.2.1 \ No newline at end of file From 923afd563ac092c7f87b6a67f9a4aac1aa49fc7b Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Sat, 28 Mar 2020 20:50:44 -0700 Subject: [PATCH 02/15] Create script to generate html docs with sphinx (#243) * Create script to generate html docs with sphinx Add minor changes to README.md and CONTRIBUTING.md for proper conversion to .rst * Address comments * Clean up Co-authored-by: Polina Nguen --- .gitignore | 3 ++ CONTRIBUTING.md | 4 +-- README.md | 16 +++++----- docs/Makefile | 20 ++++++++++++ docs/make.bat | 35 +++++++++++++++++++++ docs/source/conf.py | 59 ++++++++++++++++++++++++++++++++++++ docs/source/contributing.rst | 1 + docs/source/index.rst | 10 ++++++ 8 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/contributing.rst create mode 100644 docs/source/index.rst diff --git a/.gitignore b/.gitignore index c31d157f..961aa6ad 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ datafile.json # OSX folder metadata *.DS_Store + +# Sphinx documentation +docs/build/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ed58d21..9b8aee81 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ -Contributing to the Optimizely Python SDK -========================================= +Contributing +============ We welcome contributions and feedback! All contributors must sign our [Contributor License Agreement diff --git a/README.md b/README.md index 30c0ede4..6192c567 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@ Optimizely Python SDK ===================== -[![PyPI -version](https://badge.fury.io/py/optimizely-sdk.svg)](https://pypi.org/project/optimizely-sdk) -[![Build -Status](https://travis-ci.org/optimizely/python-sdk.svg?branch=master)](https://travis-ci.org/optimizely/python-sdk) -[![Coverage -Status](https://coveralls.io/repos/github/optimizely/python-sdk/badge.svg)](https://coveralls.io/github/optimizely/python-sdk) -[![Apache -2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) +[![PyPI version](https://badge.fury.io/py/optimizely-sdk.svg)](https://pypi.org/project/optimizely-sdk) +[![Build Status](https://travis-ci.org/optimizely/python-sdk.svg?branch=master)](https://travis-ci.org/optimizely/python-sdk) +[![Coverage Status](https://coveralls.io/repos/github/optimizely/python-sdk/badge.svg)](https://coveralls.io/github/optimizely/python-sdk) +[![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) This repository houses the official Python SDK for use with Optimizely Full Stack and Optimizely Rollouts. @@ -140,7 +136,9 @@ A notification signal will be triggered whenever a *new* datafile is fetched and Project Config is updated. To subscribe to these notifications, use: -`notification_center.add_notification_listener(NotificationTypes.OPTIMIZELY_CONFIG_UPDATE, update_callback)` +``` +notification_center.add_notification_listener(NotificationTypes.OPTIMIZELY_CONFIG_UPDATE, update_callback) +``` For Further details see the Optimizely [Full Stack documentation](https://docs.developers.optimizely.com/full-stack/docs) to learn how to set up your first Python project and use the SDK. diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d0c3cbf1 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..6247f7e2 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 00000000..9e712490 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,59 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('../..')) + +# -- Project information ----------------------------------------------------- + +project = 'Python SDK' +copyright = '2016-2020, Optimizely, Inc' +author = 'Optimizely, Inc.' + +# The full version, including alpha/beta/rc tags +release = '' + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "m2r", + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.autosectionlabel" +] +autosectionlabel_prefix_document = True + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [ +] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +# html_theme = 'alabaster' +html_theme = "sphinx_rtd_theme" +# 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, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst new file mode 100644 index 00000000..36431a6a --- /dev/null +++ b/docs/source/contributing.rst @@ -0,0 +1 @@ +.. mdinclude:: ../../CONTRIBUTING.md \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 00000000..eb11cab8 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,10 @@ +Python SDK +========== + +.. mdinclude:: ../../README.md + + +.. toctree:: + :caption: Help + + contributing \ No newline at end of file From f49e545369ec389faa532f74f8ad96a7d799560e Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Mon, 30 Mar 2020 15:16:45 -0400 Subject: [PATCH 03/15] Include docstrings from bucketer.py and decision_service.py to the docs (#244) * Include docstrings from bucketer.py and decision_service.py to the docs * Fix Travis failure Co-authored-by: Polina Nguen --- docs/source/bucketing_algorithm.rst | 14 ++++++++++++++ docs/source/conf.py | 2 +- docs/source/index.rst | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 docs/source/bucketing_algorithm.rst diff --git a/docs/source/bucketing_algorithm.rst b/docs/source/bucketing_algorithm.rst new file mode 100644 index 00000000..6aeabb60 --- /dev/null +++ b/docs/source/bucketing_algorithm.rst @@ -0,0 +1,14 @@ +Bucketing Algorithm Methods +=========================== +.. automodule:: optimizely.bucketer + :members: + :special-members: + :private-members: + + +Decision Service +================ +.. automodule:: optimizely.decision_service + :members: + :special-members: + :private-members: \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 9e712490..6b500dd9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -56,4 +56,4 @@ # 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, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] \ No newline at end of file +# html_static_path = ['_static'] diff --git a/docs/source/index.rst b/docs/source/index.rst index eb11cab8..9ff2b82d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,6 +4,12 @@ Python SDK .. mdinclude:: ../../README.md +.. toctree:: + :caption: Bucketing Algorithm + + bucketing_algorithm + + .. toctree:: :caption: Help From 70e2ee99202402531de59c267a9a463fc191fb88 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Fri, 3 Apr 2020 14:48:50 -0400 Subject: [PATCH 04/15] Add docstrings from config_manager.py and optimizely_config.py to docs (#245) Update buckering_algorithm to exclude namedtuble docstrings Co-authored-by: Polina Nguen --- docs/source/bucketing_algorithm.rst | 4 ++-- docs/source/config_manager.rst | 26 ++++++++++++++++++++++++++ docs/source/index.rst | 7 +++++++ docs/source/optimizely_config.rst | 7 +++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/source/config_manager.rst create mode 100644 docs/source/optimizely_config.rst diff --git a/docs/source/bucketing_algorithm.rst b/docs/source/bucketing_algorithm.rst index 6aeabb60..013c0f4d 100644 --- a/docs/source/bucketing_algorithm.rst +++ b/docs/source/bucketing_algorithm.rst @@ -8,7 +8,7 @@ Bucketing Algorithm Methods Decision Service ================ -.. automodule:: optimizely.decision_service +.. autoclass:: optimizely.decision_service.DecisionService :members: :special-members: - :private-members: \ No newline at end of file + :private-members: diff --git a/docs/source/config_manager.rst b/docs/source/config_manager.rst new file mode 100644 index 00000000..05d1efa7 --- /dev/null +++ b/docs/source/config_manager.rst @@ -0,0 +1,26 @@ +Config Manager +============== + +``Base Config Manager`` +----------------------- + +.. autoclass:: optimizely.config_manager.BaseConfigManager + :members: + :special-members: + :private-members: + +``Static Config Manager`` +------------------------- + +.. autoclass:: optimizely.config_manager.StaticConfigManager + :members: + :special-members: + :private-members: + +``Polling Config Manager`` +-------------------------- + +.. autoclass:: optimizely.config_manager.PollingConfigManager + :members: + :special-members: + :private-members: diff --git a/docs/source/index.rst b/docs/source/index.rst index 9ff2b82d..05bb41e4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,6 +10,13 @@ Python SDK bucketing_algorithm +.. toctree:: + :caption: Configuration Data + + config_manager + optimizely_config + + .. toctree:: :caption: Help diff --git a/docs/source/optimizely_config.rst b/docs/source/optimizely_config.rst new file mode 100644 index 00000000..fea102a1 --- /dev/null +++ b/docs/source/optimizely_config.rst @@ -0,0 +1,7 @@ +OptimizelyConfig +================ + +.. automodule:: optimizely.optimizely_config + :members: + :special-members: + :private-members: From 5d27ebf0e925274374888bb20ada97c168711ea1 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Fri, 3 Apr 2020 16:16:10 -0400 Subject: [PATCH 05/15] Added optimizely.py, event_dispatcher.py, and event_builder.py docstrings to the docs (#246) * Added optimizely.py to docs * Returned to having private methods included for now. * Added optimizely.py, event_builder.py, and event_dispatcher.py to the docs Co-authored-by: Polina Nguen --- docs/source/event_builder.rst | 18 ++++++++++++++++++ docs/source/event_dispatcher.rst | 4 ++++ docs/source/index.rst | 10 +++++++++- docs/source/optimizely.rst | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 docs/source/event_builder.rst create mode 100644 docs/source/event_dispatcher.rst create mode 100644 docs/source/optimizely.rst diff --git a/docs/source/event_builder.rst b/docs/source/event_builder.rst new file mode 100644 index 00000000..aa6fa71a --- /dev/null +++ b/docs/source/event_builder.rst @@ -0,0 +1,18 @@ +Event Builder +============= + +``Event`` +--------- + +.. autoclass:: optimizely.event_builder.Event + :members: + :special-members: + :private-members: + +``EventBuilder`` +---------------- + +.. autoclass:: optimizely.event_builder.EventBuilder + :members: + :special-members: + :private-members: diff --git a/docs/source/event_dispatcher.rst b/docs/source/event_dispatcher.rst new file mode 100644 index 00000000..76084277 --- /dev/null +++ b/docs/source/event_dispatcher.rst @@ -0,0 +1,4 @@ +Event Dispatcher +================ +.. autoclass:: optimizely.event_dispatcher.EventDispatcher + :members: diff --git a/docs/source/index.rst b/docs/source/index.rst index 05bb41e4..80e92ad7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,6 +4,14 @@ Python SDK .. mdinclude:: ../../README.md +.. toctree:: + :caption: API reference + + optimizely + event_builder + event_dispatcher + + .. toctree:: :caption: Bucketing Algorithm @@ -20,4 +28,4 @@ Python SDK .. toctree:: :caption: Help - contributing \ No newline at end of file + contributing diff --git a/docs/source/optimizely.rst b/docs/source/optimizely.rst new file mode 100644 index 00000000..c6c7c00b --- /dev/null +++ b/docs/source/optimizely.rst @@ -0,0 +1,4 @@ +Optimizely's APIs +==================== +.. automodule:: optimizely.optimizely + :members: From a2ce5958b1036182b60e28d7a025653d3885d760 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Mon, 6 Apr 2020 21:04:20 -0400 Subject: [PATCH 06/15] Added logger.py and user_profile.py docstrings to the docs. (#247) * Added optimizely.py to docs * Returned to having private methods included for now. * Added optimizely.py, event_builder.py, and event_dispatcher.py to the docs * Added user_profile.py and logger.py docstrings to docs Moved all api_reference components into one rst file Co-authored-by: Polina Nguen --- docs/source/api_reference.rst | 48 ++++++++++++++++++++++++++++++++ docs/source/event_builder.rst | 18 ------------ docs/source/event_dispatcher.rst | 4 --- docs/source/index.rst | 4 +-- docs/source/optimizely.rst | 4 --- 5 files changed, 49 insertions(+), 29 deletions(-) create mode 100644 docs/source/api_reference.rst delete mode 100644 docs/source/event_builder.rst delete mode 100644 docs/source/event_dispatcher.rst delete mode 100644 docs/source/optimizely.rst diff --git a/docs/source/api_reference.rst b/docs/source/api_reference.rst new file mode 100644 index 00000000..6f3a60bf --- /dev/null +++ b/docs/source/api_reference.rst @@ -0,0 +1,48 @@ +Optimizely's APIs +================= +.. automodule:: optimizely.optimizely + :members: + + +Event Builder +============= + +``Event`` +--------- + +.. autoclass:: optimizely.event_builder.Event + :members: + +``EventBuilder`` +---------------- + +.. autoclass:: optimizely.event_builder.EventBuilder + :members: + + +Event Dispatcher +================ +.. autoclass:: optimizely.event_dispatcher.EventDispatcher + :members: + + +Logger +====== +.. automodule:: optimizely.logger + :members: + + +User Profile +============ + +``UserProfile`` +--------------- + +.. autoclass:: optimizely.user_profile.UserProfile + :members: + +``UserProfileService`` +---------------------- + +.. autoclass:: optimizely.user_profile.UserProfileService + :members: diff --git a/docs/source/event_builder.rst b/docs/source/event_builder.rst deleted file mode 100644 index aa6fa71a..00000000 --- a/docs/source/event_builder.rst +++ /dev/null @@ -1,18 +0,0 @@ -Event Builder -============= - -``Event`` ---------- - -.. autoclass:: optimizely.event_builder.Event - :members: - :special-members: - :private-members: - -``EventBuilder`` ----------------- - -.. autoclass:: optimizely.event_builder.EventBuilder - :members: - :special-members: - :private-members: diff --git a/docs/source/event_dispatcher.rst b/docs/source/event_dispatcher.rst deleted file mode 100644 index 76084277..00000000 --- a/docs/source/event_dispatcher.rst +++ /dev/null @@ -1,4 +0,0 @@ -Event Dispatcher -================ -.. autoclass:: optimizely.event_dispatcher.EventDispatcher - :members: diff --git a/docs/source/index.rst b/docs/source/index.rst index 80e92ad7..ba046b65 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,9 +7,7 @@ Python SDK .. toctree:: :caption: API reference - optimizely - event_builder - event_dispatcher + api_reference .. toctree:: diff --git a/docs/source/optimizely.rst b/docs/source/optimizely.rst deleted file mode 100644 index c6c7c00b..00000000 --- a/docs/source/optimizely.rst +++ /dev/null @@ -1,4 +0,0 @@ -Optimizely's APIs -==================== -.. automodule:: optimizely.optimizely - :members: From 4f2989fe8ce57dd89bf7bf2435be421031b22adb Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Fri, 17 Apr 2020 16:15:52 -0700 Subject: [PATCH 07/15] Adding version of python sdk to docs (#249) * Added optimizely.py to docs * Returned to having private methods included for now. * Added optimizely.py, event_builder.py, and event_dispatcher.py to the docs * Add version to docs * Update branch Co-authored-by: Polina Nguen --- docs/source/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 6b500dd9..89097abf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,11 +14,14 @@ import sys sys.path.insert(0, os.path.abspath('../..')) +from optimizely.version import __version__ + # -- Project information ----------------------------------------------------- project = 'Python SDK' copyright = '2016-2020, Optimizely, Inc' author = 'Optimizely, Inc.' +version = __version__ # The full version, including alpha/beta/rc tags release = '' From 43ff395b37b74de5f2a54e98d67f96427785e438 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Wed, 22 Apr 2020 13:23:03 -0700 Subject: [PATCH 08/15] Remove private methods (#250) --- docs/source/bucketing_algorithm.rst | 4 ---- docs/source/config_manager.rst | 6 ------ docs/source/optimizely_config.rst | 2 -- 3 files changed, 12 deletions(-) diff --git a/docs/source/bucketing_algorithm.rst b/docs/source/bucketing_algorithm.rst index 013c0f4d..2325522f 100644 --- a/docs/source/bucketing_algorithm.rst +++ b/docs/source/bucketing_algorithm.rst @@ -2,13 +2,9 @@ Bucketing Algorithm Methods =========================== .. automodule:: optimizely.bucketer :members: - :special-members: - :private-members: Decision Service ================ .. autoclass:: optimizely.decision_service.DecisionService :members: - :special-members: - :private-members: diff --git a/docs/source/config_manager.rst b/docs/source/config_manager.rst index 05d1efa7..48cdba0d 100644 --- a/docs/source/config_manager.rst +++ b/docs/source/config_manager.rst @@ -6,21 +6,15 @@ Config Manager .. autoclass:: optimizely.config_manager.BaseConfigManager :members: - :special-members: - :private-members: ``Static Config Manager`` ------------------------- .. autoclass:: optimizely.config_manager.StaticConfigManager :members: - :special-members: - :private-members: ``Polling Config Manager`` -------------------------- .. autoclass:: optimizely.config_manager.PollingConfigManager :members: - :special-members: - :private-members: diff --git a/docs/source/optimizely_config.rst b/docs/source/optimizely_config.rst index fea102a1..7625be0a 100644 --- a/docs/source/optimizely_config.rst +++ b/docs/source/optimizely_config.rst @@ -3,5 +3,3 @@ OptimizelyConfig .. automodule:: optimizely.optimizely_config :members: - :special-members: - :private-members: From 197b8ba771de7539bbb87b43cf1394151c42488e Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Sun, 26 Apr 2020 17:49:53 -0700 Subject: [PATCH 09/15] Update sphinx docs per OASIS-6317 (#252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change pip8 to flake8 * Update contributing link to work in sphinx docs * Remove Event Builder * Change “Bucketing Algorithm Methods” to “Bucketing” * Update project name * Include README to table of contents * Create readme.rst for readme.md --- CONTRIBUTING.md | 7 +++---- README.md | 2 +- docs/source/api_reference.rst | 16 ---------------- docs/source/bucketing_algorithm.rst | 4 ++-- docs/source/conf.py | 2 +- docs/source/index.rst | 9 ++++++--- docs/source/readme.rst | 1 + 7 files changed, 14 insertions(+), 27 deletions(-) create mode 100644 docs/source/readme.rst diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b8aee81..d14002e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ Development process 2. Please follow the [commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines) for each commit message. 3. Make sure to add tests! -4. Run `pep8` to ensure there are no lint errors. +4. Run `flake8` to ensure there are no lint errors. 5. `git push` your changes to GitHub. 6. Open a PR from your fork into the master branch of the original repo. @@ -34,13 +34,12 @@ Pull request acceptance criteria - Tests are located in `/tests` with one file per class. - Please don't change the `__version__`. We'll take care of bumping the version when we next release. -- Lint your code with PEP-8 before submitting. +- Lint your code with Flake8 before submitting. Style ----- -We enforce Flake8 rules with a few minor -[deviations](https://github.com/optimizely/python-sdk/blob/master/tox.ini). +We enforce Flake8 rules. License ------- diff --git a/README.md b/README.md index 6192c567..48f29ca9 100644 --- a/README.md +++ b/README.md @@ -200,4 +200,4 @@ would be: ### Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md). +Please see [CONTRIBUTING](https://github.com/optimizely/python-sdk/blob/master/CONTRIBUTING.md). diff --git a/docs/source/api_reference.rst b/docs/source/api_reference.rst index 6f3a60bf..b6f12115 100644 --- a/docs/source/api_reference.rst +++ b/docs/source/api_reference.rst @@ -4,22 +4,6 @@ Optimizely's APIs :members: -Event Builder -============= - -``Event`` ---------- - -.. autoclass:: optimizely.event_builder.Event - :members: - -``EventBuilder`` ----------------- - -.. autoclass:: optimizely.event_builder.EventBuilder - :members: - - Event Dispatcher ================ .. autoclass:: optimizely.event_dispatcher.EventDispatcher diff --git a/docs/source/bucketing_algorithm.rst b/docs/source/bucketing_algorithm.rst index 2325522f..e793cd01 100644 --- a/docs/source/bucketing_algorithm.rst +++ b/docs/source/bucketing_algorithm.rst @@ -1,5 +1,5 @@ -Bucketing Algorithm Methods -=========================== +Bucketing +========= .. automodule:: optimizely.bucketer :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index 89097abf..08da5631 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- -project = 'Python SDK' +project = 'Optimizely Python SDK' copyright = '2016-2020, Optimizely, Inc' author = 'Optimizely, Inc.' version = __version__ diff --git a/docs/source/index.rst b/docs/source/index.rst index ba046b65..67a46059 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,7 +1,10 @@ -Python SDK -========== +Optimizely Python SDK +===================== -.. mdinclude:: ../../README.md +.. toctree:: + :caption: Introduction + + readme .. toctree:: diff --git a/docs/source/readme.rst b/docs/source/readme.rst new file mode 100644 index 00000000..57de8658 --- /dev/null +++ b/docs/source/readme.rst @@ -0,0 +1 @@ +.. mdinclude:: ../../README.md \ No newline at end of file From 9109ce3326228e3044c8eb5719e5443ceec025d9 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Mon, 27 Apr 2020 11:29:45 -0700 Subject: [PATCH 10/15] Add Optimizely logo to docs (#256) --- docs/optimizely.png | Bin 0 -> 3247 bytes docs/source/conf.py | 1 + 2 files changed, 1 insertion(+) create mode 100644 docs/optimizely.png diff --git a/docs/optimizely.png b/docs/optimizely.png new file mode 100644 index 0000000000000000000000000000000000000000..2ab1e6a55782799deed0f6d058416b3adcddc442 GIT binary patch literal 3247 zcmZ{ndpOgN7so%dnGMTaMlQpUOTkev_P}wxB~^GgOc(UL|=^b2`Xk6#k(bs4O@;Ijt_#lYj=y{iMvq->}`WI(Pl-Q9G+9zNwa0cvzES$QJ%KMN9@^XCTAG15;C0lV{d%6gQ zg#?O5q9P9>U)`xvCuy%}b^il9!`!GD)qQRCT@q}7>vA}0S|mbT0ws&&D;|5DL~Rkj zWjk728V2*pHT^X$BwGxvkOEqO-=M1UY`X`m=%e^is*-(#gV>Q6Fgn(9prX_2VaYyRe7g8fdMk4@TB@dq&o_|Ol!849VI;( z3cLR*z#uaId|lq6QZFZmdj6y^a|~+Hx7%A5{W6&!l$Ig^9y@y)Z!G8za{g0-0n7x3 zsL|b&7#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JsV%V1XBzjK3g4Gs{bI#hd?}kD`>NpSF5CwyNUNaf6(-s*DvV zrcaJ{!cQrZS#J9>YE0VFUQ+g#&5nX$1u#SR3u!)ai^vk?!BrQ!4O1adGIMGMglUr^ zPo1g@38eY#dC5Kz4+p$C=?4P>O0s^tg}xO{@>{9(aH>HZ))!F%n_@0v+Td-J0YbgP z>@W6NAy9F4Vd%$C6xjMBMZ}JTe7+Q}+)49smQZ0rn8~@F4@^T~hoXL0H7O Ykf6l>FF;Rpv-SjlgPkkko((DWKQ8UDZ2$lO literal 0 HcmV?d00001 diff --git a/docs/source/conf.py b/docs/source/conf.py index 08da5631..399d170b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -60,3 +60,4 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] +html_logo = "../optimizely.png" From 76a6c0b4c687e61bfb70766609749c0502b68f62 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Mon, 27 Apr 2020 11:30:15 -0700 Subject: [PATCH 11/15] [OASIS-6317] - Fix README.md format (#255) * Fix table in Advanced configuration * Fix anchor --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 48f29ca9..16ea39e6 100644 --- a/README.md +++ b/README.md @@ -122,15 +122,15 @@ notification_center. #### Advanced configuration The following properties can be set to override the default -configurations for [PollingConfigManager]{.title-ref}. - - **PropertyName** **Default Value** **Description** - ------------------ ----------------------------------------------------------- -------------------------------------------------------------------------------------- - update_interval 5 minutes Fixed delay between fetches for the datafile - sdk_key None Optimizely project SDK key - url None URL override location used to specify custom HTTP source for the Optimizely datafile - url_template https://cdn.optimizely.com/datafiles/{sdk_key}.json Parameterized datafile URL by SDK key - datafile None Initial datafile, typically sourced from a local cached source +configurations for [PollingConfigManager](#pollingconfigmanager). + +| **Property Name** |**Default Value**| **Description** | +|:-----------------------:|:---------------:|:--------------------------------------------------------------:| +| update_interval | 5 minutes | Fixed delay between fetches for the datafile | +| sdk_key | None | Optimizely project SDK key | +| url | None | URL override location used to specify custom | +| HTTP source for Optimizely datafile
url_template |https://cdn.optimizely.com/datafiles/{sdk_key}.json|Parameterized datafile URL by SDK key| +| datafile | None | Initial datafile, typically sourced from a local cached source | A notification signal will be triggered whenever a *new* datafile is fetched and Project Config is updated. To subscribe to these From f6a44192abb319943069210bf0adcb3c76879ed2 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Wed, 6 May 2020 08:23:37 -0700 Subject: [PATCH 12/15] Added README.md for generating sphinx docs (#257) * Create README for sphinx docs * Fix spelling * Update README.md Add title * Incorporate Ali's comments --- docs/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..2c5032fb --- /dev/null +++ b/docs/README.md @@ -0,0 +1,20 @@ +Documentation +============= + +Getting Started +--------------- + +### Installing the requirements + +To install dependencies required to generate sphinx documentation locally, execute the following command from the main directory: + + pip install -r requirements/docs.txt + +### Building documentation locally + +To generate Python SDK documentation locally, execute the following commands: + + cd docs/ + make html + +This will build HTML docs in `docs/build/html/index.html`. Open this file in your web browser to see the docs. \ No newline at end of file From c6be96bc9fc8575a2b629ed2ab80fc4dfffab8aa Mon Sep 17 00:00:00 2001 From: Ali Abbas Rizvi Date: Tue, 12 May 2020 10:45:09 -0700 Subject: [PATCH 13/15] chore(build): Making sure docs is excluded from build (#258) --- MANIFEST.in | 1 + docs/source/conf.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 109cdcd0..286e52fc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,5 @@ include LICENSE include CHANGELOG.md include README.md include requirements/* +recursive-exclude docs * recursive-exclude tests * diff --git a/docs/source/conf.py b/docs/source/conf.py index 399d170b..7c5c80a6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,7 +14,7 @@ import sys sys.path.insert(0, os.path.abspath('../..')) -from optimizely.version import __version__ +from optimizely.version import __version__ # noqa: E402 # -- Project information ----------------------------------------------------- diff --git a/setup.py b/setup.py index 1a17451d..d1123a35 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], - packages=find_packages(exclude=['tests']), + packages=find_packages(exclude=['docs', 'tests']), extras_require={'test': TEST_REQUIREMENTS}, install_requires=REQUIREMENTS, tests_require=TEST_REQUIREMENTS, From 202f92582819248c6574029ffbd1b054189d7d23 Mon Sep 17 00:00:00 2001 From: Polina Nguen <43302774+yavorona@users.noreply.github.com> Date: Tue, 12 May 2020 11:14:40 -0700 Subject: [PATCH 14/15] Removed Bucketing Algorithm Section and Added Description of Class Init Options in class Optimizely (#259) * Remove bucketing algorithm section * Add __init__ to class optimizely.optimizely.Optimizely --- docs/source/api_reference.rst | 1 + docs/source/bucketing_algorithm.rst | 10 ---------- docs/source/index.rst | 6 ------ 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 docs/source/bucketing_algorithm.rst diff --git a/docs/source/api_reference.rst b/docs/source/api_reference.rst index b6f12115..8c525623 100644 --- a/docs/source/api_reference.rst +++ b/docs/source/api_reference.rst @@ -2,6 +2,7 @@ Optimizely's APIs ================= .. automodule:: optimizely.optimizely :members: + :special-members: __init__ Event Dispatcher diff --git a/docs/source/bucketing_algorithm.rst b/docs/source/bucketing_algorithm.rst deleted file mode 100644 index e793cd01..00000000 --- a/docs/source/bucketing_algorithm.rst +++ /dev/null @@ -1,10 +0,0 @@ -Bucketing -========= -.. automodule:: optimizely.bucketer - :members: - - -Decision Service -================ -.. autoclass:: optimizely.decision_service.DecisionService - :members: diff --git a/docs/source/index.rst b/docs/source/index.rst index 67a46059..f15044bc 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,12 +13,6 @@ Optimizely Python SDK api_reference -.. toctree:: - :caption: Bucketing Algorithm - - bucketing_algorithm - - .. toctree:: :caption: Configuration Data From f08c7133fab6e779a1163f310dd830e3ca621bff Mon Sep 17 00:00:00 2001 From: Polina Nguen Date: Thu, 14 May 2020 11:07:50 -0700 Subject: [PATCH 15/15] Specified master_doc --- docs/source/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7c5c80a6..d212e930 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,6 +22,7 @@ copyright = '2016-2020, Optimizely, Inc' author = 'Optimizely, Inc.' version = __version__ +master_doc = 'index' # The full version, including alpha/beta/rc tags release = ''