Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASGI/Asyncio Support #158

Open
dusty-phillips opened this issue Aug 18, 2021 · 12 comments
Open

ASGI/Asyncio Support #158

dusty-phillips opened this issue Aug 18, 2021 · 12 comments

Comments

@dusty-phillips
Copy link

dusty-phillips commented Aug 18, 2021

Is your feature request related to a problem? Please describe.

As far as I can tell, this SDK won't work with asyncio or asgi services due to the use of threading locks and queue.queue. This is preventing us from using it across all of our newer services.

Describe the solution you'd like

I'd like to see an async-first implementation where the launch darkly task is running in the background on the same event loop.

Describe alternatives you've considered

I'd also consider using the existing threaded mechanism, but provide async functions that don't rely on locks and the synchronous queue to request features when necessary.

I've considered wrapping the ld sdk in another thread and connecting it with async tasks using an asyncio.queue.

I've considered switching to a different feature flag provider.

Additional context

Is it possible I'm missing a different library? I was shocked to see that there was no asyncio first class citizen in the documentation in 2021, but maybe it hasn't been publicized yet.

@eli-darkly
Copy link
Contributor

Async support has been requested before and it is certainly something we may add in the future, but as you can probably imagine, that would amount to a total rewrite of the SDK due to how concurrency is used throughout the code. The Python SDK codebase is older than many of the other SDKs, and was mostly written before async was available. Unfortunately I can't provide a time frame for this.

@JBogossianKH
Copy link

Any update on this? ASGI and Async support is becoming ubiquitous at this point. My team is considering using LD but ASGI support is a hard requirement as we are using FastAPI.

@eli-darkly
Copy link
Contributor

Sorry, there isn't an update. We understand that it's a desirable feature, but we haven't been able to prioritize a full rewrite of this SDK ahead of other projects. I'll mention your comment to the team since we do keep track of the level of customer interest.

LaunchDarklyReleaseBot added a commit that referenced this issue Apr 22, 2022
* Allow explicitly proxying only ld requests (#130)

* fix broken indirect/patch request, add tests for feature requestor

* Python 2/3 compatibility for HTTPServer

* Py2/3 compatibility: queue

* more Py3 compatibility

* don't need import of builtins

* fix string encoding

* implement setting proxy URL by environment variable

* rm debugging

* fix autodoc options to exclude magic methods

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Jun 16, 2022
* Py2/3 compatibility: queue

* more Py3 compatibility

* don't need import of builtins

* fix string encoding

* implement setting proxy URL by environment variable

* rm debugging

* fix autodoc options to exclude magic methods

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Jul 1, 2022
* fix string encoding

* implement setting proxy URL by environment variable

* rm debugging

* fix autodoc options to exclude magic methods

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
@prussyuval
Copy link

Any updates?

@eli-darkly
Copy link
Contributor

eli-darkly commented Jul 11, 2022

@prussyuval No, there aren't any updates. I promise that we will post a comment here on this issue as soon as there is anything to say; that's the whole reason why we've left the issue open, so people can subscribe to it (and can see that it's already been requested).

LaunchDarklyReleaseBot added a commit that referenced this issue Sep 29, 2022
* rm debugging

* fix autodoc options to exclude magic methods

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Dec 30, 2022
* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* (U2C 1) drop EOL Python versions (#189)

* drop EOL Python versions

* misc cleanup, show Python version in CI

* add Python 3.11 CI job

* add Python 3.11 to package metadata

* (U2C 2) remove alias event functionality (#187)

* (U2C 3) remove inline users in events (#188)

* (U2C 4) remove deprecated things (#192)

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* implement context model

* fix exports

* specify exports

* add copy constructor

* minimal changes for SDK methods & evaluator to accept Context

* update tests, add subscript method

* lint

* in type hints, must use Dict[A, B] rather than dict[A, B] for Python <3.9

* support context kind in clauses + enable v2 contract tests

* misc fixes

* misc fixes

* support contextTargets

* support contextKind in rollouts/experiments

* support includedContexts/excludedContexts in segment

* comment copyedit

Co-authored-by: Matthew M. Keeler <[email protected]>

* comment fixes

* rm unused

Co-authored-by: Matthew M. Keeler <[email protected]>

* fix create_multi to support flattening

* lint

* use custom classes for flag/segment data model

* use store adapter for safety

* misc cleanup

* misc fixes for persistent stores

* more database store fixes

* support attribute reference lookups in evaluations

* pass logger from client

* context kind logic for big segments + enable big segment contract tests

* formatting fixes + test cleanup

* prerequisite cycle detection

* segment recursion

* define custom classes for event data

* add module init file

* linting

* fix prereq stack logic

* (U2C 17) U2C changes for events, not including private attributes (#205)

* private attribute redaction

* move a lot of code out of top-level modules

* TestData changes for contexts

* general doc comment fixes for 8.0

* U2C configuration updates

* update release metadata

* store flag/segment target lists as sets

* fix type hint

* preprocess clause values for time/regex/semver operators

* fix type checking for matches operator

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
@rememberlenny
Copy link

Any update?

LaunchDarklyReleaseBot added a commit that referenced this issue Jan 31, 2023
* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Jan 31, 2023
* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* (U2C 1) drop EOL Python versions (#189)

* drop EOL Python versions

* misc cleanup, show Python version in CI

* add Python 3.11 CI job

* add Python 3.11 to package metadata

* (U2C 2) remove alias event functionality (#187)

* (U2C 3) remove inline users in events (#188)

* (U2C 4) remove deprecated things (#192)

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* implement context model

* fix exports

* specify exports

* add copy constructor

* minimal changes for SDK methods & evaluator to accept Context

* update tests, add subscript method

* lint

* in type hints, must use Dict[A, B] rather than dict[A, B] for Python <3.9

* support context kind in clauses + enable v2 contract tests

* misc fixes

* misc fixes

* support contextTargets

* support contextKind in rollouts/experiments

* support includedContexts/excludedContexts in segment

* comment copyedit

Co-authored-by: Matthew M. Keeler <[email protected]>

* comment fixes

* rm unused

Co-authored-by: Matthew M. Keeler <[email protected]>

* fix create_multi to support flattening

* lint

* use custom classes for flag/segment data model

* use store adapter for safety

* misc cleanup

* misc fixes for persistent stores

* more database store fixes

* support attribute reference lookups in evaluations

* pass logger from client

* context kind logic for big segments + enable big segment contract tests

* formatting fixes + test cleanup

* prerequisite cycle detection

* segment recursion

* define custom classes for event data

* add module init file

* linting

* fix prereq stack logic

* (U2C 17) U2C changes for events, not including private attributes (#205)

* private attribute redaction

* move a lot of code out of top-level modules

* TestData changes for contexts

* general doc comment fixes for 8.0

* U2C configuration updates

* update release metadata

* store flag/segment target lists as sets

* fix type hint

* preprocess clause values for time/regex/semver operators

* fix type checking for matches operator

* Add application info support (#214)

* Add application info support (#214) (#215)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* prepare 7.6.0 release (#192)

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.0

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Feb 7, 2023
* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue Feb 10, 2023
* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* (U2C 1) drop EOL Python versions (#189)

* drop EOL Python versions

* misc cleanup, show Python version in CI

* add Python 3.11 CI job

* add Python 3.11 to package metadata

* (U2C 2) remove alias event functionality (#187)

* (U2C 3) remove inline users in events (#188)

* (U2C 4) remove deprecated things (#192)

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* implement context model

* fix exports

* specify exports

* add copy constructor

* minimal changes for SDK methods & evaluator to accept Context

* update tests, add subscript method

* lint

* in type hints, must use Dict[A, B] rather than dict[A, B] for Python <3.9

* support context kind in clauses + enable v2 contract tests

* misc fixes

* misc fixes

* support contextTargets

* support contextKind in rollouts/experiments

* support includedContexts/excludedContexts in segment

* comment copyedit

Co-authored-by: Matthew M. Keeler <[email protected]>

* comment fixes

* rm unused

Co-authored-by: Matthew M. Keeler <[email protected]>

* fix create_multi to support flattening

* lint

* use custom classes for flag/segment data model

* use store adapter for safety

* misc cleanup

* misc fixes for persistent stores

* more database store fixes

* support attribute reference lookups in evaluations

* pass logger from client

* context kind logic for big segments + enable big segment contract tests

* formatting fixes + test cleanup

* prerequisite cycle detection

* segment recursion

* define custom classes for event data

* add module init file

* linting

* fix prereq stack logic

* (U2C 17) U2C changes for events, not including private attributes (#205)

* private attribute redaction

* move a lot of code out of top-level modules

* TestData changes for contexts

* general doc comment fixes for 8.0

* U2C configuration updates

* update release metadata

* store flag/segment target lists as sets

* fix type hint

* preprocess clause values for time/regex/semver operators

* fix type checking for matches operator

* Add application info support (#214)

* Add application info support (#214) (#215)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* prepare 7.6.0 release (#192)

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.0

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

* prepare 7.6.1 release (#195)

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.1

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
@tom-hpe-hancock
Copy link

Yes, very interested in this too for python.

LaunchDarklyReleaseBot added a commit that referenced this issue May 1, 2023
* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* (U2C 1) drop EOL Python versions (#189)

* drop EOL Python versions

* misc cleanup, show Python version in CI

* add Python 3.11 CI job

* add Python 3.11 to package metadata

* (U2C 2) remove alias event functionality (#187)

* (U2C 3) remove inline users in events (#188)

* (U2C 4) remove deprecated things (#192)

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* implement context model

* fix exports

* specify exports

* add copy constructor

* minimal changes for SDK methods & evaluator to accept Context

* update tests, add subscript method

* lint

* in type hints, must use Dict[A, B] rather than dict[A, B] for Python <3.9

* support context kind in clauses + enable v2 contract tests

* misc fixes

* misc fixes

* support contextTargets

* support contextKind in rollouts/experiments

* support includedContexts/excludedContexts in segment

* comment copyedit

Co-authored-by: Matthew M. Keeler <[email protected]>

* comment fixes

* rm unused

Co-authored-by: Matthew M. Keeler <[email protected]>

* fix create_multi to support flattening

* lint

* use custom classes for flag/segment data model

* use store adapter for safety

* misc cleanup

* misc fixes for persistent stores

* more database store fixes

* support attribute reference lookups in evaluations

* pass logger from client

* context kind logic for big segments + enable big segment contract tests

* formatting fixes + test cleanup

* prerequisite cycle detection

* segment recursion

* define custom classes for event data

* add module init file

* linting

* fix prereq stack logic

* (U2C 17) U2C changes for events, not including private attributes (#205)

* private attribute redaction

* move a lot of code out of top-level modules

* TestData changes for contexts

* general doc comment fixes for 8.0

* U2C configuration updates

* update release metadata

* store flag/segment target lists as sets

* fix type hint

* preprocess clause values for time/regex/semver operators

* fix type checking for matches operator

* Add application info support (#214)

* Add application info support (#214) (#215)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* prepare 7.6.0 release (#192)

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.0

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

* prepare 7.6.1 release (#195)

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.1

* docs: Fix sphinx documentation failures (#219)

Our documentation file had a configuration issue, which emits a warning
when building with sphinx. This caused the build process on
readthedocs.org to fail because they treat warnings as errors.

We didn't catch this because:

1. Warnings are treated like warnings when generating documentation
   locally.
2. We don't try to generate the documentation as part of our CI process.

This commit should resolve both the underlying issue and the
deficiencies that prevented us from catching this initially.

* Fix documentation generation (#197) (#220)

* fix: Restrict urllib to <2.0.0 (#202)

---------

Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Louis Chan <[email protected]>
Co-authored-by: prpnmac <[email protected]>
LaunchDarklyReleaseBot added a commit that referenced this issue May 3, 2023
* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* (U2C 1) drop EOL Python versions (#189)

* drop EOL Python versions

* misc cleanup, show Python version in CI

* add Python 3.11 CI job

* add Python 3.11 to package metadata

* (U2C 2) remove alias event functionality (#187)

* (U2C 3) remove inline users in events (#188)

* (U2C 4) remove deprecated things (#192)

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* implement context model

* fix exports

* specify exports

* add copy constructor

* minimal changes for SDK methods & evaluator to accept Context

* update tests, add subscript method

* lint

* in type hints, must use Dict[A, B] rather than dict[A, B] for Python <3.9

* support context kind in clauses + enable v2 contract tests

* misc fixes

* misc fixes

* support contextTargets

* support contextKind in rollouts/experiments

* support includedContexts/excludedContexts in segment

* comment copyedit

Co-authored-by: Matthew M. Keeler <[email protected]>

* comment fixes

* rm unused

Co-authored-by: Matthew M. Keeler <[email protected]>

* fix create_multi to support flattening

* lint

* use custom classes for flag/segment data model

* use store adapter for safety

* misc cleanup

* misc fixes for persistent stores

* more database store fixes

* support attribute reference lookups in evaluations

* pass logger from client

* context kind logic for big segments + enable big segment contract tests

* formatting fixes + test cleanup

* prerequisite cycle detection

* segment recursion

* define custom classes for event data

* add module init file

* linting

* fix prereq stack logic

* (U2C 17) U2C changes for events, not including private attributes (#205)

* private attribute redaction

* move a lot of code out of top-level modules

* TestData changes for contexts

* general doc comment fixes for 8.0

* U2C configuration updates

* update release metadata

* store flag/segment target lists as sets

* fix type hint

* preprocess clause values for time/regex/semver operators

* fix type checking for matches operator

* Add application info support (#214)

* Add application info support (#214) (#215)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* prepare 7.6.0 release (#192)

* comment

* add end-to-end unit tests for proxy config

* indents

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.0

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

* prepare 7.6.1 release (#195)

* add 3.8 build

* image name

* fail on SyntaxWarning

* typo

* command syntax

* pin expiringdict dependency for Python 3.3 compatibility

* add Windows CircleCI job

* periods are no longer valid in CircleCI job names

* syntax fix

* install Python in Windows

* set path

* move command

* turn off debug logging

* Py3 in Windows

* config param

* rm redundant step

* choco switch

* refactor Linux jobs using CircleCI 2.1 features

* set log level before anything else

* rm Azure config

* use yaml.safe_load() to avoid code execution vulnerability in file data source

* Initial work on wrapper_name, wrapper_version, diagnostic config
options and start of diagnostic config event creation.

* Python 2 compat changes.

* More event generation code and starting to integrate tracking diagnostic values.

* Add minimum diagnostic recording interval. Fix diagnostic.py to be
importable. Add more diagnostic event fields.

* don't let user fall outside of last bucket in rollout

* fixing conditional logic

* Add docstrings for diagnostic configuration options.

* fix off-by-1 error

* avoid redundant dict lookups

* add unit tests for basic bucketing logic and edge case

* Stream init tracking. Feeding of accumulator object through SDK. Various fixes.

* Track events in last batch.

* Fix sdk version field, some stylistic improvements.

* Last of diagnostic configuration object fields.

* Fill out rest of platform fields.

* Cleanup and failed stream initialization tracking.

* Add diagnostic config option test.

* Add tests for diagnostics.py

* Testing rest of diagnostic fields.

* Test that streaming update processor records successful and unsuccessful
connection attempts in the diagnostic accumulator when available.

* Improvements to testability of event processor.

* Rest of event processor tests.

* Remove janky reflection.

* Test change to filesource optional test requirements.

* [ch61092] Add event payload ID on event requests.

* normalize data store type and OS name in diagnostic events

* gitignore

* copyedit to diagnostic event config property comment

* fix spurious error after sending diagnostic event

* make verify_ssl=False turn off certificate verification too (#129)

* add more TLS config options and collect HTTP/HTTPS config options in a class (#130)

* make stream retry/backoff/jitter behavior consistent with other SDKs + improve testing (#131)

* streams shouldn't use the same read timeout as the rest of the SDK (#132)

* implement our own retry logic & logging for event posts, don't use urllib3.Retry (#133)

* remove support for indirect/patch and indirect/put

* remove unused logic for individual flag/segment poll for indirect/patch

* Ehaisley/84082/remove python2 (#136)

* remove all references to six and remove queue fallback imports

* remove NullHandler logger backwards compat

* update circleci config to remove python 2.7 tests

* remove ordereddict backwards compat

* update setup.py to no longer list python 2.7 as compatible

* no longer inherit from object for python 2 backwards compat

* update readme and manifest to reflect python 2.7 removal

* remove unicode type compatibility

* remove 2.7 support from circleci

* Allow authenticating with proxy

This commit allows for authenticating with a proxy configured with the
`http_proxy` environment variable. Authentication requires passing a
header, and is not parsed by urllib3 from the proxy_url.

* reimplement proxy tests for DRY and add test of proxy auth params

* doc comment on auth params in proxy URL

* add type hints to some of the public facing api.
update some docs

* Revert "add type hints to some of the public facing api."

This reverts commit c35fa61.

* Ehaisley/ch86857/type hints (#138)

* add typehints to the public API
* validate typehints in the public api and tests with mypy

* remove all current deprecations (#139)

* remove all currently deprecated classes, methods, arguments, and tests
* also update semver usage to remove calls to deprecated functions and classes

* remove global set_sdk_key, make SDK key required in Config (#140)

* Removed the guides link

* Pinning mypy and running it against different python versions (#141)

* fix time zone mishandling that could make event debugging not work (#142)

* fix 6.x build (#143)

* fix time zone mishandling that could make event debugging not work (6.x) (#144)

* prepare 6.13.3 release (#154)

* Releasing version 6.13.3

* [ch99756] Add alias events (#145)

* add support for experiment rollouts

* fix unit test

* address PR comments

* use Releaser v2 config

* Use newer docker images (#147)

* Updates docs URLs

* Add support for 3.10 (#150)

* started work on FlagBuilder in as part of test data source implementation

* finished FlagBuilder implementation and added FlagRuleBuilder implementation

* added initial TestData interface and updated tests to not rely on test data internals

* started data source implementation

* changed FlagBuilder to public class; changed FlagBuilder attributes to be initialized in __init__ and eliminated use of try ... except: pass for handling empty attributes

* (big segments 1) add public config/interface types

* added implementation of test data source

* docstring

* formatting

* ensure property doesn't return None

* (big segments 2) implement evaluation, refactor eval logic & modules

* linting

* (big segments 3) implement big segment status tracking, wire up components

* typing fixes

* typing fixes

* implement SSE contract tests

* fix CI

* fix CI again

* fix CI

* disable SSE tests in Python 3.5

* make test service port configurable

* better SSE implementation that fixes linefeed and multi-byte char issues

* fix constructor parameters in test service

* comment

* test improvements

* rm obsolete default config logic

* (big segments 4) implement big segment stores in Redis+DynamoDB, refactor db tests (#158)

* converted ldclient.integrations module from file to directory; started moving public classes out of ldclient.impl.integrations.test_data* and instead into ldclient.integrations.test_data*; started adding TestData documentation

* removed setup/teardown functions leftover from test scaffold

* added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor adjustments to implementation details

* removed warning supression from TestData tests

* fix big segments user hash algorithm to use SHA256

* update mypy version

* updates to tests and related bug fixes

* always cache Big Segment query result even if it's None

* fix test assertion

* lint

* fix big segment ref format

* fix big segments cache TTL being set to wrong value

* fixed structure of fallthrough variation in result of FlagBuilder.build()

* moved __test__ attribute into TestData class definition to prevent mypy from complaining about a missing class attribute

* minor doc comment fix

* Apply suggestions related to Sphinx docstring formatting from code review

Co-authored-by: Eli Bishop <[email protected]>

* fixed errors in the implementation of FlagBuilder's fallthrough_variation and off_variation when passing boolean variation values; updated tests to assert the expected behavior

* added missing value_for_all_users() method to FlagBuilder class

* Fix operator parsing errors (#169)

* identify should not emit event if user key is empty (#164)

* secondary should be treated as built-in attribute (#168)

* URIs should have trailing slashes trimmed (#165)

* all_flags_state should always include flag version (#166)

* output event should not include a null prereqOf key (#167)

* Account for traffic allocation on all flags (#171)

* Add SDK contract tests (#170)

* misc fixes to test data docs + add type hints

* more type hints

* remove some methods from the public test_data API

* can't use "x|y" shortcut in typehints in older Pythons; use Union

* fix misc type mistakes because I forgot to run the linter

* update CONTRIBUTING.md and provide make targets

* fixed a bug with flag rule clause builder internals; added unit test to verify rule evaluation

* added ready argument to _TestDataSource class and indicated ready upon start to avoid delays in TestData initialization

* Update contract tests to latest flask version (#176)

Our contract tests depend on flask v1, which in turn depends on Jinja 2.
Both of these are terribly dated and no longer supported.

Jinja depends on markupsafe. markupsafe recently updated its code to no longer provide
soft_unicode which in turn broke Jinja.

Updating to the latest flask keeps all transitive dependencies better
aligned and addresses this mismatch.

* Adds link to Relay Proxy docs

* Handle explicit None values in test payload (#179)

The test harness may send explicit None values which should be treated
the same as if the value was omitted entirely.

* Fix "unhandled response" error in test harness (#180)

When we return a `('', 204)` response from the flask handler, [Werkzeug
intentionally removes the 'Content-Type' header][1], which causes the
response to be created as a chunked response.

The test harness is likely seeing a 204 response and isn't trying to
read anything more from the stream. But since we are re-using
connections, the next time it reads from the stream, it sees the
`0\r\n\r\n` chunk and outputs an error:

> 2022/04/20 14:23:39 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=<nil>

Changing this response to 202 causes Werkzeug to return an empty
response and silences the error.

[1]: https://github.com/pallets/werkzeug/blob/560dd5f320bff318175f209595d42f5a80045417/src/werkzeug/wrappers/response.py#L540

* Exclude booleans when getting bucketable value (#181)

When calculating a bucket, we get the bucketable value from the
specified bucket by attribute. If this value is a string or an int, we
can use it. Otherwise, we return None.

Python considers a bool an instance of an int, which isn't what we want.
So we need to add an explicit exclusion for this.

* master -> main (#182)

* Loosen restriction on expiringdict (#183)

Originally this was pinned to a max version to deal with the
incompatibility of Python 3.3 and the `typing` package. See [this
PR][1].

Now that we now only support >=3.5, we can safely relax this restriction
again.

[1]: launchdarkly/python-server-sdk-private#120

* Fix mypy type checking (#184)

A [customer requested][original-pr] that we start including a py.typed file in our
repository. This would enable mypy to take advantage of our typehints.
Unfortunately, this didn't completely solve the customers issue.

A [second pr][second-pr] was opened to address the missing step of including the
py.typed file in the `Manifest.in` file. However, this change alone is not
sufficient.

According to the [documentation][include_package_data], you must also
include the `include_package_data=True` directive so that files
specified in the `Manifest.in` file are included in distribution.

[original-pr]: #166
[second-pr]: #172
[include_package_data]: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data

* Add support for extra Redis connection parameters (#185)

* Include wheel artifact when publishing package (#186)

* skip tests that use a self-signed TLS cert in Python 3.7

* remove warn-level logging done for every Big Segments query (#190)

* remove warn-level logging done for every Big Segments query

* skip tests that use a self-signed TLS cert in Python 3.7

* update release metadata

* Add application info support (#214)

* Upgrade pip to fix failing CI build (#216)

The CI build was failing because pip had an outdated list of available wheels for installation. Since it couldn't find a match, it was trying to build a package from source, which requires the rust compiler, which in turn isn't present on some of the docker images.

By updating pip we get the updated list of available wheels, thereby allowing us to bypass source building and the need for the rust compiler entirely.

* Fix double spaces in changelog (#217)

* Fix unsafe access to flag's trackEvents field (#218)

When using the test data source, the trackEvents may not be required.
Additionally, when receiving this information from LD, there is no
guarantee that field will be provided. Instead of assuming that field
always exists on the flag model, we should instead retrieve it with a
default value to prevent index errors.

---------

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>

* Releasing version 7.6.1

* docs: Fix sphinx documentation failures (#219)

Our documentation file had a configuration issue, which emits a warning
when building with sphinx. This caused the build process on
readthedocs.org to fail because they treat warnings as errors.

We didn't catch this because:

1. Warnings are treated like warnings when generating documentation
   locally.
2. We don't try to generate the documentation as part of our CI process.

This commit should resolve both the underlying issue and the
deficiencies that prevented us from catching this initially.

* Fix documentation generation (#197) (#220)

* fix: Restrict urllib to <2.0.0 (#202)

* ci: Generate coverage as part of standard CI (#222)

---------

Co-authored-by: Elliot <[email protected]>
Co-authored-by: Elliot <[email protected]>
Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: hroederld <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Robert J. Neal <[email protected]>
Co-authored-by: Ember Stevens <[email protected]>
Co-authored-by: ember-stevens <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: charukiewicz <[email protected]>
Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
Co-authored-by: Christian Charukiewicz <[email protected]>
Co-authored-by: Matthew M. Keeler <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Gavin Whelan <[email protected]>
Co-authored-by: Gabor Angeli <[email protected]>
Co-authored-by: Louis Chan <[email protected]>
Co-authored-by: prpnmac <[email protected]>
@mabreuortega
Copy link

we are stuck too :-(

@Juanito98
Copy link

Any updates?

@dor1202
Copy link

dor1202 commented Oct 26, 2023

@eli-darkly @eplusminus @keelerm84 @keelerm84 No update for more than a year 😟. Do you guys have any updates?

@rolyv
Copy link

rolyv commented Feb 6, 2024

I'm wondering if this is not a huge concern for async python based on how launchdarkly is architected. As I understand based on the LD docs, evaluating a flag should not be a blocking I/O call. Instead, the client has a local copy of the flag values and evaluation is a very fast operation. If so, it shouldn't be an issue for async code, right? I'm not an expert here, so would appreciate if any of the maintainers could comment on this.

@nikitagromov
Copy link

@rolyv They are doing sync requests in separate threads for streaming part of API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests