From 3bad4a605dda13c0f172d19e1292c9cd942e25bd Mon Sep 17 00:00:00 2001 From: Andy Leap <104936100+andrewleap-optimizely@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:37:00 -0500 Subject: [PATCH] [FSSDK-8583] chore: prepare for 5.0 (#431) * bump version * update supported version * run unit tests on 3.12, pypy 3.8 and 3.9 * fix license --- .github/workflows/python.yml | 24 +++++-- CHANGELOG.md | 80 ++++++++++++++++++----- LICENSE | 2 +- README.md | 2 + optimizely/odp/odp_segment_api_manager.py | 3 +- optimizely/version.py | 2 +- setup.py | 3 +- 7 files changed, 90 insertions(+), 26 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 27f15835..0699f84c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -29,10 +29,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' # flake8 version should be same as the version in requirements/test.txt # to avoid lint errors on CI - name: pip install flak8 @@ -64,7 +64,15 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy-3.10-v7.3.12", "3.8", "3.9", "3.10", "3.11"] + python-version: + - "pypy-3.8" + - "pypy-3.9" + - "pypy-3.10" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -84,7 +92,15 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: + - "pypy-3.8" + - "pypy-3.9" + - "pypy-3.10" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ed00ab5..94e3bbd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,39 +1,85 @@ # Optimizely Python SDK Changelog +## 5.0.0 +January 18th, 2024 + +### New Features + +The 5.0.0 release introduces a new primary feature, [Advanced Audience Targeting]( https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) enabled through integration with [Optimizely Data Platform (ODP)](https://docs.developers.optimizely.com/optimizely-data-platform/docs) ([#395](https://github.com/optimizely/python-sdk/pull/395), [#398](https://github.com/optimizely/python-sdk/pull/398), [#402](https://github.com/optimizely/python-sdk/pull/402), [#403](https://github.com/optimizely/python-sdk/pull/403), [#405](https://github.com/optimizely/python-sdk/pull/405)). + +You can use ODP, a high-performance [Customer Data Platform (CDP)]( https://www.optimizely.com/optimization-glossary/customer-data-platform/), to easily create complex real-time segments (RTS) using first-party and 50+ third-party data sources out of the box. You can create custom schemas that support the user attributes important for your business, and stitch together user behavior done on different devices to better understand and target your customers for personalized user experiences. ODP can be used as a single source of truth for these segments in any Optimizely or 3rd party tool. + +With ODP accounts integrated into Optimizely projects, you can build audiences using segments pre-defined in ODP. The SDK will fetch the segments for given users and make decisions using the segments. For access to ODP audience targeting in your Feature Experimentation account, please contact your Optimizely Customer Success Manager. + +This version includes the following changes: + +* New API added to `OptimizelyUserContext`: + + * `fetchQualifiedSegments()`: this API will retrieve user segments from the ODP server. The fetched segments will be used for audience evaluation. The fetched data will be stored in the local cache to avoid repeated network delays. + * When an `OptimizelyUserContext` is created, the SDK will automatically send an identify request to the ODP server to facilitate observing user activities. + +* New APIs added to `OptimizelyClient`: + + * `sendOdpEvent()`: customers can build/send arbitrary ODP events that will bind user identifiers and data to user profiles in ODP. + +For details, refer to our documentation pages: + +* [Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) +* [Server SDK Support](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-for-server-side-sdks) +* [Initialize Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-python) +* [OptimizelyUserContext Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/wip-fsodp-optimizelyusercontext-python) +* [Advanced Audience Targeting segment qualification methods](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-segment-qualification-methods-python) +* [Send Optimizely Data Platform data using Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/send-odp-data-using-advanced-audience-targeting-python) + +### Logging + +* Add warning to polling intervals below 30 seconds ([#428](https://github.com/optimizely/python-sdk/pull/428)) +* Add warning to duplicate experiment keys ([#430](https://github.com/optimizely/python-sdk/pull/430)) + +### Enhancements +* Added `py.typed` to enable external usage of mypy type annotations. + +### Breaking Changes +* Updated minimum supported Python version from 3.7 -> 3.8 +* `ODPManager` in the SDK is enabled by default. Unless an ODP account is integrated into the Optimizely projects, most `ODPManager` functions will be ignored. If needed, `ODPManager` can be disabled when `OptimizelyClient` is instantiated. +* `BaseConfigManager` abstract class now requires a get_sdk_key method. ([#413](https://github.com/optimizely/python-sdk/pull/413)) +* `PollingConfigManager` requires either the sdk_key parameter or datafile containing an sdkKey. ([#413](https://github.com/optimizely/python-sdk/pull/413)) +* Asynchronous `BatchEventProcessor` is now the default event processor. ([#378](https://github.com/optimizely/python-sdk/pull/378)) + ## 5.0.0-beta Apr 28th, 2023 -### New Features +### New Features -The 5.0.0-beta release introduces a new primary feature, [Advanced Audience Targeting]( https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) enabled through integration with [Optimizely Data Platform (ODP)](https://docs.developers.optimizely.com/optimizely-data-platform/docs) ([#395](https://github.com/optimizely/python-sdk/pull/395), [#398](https://github.com/optimizely/python-sdk/pull/398), [#402](https://github.com/optimizely/python-sdk/pull/402), [#403](https://github.com/optimizely/python-sdk/pull/403), [#405](https://github.com/optimizely/python-sdk/pull/405)). +The 5.0.0-beta release introduces a new primary feature, [Advanced Audience Targeting]( https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) enabled through integration with [Optimizely Data Platform (ODP)](https://docs.developers.optimizely.com/optimizely-data-platform/docs) ([#395](https://github.com/optimizely/python-sdk/pull/395), [#398](https://github.com/optimizely/python-sdk/pull/398), [#402](https://github.com/optimizely/python-sdk/pull/402), [#403](https://github.com/optimizely/python-sdk/pull/403), [#405](https://github.com/optimizely/python-sdk/pull/405)). -You can use ODP, a high-performance [Customer Data Platform (CDP)]( https://www.optimizely.com/optimization-glossary/customer-data-platform/), to easily create complex real-time segments (RTS) using first-party and 50+ third-party data sources out of the box. You can create custom schemas that support the user attributes important for your business, and stitch together user behavior done on different devices to better understand and target your customers for personalized user experiences. ODP can be used as a single source of truth for these segments in any Optimizely or 3rd party tool. +You can use ODP, a high-performance [Customer Data Platform (CDP)]( https://www.optimizely.com/optimization-glossary/customer-data-platform/), to easily create complex real-time segments (RTS) using first-party and 50+ third-party data sources out of the box. You can create custom schemas that support the user attributes important for your business, and stitch together user behavior done on different devices to better understand and target your customers for personalized user experiences. ODP can be used as a single source of truth for these segments in any Optimizely or 3rd party tool. -With ODP accounts integrated into Optimizely projects, you can build audiences using segments pre-defined in ODP. The SDK will fetch the segments for given users and make decisions using the segments. For access to ODP audience targeting in your Feature Experimentation account, please contact your Optimizely Customer Success Manager. +With ODP accounts integrated into Optimizely projects, you can build audiences using segments pre-defined in ODP. The SDK will fetch the segments for given users and make decisions using the segments. For access to ODP audience targeting in your Feature Experimentation account, please contact your Optimizely Customer Success Manager. -This version includes the following changes: +This version includes the following changes: -* New API added to `OptimizelyUserContext`: +* New API added to `OptimizelyUserContext`: * `fetchQualifiedSegments()`: this API will retrieve user segments from the ODP server. The fetched segments will be used for audience evaluation. The fetched data will be stored in the local cache to avoid repeated network delays. - * When an `OptimizelyUserContext` is created, the SDK will automatically send an identify request to the ODP server to facilitate observing user activities. + * When an `OptimizelyUserContext` is created, the SDK will automatically send an identify request to the ODP server to facilitate observing user activities. -* New APIs added to `OptimizelyClient`: +* New APIs added to `OptimizelyClient`: * `sendOdpEvent()`: customers can build/send arbitrary ODP events that will bind user identifiers and data to user profiles in ODP. -For details, refer to our documentation pages: +For details, refer to our documentation pages: -* [Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) -* [Server SDK Support](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-for-server-side-sdks) -* [Initialize Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-python) -* [OptimizelyUserContext Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/wip-fsodp-optimizelyusercontext-python) -* [Advanced Audience Targeting segment qualification methods](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-segment-qualification-methods-python) -* [Send Optimizely Data Platform data using Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/send-odp-data-using-advanced-audience-targeting-python) +* [Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) +* [Server SDK Support](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-for-server-side-sdks) +* [Initialize Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-python) +* [OptimizelyUserContext Python SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/wip-fsodp-optimizelyusercontext-python) +* [Advanced Audience Targeting segment qualification methods](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-segment-qualification-methods-python) +* [Send Optimizely Data Platform data using Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/send-odp-data-using-advanced-audience-targeting-python) -### Breaking Changes +### Breaking Changes -* `ODPManager` in the SDK is enabled by default. Unless an ODP account is integrated into the Optimizely projects, most `ODPManager` functions will be ignored. If needed, `ODPManager` can be disabled when `OptimizelyClient` is instantiated. +* `ODPManager` in the SDK is enabled by default. Unless an ODP account is integrated into the Optimizely projects, most `ODPManager` functions will be ignored. If needed, `ODPManager` can be disabled when `OptimizelyClient` is instantiated. * `BaseConfigManager` abstract class now requires a get_sdk_key method. ([#413](https://github.com/optimizely/python-sdk/pull/413)) * `PollingConfigManager` requires either the sdk_key parameter or datafile containing an sdkKey. ([#413](https://github.com/optimizely/python-sdk/pull/413)) * Asynchronous `BatchEventProcessor` is now the default event processor. ([#378](https://github.com/optimizely/python-sdk/pull/378)) diff --git a/LICENSE b/LICENSE index 532cbad9..1b91d409 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016 Optimizely + © Optimizely 2016 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 24d4116c..7a6456c1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Refer to the [Python SDK's developer documentation](https://docs.developers.opti ### Requirements +Version `5.0+`: Python 3.8+, PyPy 3.8+ + Version `4.0+`: Python 3.7+, PyPy 3.7+ Version `3.0+`: Python 2.7+, PyPy 3.4+ diff --git a/optimizely/odp/odp_segment_api_manager.py b/optimizely/odp/odp_segment_api_manager.py index 8e5d8bc5..1ea191eb 100644 --- a/optimizely/odp/odp_segment_api_manager.py +++ b/optimizely/odp/odp_segment_api_manager.py @@ -138,8 +138,7 @@ def fetch_segments(self, api_key: str, api_host: str, user_key: str, '{audiences(subset: $audiences) {edges {node {name state}}}}}', 'variables': { 'userId': str(user_value), - 'audiences': segments_to_check - } + 'audiences': segments_to_check} } try: diff --git a/optimizely/version.py b/optimizely/version.py index 44b3134d..de16cae8 100644 --- a/optimizely/version.py +++ b/optimizely/version.py @@ -11,5 +11,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -version_info = (5, 0, '0-beta') +version_info = (5, 0, 0) __version__ = '.'.join(str(v) for v in version_info) diff --git a/setup.py b/setup.py index 5e2ccc2e..1954aa48 100644 --- a/setup.py +++ b/setup.py @@ -47,10 +47,11 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], packages=find_packages(exclude=['docs', 'tests']), extras_require={'test': TEST_REQUIREMENTS},