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

prepare 7.2.1 release #160

Merged
merged 354 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
354 commits
Select commit Hold shift + click to select a range
f612360
Merge pull request #94 from launchdarkly/eb/ch17280/doc-templates
eli-darkly Feb 5, 2019
74e82c8
misc. doc comment edits
eli-darkly Feb 6, 2019
9316b0d
use RTD theme
eli-darkly Feb 6, 2019
794e59f
Merge pull request #92 from launchdarkly/hr/azure
hroederld Feb 6, 2019
5df3b55
Merge pull request #95 from launchdarkly/eb/ch17280/edits
eli-darkly Feb 6, 2019
5eee9ba
Merge pull request #96 from launchdarkly/eb/ch17280/rtd-theme
eli-darkly Feb 6, 2019
338910c
remove jsonpickle
eli-darkly Feb 11, 2019
f586cd1
misc doc comment/readme edits prior to publishing docs
eli-darkly Feb 11, 2019
125d359
Merge pull request #97 from launchdarkly/eb/ch31867/jsonpickle
eli-darkly Feb 12, 2019
0972671
Merge pull request #98 from launchdarkly/eb/ch17280/doc-edits
eli-darkly Feb 12, 2019
dc1f394
merge from public after release
LaunchDarklyCI Feb 12, 2019
9731f4d
add git placeholders for unused dirs
eli-darkly Feb 13, 2019
acfe58e
Merge branch 'master' of github.com:launchdarkly/python-client
eli-darkly Feb 13, 2019
87336db
use default theme
eli-darkly Feb 13, 2019
c7a67dc
Merge branch 'master' of github.com:launchdarkly/python-client
eli-darkly Feb 13, 2019
2dedbc4
add experimentation event overrides for rules and fallthrough
eli-darkly Feb 25, 2019
6846ba1
a little more test coverage
eli-darkly Feb 25, 2019
c514216
rm unnecessary logic
eli-darkly Feb 26, 2019
afab05d
more factory methods
eli-darkly Feb 26, 2019
e0c563c
Merge pull request #99 from launchdarkly/eb/ch32305/experiment
eli-darkly Feb 28, 2019
84198a3
try python -m instead of pytest directly
hroederld Mar 1, 2019
80411dd
add setuptools
hroederld Mar 1, 2019
52c0a19
use python -m for all of pip
hroederld Mar 1, 2019
5bdea5f
add UsePythonVersion task
hroederld Mar 1, 2019
60a66a8
fix indent
hroederld Mar 1, 2019
1907d75
remove manually adding setuptools
hroederld Mar 1, 2019
7cdf9fc
add on 3.7 stages
hroederld Mar 2, 2019
1023d45
fix mkdir for reports
hroederld Mar 2, 2019
b9778b6
upload test artifacts
hroederld Mar 2, 2019
945fc07
Merge pull request #100 from launchdarkly/hr/azurepytest
hroederld Mar 2, 2019
7738c99
Merge commit '327aaac4a5c419ea45d3723d4a87309f67da4a40'
eli-darkly Mar 13, 2019
e5d5e41
skip trying to load pyyaml in Python 3.3
eli-darkly Mar 26, 2019
fd883cd
can't use watchdog in Python 3.3
eli-darkly Mar 26, 2019
b3dc4c4
mark test as skipped
eli-darkly Mar 26, 2019
bd4daf7
Merge pull request #101 from launchdarkly/eb/ch34481/pyyaml-py3.3
eli-darkly Mar 26, 2019
803a794
coerce user attributes into strings when necessary, don't send events…
eli-darkly Mar 29, 2019
b7035a5
more unit tests
eli-darkly Mar 29, 2019
44101b2
remove redundant sanitize step
eli-darkly Mar 29, 2019
4b8ee84
Merge pull request #102 from launchdarkly/eb/ch35206/stringify-attrs
eli-darkly Mar 29, 2019
dd67a7c
merge from public after release
LaunchDarklyCI Mar 29, 2019
ddfb3c2
ensure that client components are cleaned up correct in every configu…
eli-darkly Apr 9, 2019
4ca26c7
Merge pull request #103 from launchdarkly/eb/ch36211/close-ldd
eli-darkly Apr 9, 2019
7585684
miscellaneous test fixes
eli-darkly Apr 9, 2019
a164906
Merge pull request #104 from launchdarkly/eb/fix-tests
eli-darkly Apr 9, 2019
143b66a
merge from public after release
LaunchDarklyCI Apr 10, 2019
6763b54
Merge branch 'master' into experiment
eli-darkly Apr 13, 2019
3b16ebf
support metric value with track()
eli-darkly Apr 13, 2019
2f6961d
update method description
eli-darkly Apr 17, 2019
a166adb
Merge pull request #105 from launchdarkly/eb/ch32305/metric-value
eli-darkly Apr 17, 2019
950d2b3
Merge branch 'master' of github.com:launchdarkly/python-client
eli-darkly Apr 24, 2019
902be02
update readme format and repo links
eli-darkly Apr 26, 2019
f41f2cc
allow unit tests to be run without databases
eli-darkly Apr 26, 2019
d764fd8
add missing test
eli-darkly Apr 26, 2019
91b1250
Merge pull request #107 from launchdarkly/eb/ch37610/no-db-tests
eli-darkly Apr 26, 2019
ea5d8e8
rm FOSSA link/badge
eli-darkly Apr 26, 2019
6ed12f1
misc fixes
eli-darkly Apr 26, 2019
6cd745f
Merge pull request #106 from launchdarkly/eb/ch36754/readme-update
eli-darkly Apr 26, 2019
1fba96f
merge from public after release
LaunchDarklyCI Apr 26, 2019
cbac044
minor doc link fix
eli-darkly Apr 26, 2019
52c3b23
fix skipping of database tests
eli-darkly May 1, 2019
6d105a9
Merge pull request #109 from launchdarkly/eb/ch37610/fix-skip-db-tests
eli-darkly May 1, 2019
6161055
renaming the package to launchdarkly-server-sdk (#108)
bwoskow-ld May 1, 2019
47f2e3e
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
bwoskow-ld May 2, 2019
ac3b1e8
merge from public after release
LaunchDarklyCI May 2, 2019
b9011c0
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
bwoskow-ld May 3, 2019
83450d9
Merge branch 'master' of github.com:launchdarkly/python-server-sdk-pr…
bwoskow-ld May 3, 2019
34b15f5
use log.warning(), not log.warn() or warnings.warn()
eli-darkly Jun 11, 2019
3a03ea5
Merge pull request #110 from launchdarkly/eb/ch40725/log-warnings
eli-darkly Jun 11, 2019
b472691
merge from public after release
LaunchDarklyCI Jun 11, 2019
c990266
drop events when inbox is full
eli-darkly Aug 19, 2019
e436f77
rm obsolete pytest.raises parameter
eli-darkly Aug 19, 2019
1e068c9
clean up test state management
eli-darkly Aug 20, 2019
4b74fcf
typo
eli-darkly Aug 20, 2019
e5dd5ba
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Aug 20, 2019
71a24f2
Merge branch 'master' into experiment
eli-darkly Aug 20, 2019
be6ee0d
Merge pull request #111 from launchdarkly/eb/ch42975/inbox-full
eli-darkly Aug 20, 2019
623687d
merge from public after release
LaunchDarklyCI Aug 20, 2019
0b0b636
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Aug 20, 2019
03f7a86
merge from public after release
eli-darkly Aug 20, 2019
16f3d43
Merge branch 'experiment'
eli-darkly Aug 20, 2019
ee7a51c
store the package version in just one place
eli-darkly Aug 20, 2019
1c10e1e
fix package reference
eli-darkly Aug 20, 2019
d9c96dd
add requirements
eli-darkly Aug 20, 2019
73d20f7
don't import ldclient.version directly
eli-darkly Aug 20, 2019
0a0aa8f
Revert "add requirements"
eli-darkly Aug 20, 2019
11f0da6
fix merge error + adjust for some event properties now being optional
eli-darkly Aug 20, 2019
17bfa5a
fix summary logic again for now-optional event properties
eli-darkly Aug 20, 2019
8bb3375
merge from public after release
LaunchDarklyCI Aug 20, 2019
67eb763
merge from public after release
eli-darkly Aug 20, 2019
53b981a
Merge branch 'master' into eb/test-cleanup
eli-darkly Aug 20, 2019
500fa28
Merge branch 'master' into eb/package-version
eli-darkly Aug 20, 2019
42ad0be
Merge pull request #112 from launchdarkly/eb/test-cleanup
eli-darkly Aug 20, 2019
1154981
Merge pull request #114 from launchdarkly/eb/package-version
eli-darkly Aug 20, 2019
a5da010
Allow explicitly proxying only ld requests (#130)
gangeli Oct 25, 2019
69f2233
fix broken indirect/patch request, add tests for feature requestor
eli-darkly Oct 28, 2019
0fa5e05
Python 2/3 compatibility for HTTPServer
eli-darkly Oct 28, 2019
e75ff0f
Py2/3 compatibility: queue
eli-darkly Oct 28, 2019
68161a2
more Py3 compatibility
eli-darkly Oct 28, 2019
74c9eed
don't need import of builtins
eli-darkly Oct 28, 2019
032b04c
fix string encoding
eli-darkly Oct 28, 2019
89ce3e2
implement setting proxy URL by environment variable
eli-darkly Oct 29, 2019
ae764b5
rm debugging
eli-darkly Oct 29, 2019
28ee4b5
fix autodoc options to exclude magic methods
eli-darkly Oct 29, 2019
4cbcd30
Merge pull request #115 from launchdarkly/eb/ch54217/indirect-patch
eli-darkly Oct 30, 2019
9fb16a6
Merge pull request #117 from launchdarkly/eb/ch38000/fix-doc-config
eli-darkly Oct 30, 2019
d47c315
Merge pull request #116 from launchdarkly/eb/ch53090/proxy-var
eli-darkly Oct 30, 2019
3dddca2
merge from public after release
LaunchDarklyCI Oct 30, 2019
9435aee
add config option for proxy URL
eli-darkly Oct 31, 2019
4fc6ce7
comment
eli-darkly Oct 31, 2019
00432be
add end-to-end unit tests for proxy config
eli-darkly Oct 31, 2019
5911fd9
indents
eli-darkly Oct 31, 2019
ba52cae
Merge pull request #118 from launchdarkly/eb/ch52414/proxy-config
eli-darkly Oct 31, 2019
28b22b8
merge from public after release
LaunchDarklyCI Oct 31, 2019
35faf7d
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
bwoskow-ld Nov 7, 2019
63125f5
add 3.8 build
eli-darkly Nov 21, 2019
3c68cd2
image name
eli-darkly Nov 21, 2019
9b1adf3
fail on SyntaxWarning
eli-darkly Nov 21, 2019
6a954e3
typo
eli-darkly Nov 21, 2019
d6bf44c
command syntax
eli-darkly Nov 21, 2019
7ec6974
Merge pull request #119 from launchdarkly/eb/ch56849/py3.8
eli-darkly Nov 21, 2019
7fda088
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Nov 21, 2019
7b3177f
pin expiringdict dependency for Python 3.3 compatibility
eli-darkly Nov 21, 2019
9942d77
add Windows CircleCI job
eli-darkly Nov 21, 2019
38f3f43
periods are no longer valid in CircleCI job names
eli-darkly Nov 21, 2019
c969db2
syntax fix
eli-darkly Nov 21, 2019
bc31ec9
install Python in Windows
eli-darkly Nov 21, 2019
64486a3
set path
eli-darkly Nov 21, 2019
37509ff
move command
eli-darkly Nov 21, 2019
3b41766
turn off debug logging
eli-darkly Nov 21, 2019
ef68058
Py3 in Windows
eli-darkly Nov 21, 2019
0c93df7
config param
eli-darkly Nov 21, 2019
86d27a8
rm redundant step
eli-darkly Nov 21, 2019
001e196
choco switch
eli-darkly Nov 21, 2019
121ec89
Merge pull request #120 from launchdarkly/eb/ch55512/py3.3-deps
eli-darkly Nov 21, 2019
9905cd5
Merge branch 'master' into eb/ch56746/windows-ci
eli-darkly Nov 21, 2019
23a4222
refactor Linux jobs using CircleCI 2.1 features
eli-darkly Nov 21, 2019
a5aaa99
set log level before anything else
eli-darkly Nov 21, 2019
9e40321
rm Azure config
eli-darkly Nov 21, 2019
d69fba0
Merge pull request #121 from launchdarkly/eb/ch56746/windows-ci
eli-darkly Nov 21, 2019
3e9c68b
merge from public after release
LaunchDarklyCI Nov 21, 2019
669e772
use yaml.safe_load() to avoid code execution vulnerability in file da…
eli-darkly Dec 9, 2019
4483990
Merge pull request #122 from launchdarkly/eb/ch58025/yaml-load
eli-darkly Dec 9, 2019
8248bae
merge from public after release
LaunchDarklyCI Dec 10, 2019
52238d1
Initial work on wrapper_name, wrapper_version, diagnostic config
gwhelanLD Dec 16, 2019
38d08bd
Python 2 compat changes.
gwhelanLD Dec 17, 2019
e3eb3ee
More event generation code and starting to integrate tracking diagnos…
gwhelanLD Dec 17, 2019
2d80198
Add minimum diagnostic recording interval. Fix diagnostic.py to be
gwhelanLD Dec 20, 2019
7fd454f
don't let user fall outside of last bucket in rollout
bwoskow-ld Dec 24, 2019
588f352
fixing conditional logic
bwoskow-ld Dec 24, 2019
7b357b0
Add docstrings for diagnostic configuration options.
gwhelanLD Dec 28, 2019
af5a162
fix off-by-1 error
eli-darkly Dec 30, 2019
75a9aab
avoid redundant dict lookups
eli-darkly Dec 30, 2019
590ca64
add unit tests for basic bucketing logic and edge case
eli-darkly Dec 30, 2019
8ce7cb8
Merge pull request #123 from launchdarkly/bw/ch43307/bucket-issue
eli-darkly Dec 30, 2019
87617a3
merge from public after release
LaunchDarklyCI Dec 30, 2019
0f09a73
Stream init tracking. Feeding of accumulator object through SDK. Vari…
gwhelanLD Dec 30, 2019
e50ad29
Track events in last batch.
gwhelanLD Dec 30, 2019
f6ad201
Fix sdk version field, some stylistic improvements.
gwhelanLD Dec 30, 2019
781c2ba
Merge branch 'diag-events' into gw/ch59328/diagnostic-events
gwhelanLD Dec 30, 2019
0375f70
Last of diagnostic configuration object fields.
gwhelanLD Dec 31, 2019
5f2ca11
Fill out rest of platform fields.
gwhelanLD Dec 31, 2019
49a4ea9
Cleanup and failed stream initialization tracking.
gwhelanLD Dec 31, 2019
6f9ca76
Add diagnostic config option test.
gwhelanLD Dec 31, 2019
aa703fb
Add tests for diagnostics.py
gwhelanLD Dec 31, 2019
18d7340
Testing rest of diagnostic fields.
gwhelanLD Dec 31, 2019
c6904c7
Test that streaming update processor records successful and unsuccessful
gwhelanLD Dec 31, 2019
0f9f65c
Improvements to testability of event processor.
gwhelanLD Jan 2, 2020
689b231
Rest of event processor tests.
gwhelanLD Jan 2, 2020
08740f1
Remove janky reflection.
gwhelanLD Jan 6, 2020
a26d458
Test change to filesource optional test requirements.
gwhelanLD Jan 6, 2020
6d5945a
[ch59328] Diagnostic events
gwhelanLD Jan 14, 2020
ef256a5
[ch61092] Add event payload ID on event requests.
gwhelanLD Jan 17, 2020
2866b6d
Merge branch 'master' into diag-events
eli-darkly Feb 11, 2020
3a525e3
normalize data store type and OS name in diagnostic events
eli-darkly Feb 11, 2020
425dceb
gitignore
eli-darkly Feb 11, 2020
71c85b8
Merge pull request #126 from launchdarkly/eb/ch62088/spec-updates
eli-darkly Feb 11, 2020
27fb9a7
copyedit to diagnostic event config property comment
eli-darkly Feb 11, 2020
c93e4ff
Merge pull request #127 from launchdarkly/eb/ch59328/diag-config-comment
eli-darkly Feb 11, 2020
1b0be34
merge from public after release
LaunchDarklyCI Feb 11, 2020
13ddc54
fix spurious error after sending diagnostic event
eli-darkly Feb 12, 2020
a4fc092
Merge pull request #128 from launchdarkly/eb/ch65536/diag-events-warn…
eli-darkly Feb 12, 2020
02f5626
merge from public after release
LaunchDarklyCI Feb 12, 2020
ad248d6
make verify_ssl=False turn off certificate verification too (#129)
eli-darkly Mar 19, 2020
e754335
merge from public after release
LaunchDarklyCI Mar 20, 2020
b7d081b
add more TLS config options and collect HTTP/HTTPS config options in …
eli-darkly Mar 25, 2020
770fd71
make stream retry/backoff/jitter behavior consistent with other SDKs …
eli-darkly Mar 27, 2020
4016887
streams shouldn't use the same read timeout as the rest of the SDK (#…
eli-darkly Mar 30, 2020
f7ec18a
merge from public after release
LaunchDarklyCI Mar 30, 2020
02a803f
implement our own retry logic & logging for event posts, don't use ur…
eli-darkly May 9, 2020
50f2d94
remove support for indirect/patch and indirect/put
eli-darkly Jun 23, 2020
a246026
Merge pull request #134 from launchdarkly/eb/ch80666/no-indirect-patch
eli-darkly Jun 23, 2020
a9fe218
remove unused logic for individual flag/segment poll for indirect/patch
eli-darkly Jun 25, 2020
aaa9455
Merge pull request #135 from launchdarkly/eb/ch80666/no-indirect-patch
eli-darkly Jun 26, 2020
89fa623
merge from public after release
LaunchDarklyCI Jul 13, 2020
e1c93da
Ehaisley/84082/remove python2 (#136)
apache-hb Jul 30, 2020
3095315
Allow authenticating with proxy
gangeli Sep 15, 2020
eb7fc76
Merge pull request #145 from gangeli/master
eli-darkly Sep 16, 2020
14dfd8e
Merge branch 'contrib' of github.com:launchdarkly/python-server-sdk i…
eli-darkly Sep 16, 2020
1de0769
reimplement proxy tests for DRY and add test of proxy auth params
eli-darkly Sep 21, 2020
ed01be0
doc comment on auth params in proxy URL
eli-darkly Sep 16, 2020
6d98ae7
Merge pull request #137 from launchdarkly/eb/ch89791/proxy-auth-in-url
eli-darkly Sep 21, 2020
7bff994
Merge branch '6.x' of github.com:launchdarkly/python-server-sdk into 6.x
eli-darkly Sep 21, 2020
8d34668
merge from public after release
LaunchDarklyCI Sep 21, 2020
b5213b2
Merge branch '6.x'
eli-darkly Sep 22, 2020
c35fa61
add type hints to some of the public facing api.
apache-hb Sep 28, 2020
7745881
Revert "add type hints to some of the public facing api."
apache-hb Sep 28, 2020
43b4c31
Ehaisley/ch86857/type hints (#138)
apache-hb Oct 15, 2020
58b5bc3
remove all current deprecations (#139)
apache-hb Oct 27, 2020
b35ec6e
remove global set_sdk_key, make SDK key required in Config (#140)
eli-darkly Oct 27, 2020
5e3e5c5
Merge branch '6.x' of github.com:launchdarkly/python-server-sdk-private
eli-darkly Oct 28, 2020
3b904f3
merge from public after release
LaunchDarklyCI Oct 28, 2020
eb65618
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Oct 28, 2020
ebd092d
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Nov 25, 2020
528dc22
merge from public after release
LaunchDarklyCI Nov 26, 2020
e5f6450
Removed the guides link
bwoskow-ld Feb 3, 2021
4d2e999
Pinning mypy and running it against different python versions (#141)
bwoskow-ld Feb 5, 2021
1cc83f5
fix time zone mishandling that could make event debugging not work (#…
eli-darkly Feb 19, 2021
dc955d3
merge from public after release
LaunchDarklyCI Feb 19, 2021
5fa5966
fix 6.x build (#143)
eli-darkly Feb 23, 2021
c9d6ec6
fix time zone mishandling that could make event debugging not work (6…
eli-darkly Feb 23, 2021
f9ce3b9
prepare 6.13.3 release (#154)
LaunchDarklyCI Feb 23, 2021
953c126
Releasing version 6.13.3
LaunchDarklyCI Feb 23, 2021
faec38d
merge from public after release
LaunchDarklyCI Feb 23, 2021
b740df9
Merge branch '6.x'
eli-darkly Feb 24, 2021
532a01b
[ch99756] Add alias events (#145)
hroederld Mar 11, 2021
35227bf
merge from public after release
LaunchDarklyCI Mar 12, 2021
8c327d0
add support for experiment rollouts
robertjneal Apr 29, 2021
31c1c21
fix unit test
robertjneal Apr 29, 2021
f52ab39
address PR comments
robertjneal May 6, 2021
15f9a97
Merge pull request #146 from launchdarkly/rneal/ch101662/add-support-…
robertjneal May 11, 2021
741a076
merge from public after release
LaunchDarklyCI Jun 17, 2021
527f366
use Releaser v2 config
eli-darkly Sep 21, 2021
d2528ed
Use newer docker images (#147)
bwoskow-ld Sep 22, 2021
8852138
Merge pull request #148 from launchdarkly/eb/ch118712/releaser-v2
eli-darkly Sep 23, 2021
666e5f0
Updates docs URLs
ember-stevens Sep 24, 2021
1db3507
Merge pull request #149 from launchdarkly/emberstevens/sc-118589/url-…
ember-stevens Sep 27, 2021
3286623
Add support for 3.10 (#150)
keelerm84 Oct 6, 2021
7439e1f
implement SSE contract tests
eli-darkly Dec 2, 2021
e67d915
fix CI
eli-darkly Dec 2, 2021
38d15c9
fix CI again
eli-darkly Dec 2, 2021
fb93d87
fix CI
eli-darkly Dec 2, 2021
2cd71a6
disable SSE tests in Python 3.5
eli-darkly Dec 2, 2021
aa24aac
make test service port configurable
eli-darkly Dec 2, 2021
9414b33
better SSE implementation that fixes linefeed and multi-byte char issues
eli-darkly Dec 3, 2021
3588db7
fix constructor parameters in test service
eli-darkly Dec 3, 2021
8efc7bf
comment
eli-darkly Dec 3, 2021
7fdd3b3
test improvements
eli-darkly Dec 3, 2021
e76aef1
rm obsolete default config logic
eli-darkly Dec 3, 2021
fd1e067
Merge pull request #157 from launchdarkly/eb/sc-133195+sc-133324/bett…
eli-darkly Dec 3, 2021
7c986d6
Merge pull request #156 from launchdarkly/eb/sc-125613/sse-contract-t…
eli-darkly Dec 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ workflows:
jobs:
- test-linux:
name: Python 3.5
docker-image: circleci/python:3.5-jessie
docker-image: cimg/python:3.5
skip-sse-contract-tests: true # the test service app has dependencies that aren't available in 3.5, which is EOL anyway
- test-linux:
name: Python 3.6
docker-image: circleci/python:3.6-jessie
docker-image: cimg/python:3.6
- test-linux:
name: Python 3.7
docker-image: circleci/python:3.7-stretch
docker-image: cimg/python:3.7
- test-linux:
name: Python 3.8
docker-image: circleci/python:3.8-buster
docker-image: cimg/python:3.8
- test-linux:
name: Python 3.9
docker-image: circleci/python:3.9-rc-buster
docker-image: cimg/python:3.9
- test-linux:
name: Python 3.10
docker-image: cimg/python:3.10
- test-windows:
name: Windows Python 3
py3: true
Expand All @@ -39,6 +43,9 @@ jobs:
test-with-mypy:
type: boolean
default: true
skip-sse-contract-tests:
type: boolean
default: false
docker:
- image: <<parameters.docker-image>>
- image: redis
Expand All @@ -49,12 +56,10 @@ jobs:
- run:
name: install requirements
command: |
sudo pip install --upgrade pip;
sudo pip install 'virtualenv~=16.0';
sudo pip install -r test-requirements.txt;
sudo pip install -r test-filesource-optional-requirements.txt;
sudo pip install -r consul-requirements.txt;
sudo python setup.py install;
pip install -r test-requirements.txt;
pip install -r test-filesource-optional-requirements.txt;
pip install -r consul-requirements.txt;
python setup.py install;
pip freeze
- when:
condition: <<parameters.test-with-codeclimate>>
Expand Down Expand Up @@ -89,6 +94,21 @@ jobs:
command: |
export PATH="/home/circleci/.local/bin:$PATH"
mypy --config-file mypy.ini ldclient testing

- unless:
condition: <<parameters.skip-sse-contract-tests>>
steps:
- run:
name: build SSE contract test service
command: cd sse-contract-tests && make build-test-service
- run:
name: start SSE contract test service
command: cd sse-contract-tests && make start-test-service
background: true
- run:
name: run SSE contract tests
command: cd sse-contract-tests && make run-contract-tests

- store_test_results:
path: test-reports
- store_artifacts:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ p2venv
test-packaging-venv

.vscode/
.python-version
14 changes: 9 additions & 5 deletions .ldrelease/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

repo:
public: python-server-sdk
private: python-server-sdk-private
Expand All @@ -8,15 +10,17 @@ publications:
- url: https://launchdarkly-python-sdk.readthedocs.io/en/latest/
description: documentation (readthedocs.io)

releasableBranches:
branches:
- name: master
description: 7.x
- name: 6.x

template:
name: python
env:
LD_SKIP_DATABASE_TESTS: 1
jobs:
- docker: {}
template:
name: python
env:
LD_SKIP_DATABASE_TESTS: 1

sdk:
displayName: "Python"
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ Note that starting with this release, generated API documentation is available o

## [6.8.0] - 2019-01-31
### Added:
- It is now possible to use Consul as a persistent feature store, similar to the existing Redis and DynamoDB integrations. See `Consul` in `ldclient.integrations`, and the reference guide for ["Using a persistent feature store"](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store).
- It is now possible to use Consul as a persistent feature store, similar to the existing Redis and DynamoDB integrations. See `Consul` in `ldclient.integrations`, and the reference guide for ["Storing data"](https://docs.launchdarkly.com/sdk/features/storing-data#python).

## [6.7.0] - 2019-01-15
### Added:
- It is now possible to use DynamoDB as a persistent feature store, similar to the existing Redis integration. See `DynamoDB` in `ldclient.integrations`, and the reference guide to ["Using a persistent feature store"](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store).
- It is now possible to use DynamoDB as a persistent feature store, similar to the existing Redis integration. See `DynamoDB` in `ldclient.integrations`, and the reference guide to ["Storing data"](https://docs.launchdarkly.com/sdk/features/storing-data#python).
- The new class `CacheConfig` (in `ldclient.feature_store`) encapsulates all the parameters that control local caching in database feature stores. This takes the place of the `expiration` and `capacity` parameters that are in the deprecated `RedisFeatureStore` constructor; it can be used with DynamoDB and any other database integrations in the future, and if more caching options are added to `CacheConfig` they will be automatically supported in all of the feature stores.

### Deprecated:
Expand Down Expand Up @@ -261,7 +261,7 @@ _This release was broken and has been removed._
## [6.0.0] - 2018-05-10

### Changed:
- To reduce the network bandwidth used for analytics events, feature request events are now sent as counters rather than individual events, and user details are now sent only at intervals rather than in each event. These behaviors can be modified through the LaunchDarkly UI and with the new configuration option `inline_users_in_events`. For more details, see [Analytics Data Stream Reference](https://docs.launchdarkly.com/v2.0/docs/analytics-data-stream-reference).
- To reduce the network bandwidth used for analytics events, feature request events are now sent as counters rather than individual events, and user details are now sent only at intervals rather than in each event. These behaviors can be modified through the LaunchDarkly UI and with the new configuration option `inline_users_in_events`.
- The analytics event processor now flushes events at a configurable interval defaulting to 5 seconds, like the other SDKs (previously it flushed if no events had been posted for 5 seconds, or if events exceeded a configurable number). This interval is set by the new `Config` property `flush_interval`.

### Removed:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to the LaunchDarkly Server-side SDK for Python

LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.

## Submitting bug reports and feature requests

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

## LaunchDarkly overview

[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!

[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)

## Supported Python versions

This version of the LaunchDarkly SDK is compatible with Python 3.5 through 3.9. It is tested with the most recent patch releases of those versions. Python versions 2.7 to 3.4 are no longer supported.
This version of the LaunchDarkly SDK is compatible with Python 3.5 through 3.10. It is tested with the most recent patch releases of those versions. Python versions 2.7 to 3.4 are no longer supported.

## Getting started

Refer to the [SDK reference guide](https://docs.launchdarkly.com/docs/python-sdk-reference) for instructions on getting started with using the SDK.
Refer to the [SDK reference guide](https://docs.launchdarkly.com/sdk/server-side/python) for instructions on getting started with using the SDK.

## Learn more

Expand All @@ -40,7 +40,7 @@ We encourage pull requests and other contributions from the community. Check out
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
* Explore LaunchDarkly
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is the API reference for the `LaunchDarkly <https://launchdarkly.com/>`_ SD

The latest version of the SDK can be found on `PyPI <https://pypi.org/project/launchdarkly-server-sdk/>`_, and the source code is on `GitHub <https://github.com/launchdarkly/python-server-sdk>`_.

For more information, see LaunchDarkly's `Quickstart <https://docs.launchdarkly.com/docs>`_ and `SDK Reference Guide <http://docs.launchdarkly.com/docs/python-sdk-reference>`_.
For more information, see LaunchDarkly's `Quickstart <https://docs.launchdarkly.com/home>`_ and `SDK Reference Guide <https://docs.launchdarkly.com/sdk/server-side/python>`_.

.. toctree::
:maxdepth: 2
Expand Down
2 changes: 1 addition & 1 deletion ldclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def all_flags_state(self, user: dict, **kwargs) -> FeatureFlagsState:
"""Returns an object that encapsulates the state of all feature flags for a given user,
including the flag values and also metadata that can be used on the front end. See the
JavaScript SDK Reference Guide on
`Bootstrapping <https://docs.launchdarkly.com/docs/js-sdk-reference#section-bootstrapping>`_.
`Bootstrapping <https://docs.launchdarkly.com/sdk/features/bootstrapping#javascript>`_.

This method does not send analytics events back to LaunchDarkly.

Expand Down
2 changes: 1 addition & 1 deletion ldclient/flags_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FeatureFlagsState:
calling the :func:`ldclient.client.LDClient.all_flags_state()` method. Serializing this
object to JSON, using the :func:`to_json_dict` method or ``jsonpickle``, will produce the
appropriate data structure for bootstrapping the LaunchDarkly JavaScript client. See the
JavaScript SDK Reference Guide on `Bootstrapping <https://docs.launchdarkly.com/docs/js-sdk-reference#section-bootstrapping>`_.
JavaScript SDK Reference Guide on `Bootstrapping <https://docs.launchdarkly.com/sdk/features/bootstrapping#javascript>`_.
"""
def __init__(self, valid: bool):
self.__flag_values = {} # type: Dict[str, Any]
Expand Down
191 changes: 191 additions & 0 deletions ldclient/impl/sse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
import urllib3

from ldclient.config import HTTPConfig
from ldclient.impl.http import HTTPFactory
from ldclient.util import throw_if_unsuccessful_response


class _BufferedLineReader:
"""
Helper class that encapsulates the logic for reading UTF-8 stream data as a series of text lines,
each of which can be terminated by \n, \r, or \r\n.
"""
def lines_from(chunks):
"""
Takes an iterable series of encoded chunks (each of "bytes" type) and parses it into an iterable
series of strings, each of which is one line of text. The line does not include the terminator.
"""
last_char_was_cr = False
partial_line = None

for chunk in chunks:
if len(chunk) == 0:
continue

# bytes.splitlines() will correctly break lines at \n, \r, or \r\n, and is faster than
# iterating through the characters in Python code. However, we have to adjust the results
# in several ways as described below.
lines = chunk.splitlines()
if last_char_was_cr:
last_char_was_cr = False
if chunk[0] == 10:
# If the last character we saw was \r, and then the first character in buf is \n, then
# that's just a single \r\n terminator, so we should remove the extra blank line that
# splitlines added for that first \n.
lines.pop(0)
if len(lines) == 0:
continue # ran out of data, continue to get next chunk
if partial_line is not None:
# On our last time through the loop, we ended up with an unterminated line, so we should
# treat our first parsed line here as a continuation of that.
lines[0] = partial_line + lines[0]
partial_line = None
# Check whether the buffer really ended in a terminator. If it did not, then the last line in
# lines is a partial line and should not be emitted yet.
last_char = chunk[len(chunk)-1]
if last_char == 13:
last_char_was_cr = True # remember this in case the next chunk starts with \n
elif last_char != 10:
partial_line = lines.pop() # remove last element which is the partial line
for line in lines:
yield line.decode()


class Event:
"""
An event received by SSEClient.
"""
def __init__(self, event='message', data='', last_event_id=None):
self._event = event
self._data = data
self._id = last_event_id

@property
def event(self):
"""
The event type, or "message" if not specified.
"""
return self._event

@property
def data(self):
"""
The event data.
"""
return self._data

@property
def last_event_id(self):
"""
The last non-empty "id" value received from this stream so far.
"""
return self._id

def dump(self):
lines = []
if self.id:
lines.append('id: %s' % self.id)

# Only include an event line if it's not the default already.
if self.event != 'message':
lines.append('event: %s' % self.event)

lines.extend('data: %s' % d for d in self.data.split('\n'))
return '\n'.join(lines) + '\n\n'


class SSEClient:
"""
A simple Server-Sent Events client.

This implementation does not include automatic retrying of a dropped connection; the caller will do that.
If a connection ends, the events iterator will simply end.
"""
def __init__(self, url, last_id=None, http_factory=None, **kwargs):
self.url = url
self.last_id = last_id
self._chunk_size = 10000

if http_factory is None:
http_factory = HTTPFactory({}, HTTPConfig())
self._timeout = http_factory.timeout
base_headers = http_factory.base_headers

self.http = http_factory.create_pool_manager(1, url)

# Any extra kwargs will be fed into the request call later.
self.requests_kwargs = kwargs

# The SSE spec requires making requests with Cache-Control: nocache
if 'headers' not in self.requests_kwargs:
self.requests_kwargs['headers'] = {}

self.requests_kwargs['headers'].update(base_headers)

self.requests_kwargs['headers']['Cache-Control'] = 'no-cache'

# The 'Accept' header is not required, but explicit > implicit
self.requests_kwargs['headers']['Accept'] = 'text/event-stream'

self._connect()

def _connect(self):
if self.last_id:
self.requests_kwargs['headers']['Last-Event-ID'] = self.last_id

# Use session if set. Otherwise fall back to requests module.
self.resp = self.http.request(
'GET',
self.url,
timeout=self._timeout,
preload_content=False,
retries=0, # caller is responsible for implementing appropriate retry semantics, e.g. backoff
**self.requests_kwargs)

# Raw readlines doesn't work because we may be missing newline characters until the next chunk
# For some reason, we also need to specify a chunk size because stream=True doesn't seem to guarantee
# that we get the newlines in a timeline manner
self.resp_file = self.resp.stream(amt=self._chunk_size)

# TODO: Ensure we're handling redirects. Might also stick the 'origin'
# attribute on Events like the Javascript spec requires.
throw_if_unsuccessful_response(self.resp)

@property
def events(self):
"""
An iterable series of Event objects received from the stream.
"""
event_type = ""
event_data = None
for line in _BufferedLineReader.lines_from(self.resp_file):
if line == "":
if event_data is not None:
yield Event("message" if event_type == "" else event_type, event_data, self.last_id)
event_type = ""
event_data = None
continue
colon_pos = line.find(':')
if colon_pos < 0:
continue # malformed line - ignore
if colon_pos == 0:
continue # comment - currently we're not surfacing these
name = line[0:colon_pos]
if colon_pos < (len(line) - 1) and line[colon_pos + 1] == ' ':
colon_pos += 1
value = line[colon_pos+1:]
if name == 'event':
event_type = value
elif name == 'data':
event_data = value if event_data is None else (event_data + "\n" + value)
elif name == 'id':
self.last_id = value
elif name == 'retry':
pass # auto-reconnect is not implemented in this simplified client
# unknown field names are ignored in SSE

def __enter__(self):
return self

def __exit__(self, type, value, traceback):
self.close()
Loading