Skip to content

Commit 1e1051e

Browse files
chore(release): Preparing for 3.2.0-beta release (#196)
1 parent 08f314e commit 1e1051e

File tree

3 files changed

+128
-2
lines changed

3 files changed

+128
-2
lines changed

Diff for: CHANGELOG.rst

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
3.2.0b1
2+
-------
3+
4+
July 26th, 2019
5+
6+
New Features:
7+
~~~~~~~~~~~~~
8+
9+
- Added support for automatic datafile management via `PollingConfigManager`_:
10+
11+
- The `PollingConfigManager`_ is an implementation of the `BaseConfigManager`_.
12+
- Users may provide one of datafile or SDK key (sdk_key) or both to `optimizely.Optimizely`. Based on that the SDK will use the `StaticConfigManager`_ or the `PollingConfigManager`_. Refer to the README_ for more instructions.
13+
- An initial datafile can be provided to the `PollingConfigManager` to bootstrap before making HTTP requests for the hosted datafile.
14+
- Requests for the datafile are made in a separate thread and are scheduled with fixed delay.
15+
- Configuration updates can be subscribed to by adding .
16+
17+
- Introduced `Optimizely.get_feature_variable` API. (`#191`_)
18+
19+
Deprecated:
20+
~~~~~~~~~~~
21+
22+
- `NotificationCenter.clear_notifications` is deprecated as of this release. Please use `NotificationCenter.clear_notification_listeners`. (`#182`_)
23+
- `NotificationCenter.clear_all_notifications` is deprecated as of this release. Please use `NotificationCenter.clear_all_notification_listeners`. (`#182`_)
24+
25+
.. _#182: https://github.com/optimizely/python-sdk/pull/182
26+
.. _#191: https://github.com/optimizely/python-sdk/pull/191
27+
.. _BaseConfigManager: https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L32
28+
.. _PollingConfigManager: https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L151
29+
.. _README: https://github.com/optimizely/python-sdk/blob/3.2.x/README.rst
30+
.. _StaticConfigManager: https://github.com/optimizely/python-sdk/blob/3.2.x/optimizely/config_manager.py#L73
31+
132
3.1.0
233
-----
334

Diff for: README.rst

+96-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,100 @@ dashboard, please contact your Optimizely account executive.
3030
Using the SDK
3131
~~~~~~~~~~~~~
3232

33-
See the Optimizely `Full Stack documentation`_ to learn how to
33+
You can initialize the Optimizely instance in three ways: with a datafile, by providing an `sdk_key`, or by providing an implementation of `config_manager.BaseConfigManager`_. Each method is described below.
34+
35+
1. Initialize Optimizely with a datafile. This datafile will be used as
36+
ProjectConfig throughout the life of Optimizely instance.
37+
::
38+
39+
optimizely.Optimizely(
40+
datafile
41+
)
42+
43+
2. Initialize Optimizely by providing an 'sdk_key'. This will initialize
44+
a PollingConfigManager that makes an HTTP GET request to the URL (formed
45+
using your provided `sdk key` and the default datafile CDN URL
46+
template) to asynchronously download the project datafile at regular
47+
intervals and update ProjectConfig when a new datafile is received. A
48+
hard-coded datafile can also be provided along with the `sdk_key` that
49+
will be used initially before any update.
50+
::
51+
52+
optimizely.Optimizely(
53+
sdk_key='put_your_sdk_key_here'
54+
)
55+
56+
If providing a datafile, the initialization will look like:
57+
::
58+
59+
optimizely.Optimizely(
60+
datafile=datafile,
61+
sdk_key='put_your_sdk_key_here'
62+
)
63+
64+
3. Initialize Optimizely by providing a ConfigManager that implements `BaseConfigManager`_. You may use our `PollingConfigManager` as needed.
65+
::
66+
67+
optimizely.Optimizely(
68+
config_manager=custom_config_manager
69+
)
70+
71+
PollingConfigManager
72+
''''''''''''''''''''
73+
74+
The `PollingConfigManager` asynchronously polls for datafiles from a
75+
specified URL at regular intervals by making HTTP requests.
76+
77+
polling_config_manager = PollingConfigManager( sdk_key=None,
78+
datafile=None, update_interval=None, url=None, url_template=None,
79+
logger=None, error_handler=None, notification_center=None,
80+
skip_json_validation=False )
81+
82+
**Note**: You must provide either the `sdk_key` or URL. If you provide both, the URL takes precedence.
83+
84+
**sdk_key** The `sdk_key` is used to compose the outbound HTTP request to
85+
the default datafile location on the Optimizely CDN.
86+
87+
**datafile** You can provide an initial datafile to bootstrap the
88+
``ProjectConfigManager`` so that it can be used immediately. The initial
89+
datafile also serves as a fallback datafile if HTTP connection cannot be
90+
established. The initial datafile will be discarded after the first
91+
successful datafile poll.
92+
93+
**update_interval** The update_interval is used to specify a fixed delay
94+
in seconds between consecutive HTTP requests for the datafile.
95+
96+
**url_template** A string with placeholder ``{sdk_key}`` can be provided
97+
so that this template along with the provided `sdk key` is used to form
98+
the target URL.
99+
100+
You may also provide your own logger, error_handler, or
101+
notification_center.
102+
103+
Advanced configuration
104+
''''''''''''''''''''''
105+
106+
The following properties can be set to override the default
107+
configurations for `PollingConfigManager`.
108+
109+
================ ======================================================== =====================================================================================
110+
**PropertyName** **Default Value** **Description**
111+
================ ======================================================== =====================================================================================
112+
update_interval 5 minutes Fixed delay between fetches for the datafile
113+
sdk_key None Optimizely project SDK key
114+
url None URL override location used to specify custom HTTP source for the Optimizely datafile
115+
url_template https://cdn.optimizely.com/datafiles/{sdk_key}.json Parameterized datafile URL by SDK key
116+
datafile None Initial datafile, typically sourced from a local cached source
117+
================ ======================================================== =====================================================================================
118+
119+
A notification signal will be triggered whenever a *new* datafile is
120+
fetched and Project Config is updated. To subscribe to these
121+
notifications, use:
122+
123+
``notification_center.add_notification_listener(NotificationTypes.OPTIMIZELY_CONFIG_UPDATE, update_callback)``
124+
125+
126+
For Further details see the Optimizely `Full Stack documentation`_ to learn how to
34127
set up your first Python project and use the SDK.
35128

36129
Development
@@ -123,6 +216,8 @@ Please see `CONTRIBUTING`_.
123216
.. _Full Stack documentation: https://docs.developers.optimizely.com/full-stack/docs
124217
.. _Rollouts documentation: https://docs.developers.optimizely.com/rollouts/docs
125218
.. _CONTRIBUTING: CONTRIBUTING.rst
219+
.. _config_manager.BaseConfigManager:: https://github.com/optimizely/python-sdk/tree/master/optimizely/config_manager.py#L32
220+
.. _BaseConfigManager: https://github.com/optimizely/python-sdk/tree/master/optimizely/config_manager.py#L32
126221

127222
.. |PyPI version| image:: https://badge.fury.io/py/optimizely-sdk.svg
128223
:target: https://pypi.org/project/optimizely-sdk

Diff for: optimizely/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14-
version_info = (3, 1, 0)
14+
version_info = (3, 2, '0-beta1')
1515
__version__ = '.'.join(str(v) for v in version_info)

0 commit comments

Comments
 (0)