fb-python-sdk 1.1.8__tar.gz → 1.1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {fb_python_sdk-1.1.8/fb_python_sdk.egg-info → fb_python_sdk-1.1.10}/PKG-INFO +16 -9
  2. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/README.md +10 -1
  3. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/dev-requirements.txt +2 -2
  4. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10/fb_python_sdk.egg-info}/PKG-INFO +16 -9
  5. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fb_python_sdk.egg-info/requires.txt +2 -2
  6. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/streaming.py +16 -11
  7. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/__init__.py +1 -1
  8. fb_python_sdk-1.1.10/release/package.json +3 -0
  9. fb_python_sdk-1.1.10/requirements.txt +4 -0
  10. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/setup.py +3 -5
  11. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_runtime_safety.py +87 -0
  12. fb_python_sdk-1.1.8/release/package.json +0 -3
  13. fb_python_sdk-1.1.8/requirements.txt +0 -4
  14. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/LICENSE +0 -0
  15. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/MANIFEST.in +0 -0
  16. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fb_python_sdk.egg-info/SOURCES.txt +0 -0
  17. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fb_python_sdk.egg-info/dependency_links.txt +0 -0
  18. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fb_python_sdk.egg-info/top_level.txt +0 -0
  19. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/__init__.py +0 -0
  20. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/category.py +0 -0
  21. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/client.py +0 -0
  22. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/common_types.py +0 -0
  23. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/config.py +0 -0
  24. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/data_storage.py +0 -0
  25. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/evaluator.py +0 -0
  26. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/event_processor.py +0 -0
  27. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/event_types.py +0 -0
  28. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/flag_change_notification.py +0 -0
  29. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/interfaces.py +0 -0
  30. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/notice_broadcaster.py +0 -0
  31. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/status.py +0 -0
  32. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/status_types.py +0 -0
  33. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/update_processor.py +0 -0
  34. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/exponential_backoff_jitter_strategy.py +0 -0
  35. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/http_client.py +0 -0
  36. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/repeatable_task.py +0 -0
  37. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/rwlock.py +0 -0
  38. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/fbclient/utils/variation_splitting_algorithm.py +0 -0
  39. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/pyproject.toml +0 -0
  40. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/setup.cfg +0 -0
  41. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_data_storage.py +0 -0
  42. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_data_update_status_provider.py +0 -0
  43. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_evaluator.py +0 -0
  44. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_event_processor.py +0 -0
  45. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_fbclient.py +0 -0
  46. {fb_python_sdk-1.1.8 → fb_python_sdk-1.1.10}/tests/test_flag_change_notification.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fb-python-sdk
3
- Version: 1.1.8
3
+ Version: 1.1.10
4
4
  Summary: A Python SDK for FeatBit plateform
5
5
  Home-page: https://github.com/featbit/featbit-python-sdk
6
6
  Author: Dian SUN
@@ -13,23 +13,21 @@ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Topic :: Software Development
15
15
  Classifier: Topic :: Software Development :: Libraries
16
- Classifier: Programming Language :: Python :: 3.6
17
- Classifier: Programming Language :: Python :: 3.7
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
16
  Classifier: Programming Language :: Python :: 3.10
21
17
  Classifier: Programming Language :: Python :: 3.11
22
18
  Classifier: Programming Language :: Python :: 3.12
23
- Requires-Python: >=3.6, <3.13
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.10, <3.15
24
22
  Description-Content-Type: text/markdown
25
23
  License-File: LICENSE
26
24
  Requires-Dist: certifi>=2018.4.16
27
- Requires-Dist: urllib3>=1.22.0
25
+ Requires-Dist: urllib3<3,>=1.26.5
28
26
  Requires-Dist: python-dateutil>=2.8.2
29
27
  Requires-Dist: websocket-client>=1.0.0
30
28
  Provides-Extra: dev
31
29
  Requires-Dist: certifi>=2018.4.16; extra == "dev"
32
- Requires-Dist: urllib3>=1.22.0; extra == "dev"
30
+ Requires-Dist: urllib3<3,>=1.26.5; extra == "dev"
33
31
  Requires-Dist: websocket-client>=1.0.0; extra == "dev"
34
32
  Requires-Dist: python-dateutil>=2.8.2; extra == "dev"
35
33
  Requires-Dist: flake8; extra == "dev"
@@ -53,6 +51,12 @@ Dynamic: summary
53
51
 
54
52
  # FeatBit Server-Side SDK for Python
55
53
 
54
+ > **Important upgrade notice:** Versions **1.1.8 and 1.1.9** contain a streaming
55
+ > regression that can stop flag updates after the first heartbeat, leaving
56
+ > applications evaluating cached values. Online streaming users should upgrade to
57
+ > **1.1.10** as soon as it is available and update pinned dependencies or lock files.
58
+ > See [issue #18](https://github.com/featbit/featbit-python-sdk/issues/18).
59
+
56
60
  ## Introduction
57
61
 
58
62
  This is the Python Server-Side SDK for the 100% open-source feature flags management platform [FeatBit](https://github.com/featbit/featbit).
@@ -71,7 +75,10 @@ If you want to use your own data source, see [Offline Mode](#offline-mode).
71
75
  ## Get Started
72
76
 
73
77
  ### Installation
74
- Install the SDK using pip. This version is compatible with Python 3.6 through 3.12.
78
+ Install the SDK using pip. This version is compatible with Python 3.10 through 3.14.
79
+ CI is configured to test compatibility on Linux and Windows through Python 3.14,
80
+ including the full unit suite and SDK resource-lifecycle audit.
81
+ Free-threaded CPython 3.14 builds are not currently tested or supported.
75
82
 
76
83
  ```shell
77
84
  pip install fb-python-sdk
@@ -1,5 +1,11 @@
1
1
  # FeatBit Server-Side SDK for Python
2
2
 
3
+ > **Important upgrade notice:** Versions **1.1.8 and 1.1.9** contain a streaming
4
+ > regression that can stop flag updates after the first heartbeat, leaving
5
+ > applications evaluating cached values. Online streaming users should upgrade to
6
+ > **1.1.10** as soon as it is available and update pinned dependencies or lock files.
7
+ > See [issue #18](https://github.com/featbit/featbit-python-sdk/issues/18).
8
+
3
9
  ## Introduction
4
10
 
5
11
  This is the Python Server-Side SDK for the 100% open-source feature flags management platform [FeatBit](https://github.com/featbit/featbit).
@@ -18,7 +24,10 @@ If you want to use your own data source, see [Offline Mode](#offline-mode).
18
24
  ## Get Started
19
25
 
20
26
  ### Installation
21
- Install the SDK using pip. This version is compatible with Python 3.6 through 3.12.
27
+ Install the SDK using pip. This version is compatible with Python 3.10 through 3.14.
28
+ CI is configured to test compatibility on Linux and Windows through Python 3.14,
29
+ including the full unit suite and SDK resource-lifecycle audit.
30
+ Free-threaded CPython 3.14 builds are not currently tested or supported.
22
31
 
23
32
  ```shell
24
33
  pip install fb-python-sdk
@@ -1,5 +1,5 @@
1
1
  certifi>=2018.4.16
2
- urllib3>=1.22.0
2
+ urllib3>=1.26.5,<3
3
3
  websocket-client>=1.0.0
4
4
  python-dateutil>=2.8.2
5
5
  flake8
@@ -7,4 +7,4 @@ pytest
7
7
  pytest-mock
8
8
  autopep8
9
9
  build
10
- twine
10
+ twine
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fb-python-sdk
3
- Version: 1.1.8
3
+ Version: 1.1.10
4
4
  Summary: A Python SDK for FeatBit plateform
5
5
  Home-page: https://github.com/featbit/featbit-python-sdk
6
6
  Author: Dian SUN
@@ -13,23 +13,21 @@ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Operating System :: OS Independent
14
14
  Classifier: Topic :: Software Development
15
15
  Classifier: Topic :: Software Development :: Libraries
16
- Classifier: Programming Language :: Python :: 3.6
17
- Classifier: Programming Language :: Python :: 3.7
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
16
  Classifier: Programming Language :: Python :: 3.10
21
17
  Classifier: Programming Language :: Python :: 3.11
22
18
  Classifier: Programming Language :: Python :: 3.12
23
- Requires-Python: >=3.6, <3.13
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.10, <3.15
24
22
  Description-Content-Type: text/markdown
25
23
  License-File: LICENSE
26
24
  Requires-Dist: certifi>=2018.4.16
27
- Requires-Dist: urllib3>=1.22.0
25
+ Requires-Dist: urllib3<3,>=1.26.5
28
26
  Requires-Dist: python-dateutil>=2.8.2
29
27
  Requires-Dist: websocket-client>=1.0.0
30
28
  Provides-Extra: dev
31
29
  Requires-Dist: certifi>=2018.4.16; extra == "dev"
32
- Requires-Dist: urllib3>=1.22.0; extra == "dev"
30
+ Requires-Dist: urllib3<3,>=1.26.5; extra == "dev"
33
31
  Requires-Dist: websocket-client>=1.0.0; extra == "dev"
34
32
  Requires-Dist: python-dateutil>=2.8.2; extra == "dev"
35
33
  Requires-Dist: flake8; extra == "dev"
@@ -53,6 +51,12 @@ Dynamic: summary
53
51
 
54
52
  # FeatBit Server-Side SDK for Python
55
53
 
54
+ > **Important upgrade notice:** Versions **1.1.8 and 1.1.9** contain a streaming
55
+ > regression that can stop flag updates after the first heartbeat, leaving
56
+ > applications evaluating cached values. Online streaming users should upgrade to
57
+ > **1.1.10** as soon as it is available and update pinned dependencies or lock files.
58
+ > See [issue #18](https://github.com/featbit/featbit-python-sdk/issues/18).
59
+
56
60
  ## Introduction
57
61
 
58
62
  This is the Python Server-Side SDK for the 100% open-source feature flags management platform [FeatBit](https://github.com/featbit/featbit).
@@ -71,7 +75,10 @@ If you want to use your own data source, see [Offline Mode](#offline-mode).
71
75
  ## Get Started
72
76
 
73
77
  ### Installation
74
- Install the SDK using pip. This version is compatible with Python 3.6 through 3.12.
78
+ Install the SDK using pip. This version is compatible with Python 3.10 through 3.14.
79
+ CI is configured to test compatibility on Linux and Windows through Python 3.14,
80
+ including the full unit suite and SDK resource-lifecycle audit.
81
+ Free-threaded CPython 3.14 builds are not currently tested or supported.
75
82
 
76
83
  ```shell
77
84
  pip install fb-python-sdk
@@ -1,11 +1,11 @@
1
1
  certifi>=2018.4.16
2
- urllib3>=1.22.0
2
+ urllib3<3,>=1.26.5
3
3
  python-dateutil>=2.8.2
4
4
  websocket-client>=1.0.0
5
5
 
6
6
  [dev]
7
7
  certifi>=2018.4.16
8
- urllib3>=1.22.0
8
+ urllib3<3,>=1.26.5
9
9
  websocket-client>=1.0.0
10
10
  python-dateutil>=2.8.2
11
11
  flake8
@@ -11,7 +11,7 @@ from fbclient.flag_change_notification import FlagChangedNotice
11
11
  from fbclient.interfaces import UpdateProcessor
12
12
  from fbclient.notice_broadcaster import NoticeBroadcater
13
13
  from fbclient.status import DataUpdateStatusProviderImpl
14
- from fbclient.status_types import (DATA_INVALID_ERROR, NETWORK_ERROR,
14
+ from fbclient.status_types import (NETWORK_ERROR,
15
15
  REQUEST_INVALID_ERROR, RUNTIME_ERROR,
16
16
  SYSTEM_QUIT, UNKNOWN_CLOSE_CODE,
17
17
  UNKNOWN_ERROR, WEBSOCKET_ERROR, State)
@@ -302,16 +302,21 @@ class Streaming(Thread, UpdateProcessor):
302
302
  log.trace('Streaming WebSocket data: %s' % msg) # type: ignore
303
303
  try:
304
304
  all_data = json.loads(msg)
305
- if not valide_all_data(all_data):
306
- raise ValueError('invalid streaming data')
307
- if not self._on_process_data(all_data['data']) and self.__wsapp:
308
- # state already updated in init or upsert, just reconn
309
- self.__self_closed = _SelfClosed(is_self_close=True, is_reconn=True, state=None)
310
- wsapp.close(status=WS_GOING_AWAY_CLOSE)
311
- except Exception as e:
312
- self.__self_closed = _SelfClosed(is_self_close=True, is_reconn=False,
313
- state=State.error_off_state(DATA_INVALID_ERROR, str(e)))
314
- wsapp.close(status=WS_GOING_AWAY_CLOSE)
305
+ except Exception:
306
+ log.exception('FB Python SDK: could not parse data-sync message; skipping message: %r', msg)
307
+ return
308
+ if isinstance(all_data, dict) and all_data.get('messageType') == 'data-sync':
309
+ try:
310
+ self._handle_data_sync_message(wsapp, all_data)
311
+ except Exception:
312
+ log.exception('FB Python SDK: could not process data-sync message; skipping message: %r', all_data)
313
+
314
+ def _handle_data_sync_message(self, wsapp: websocket.WebSocketApp, all_data):
315
+ if not valide_all_data(all_data):
316
+ log.error('FB Python SDK: invalid data-sync message; skipping message: %r', all_data)
317
+ return
318
+ if not self._on_process_data(all_data['data']):
319
+ log.error('FB Python SDK: could not apply data-sync message; skipping message: %r', all_data)
315
320
 
316
321
  def stop(self):
317
322
  log.info('FB Python SDK: Streaming is stopping...')
@@ -67,7 +67,7 @@ def unix_timestamp_in_milliseconds():
67
67
 
68
68
  def valide_all_data(all_data=None) -> bool:
69
69
  return isinstance(all_data, dict) \
70
- and all_data.get('messageType', 'pong') == 'data-sync' \
70
+ and all_data.get('messageType') == 'data-sync' \
71
71
  and 'data' in all_data and isinstance(all_data['data'], dict) \
72
72
  and all(k in all_data['data'] for k in ('eventType', 'featureFlags', 'segments')) \
73
73
  and any(k == all_data['data']['eventType'] for k in ('full', 'patch')) \
@@ -0,0 +1,3 @@
1
+ {
2
+ "version":"1.1.10"
3
+ }
@@ -0,0 +1,4 @@
1
+ certifi>=2018.4.16
2
+ urllib3>=1.26.5,<3
3
+ python-dateutil>=2.8.2
4
+ websocket-client>=1.0.0
@@ -44,16 +44,14 @@ setup(
44
44
  'Operating System :: OS Independent',
45
45
  'Topic :: Software Development',
46
46
  'Topic :: Software Development :: Libraries',
47
- 'Programming Language :: Python :: 3.6',
48
- 'Programming Language :: Python :: 3.7',
49
- 'Programming Language :: Python :: 3.8',
50
- 'Programming Language :: Python :: 3.9',
51
47
  'Programming Language :: Python :: 3.10',
52
48
  'Programming Language :: Python :: 3.11',
53
49
  'Programming Language :: Python :: 3.12',
50
+ 'Programming Language :: Python :: 3.13',
51
+ 'Programming Language :: Python :: 3.14',
54
52
  ],
55
53
  extras_require={
56
54
  "dev": dev_reqs
57
55
  },
58
- python_requires='>=3.6, <3.13'
56
+ python_requires='>=3.10, <3.15'
59
57
  )
@@ -5,6 +5,8 @@ from time import sleep
5
5
  from concurrent.futures import ThreadPoolExecutor
6
6
  from pathlib import Path
7
7
 
8
+ import pytest
9
+
8
10
  from fbclient.client import FBClient
9
11
  from fbclient.config import Config, HTTPConfig
10
12
  from fbclient.data_storage import InMemoryDataStorage
@@ -470,3 +472,88 @@ def test_streaming_does_not_block_on_another_clients_timeout_lock(monkeypatch):
470
472
  streaming.stop()
471
473
  broadcaster.stop()
472
474
  streaming_module._WEBSOCKET_TIMEOUT_LOCK.release()
475
+
476
+
477
+ class _RecordingWebSocketApp:
478
+ def __init__(self):
479
+ self.close_statuses = []
480
+
481
+ def close(self, status=None):
482
+ self.close_statuses.append(status)
483
+
484
+
485
+ def _idle_streaming():
486
+ broadcaster = NoticeBroadcater()
487
+ streaming = Streaming(Config(FAKE_ENV_SECRET, FAKE_URL, FAKE_URL), broadcaster,
488
+ DataUpdateStatusProviderImpl(InMemoryDataStorage()), threading.Event())
489
+ return streaming, broadcaster
490
+
491
+
492
+ @pytest.mark.parametrize('message', [
493
+ '{"messageType":"pong","data":{}}',
494
+ '{"messageType":"unknown","data":{}}',
495
+ '{"data":{}}',
496
+ '[]',
497
+ 'null',
498
+ ])
499
+ def test_streaming_non_data_sync_message_keeps_connection_open(message):
500
+ streaming, broadcaster = _idle_streaming()
501
+ wsapp = _RecordingWebSocketApp()
502
+ try:
503
+ streaming._on_message(wsapp, message)
504
+ assert wsapp.close_statuses == []
505
+ assert not streaming._Streaming__self_closed()
506
+ finally:
507
+ streaming.stop()
508
+ broadcaster.stop()
509
+
510
+
511
+ @pytest.mark.parametrize('message', [
512
+ 'invalid json',
513
+ '{"messageType":"data-sync","data":{}}',
514
+ '{"messageType":"data-sync","data":null}',
515
+ ])
516
+ def test_streaming_invalid_message_is_logged_and_next_sync_is_processed(message, mocker):
517
+ streaming, broadcaster = _idle_streaming()
518
+ wsapp = _RecordingWebSocketApp()
519
+ process_data = mocker.patch.object(streaming, '_on_process_data', return_value=True)
520
+ error_log = mocker.patch.object(streaming_module.log, 'error')
521
+ exception_log = mocker.patch.object(streaming_module.log, 'exception')
522
+ try:
523
+ streaming._on_message(wsapp, message)
524
+ assert wsapp.close_statuses == []
525
+ assert not streaming._Streaming__self_closed()
526
+ process_data.assert_not_called()
527
+ assert error_log.called or exception_log.called
528
+
529
+ streaming._on_message(wsapp, '{"messageType":"data-sync","data":'
530
+ '{"eventType":"full","featureFlags":[],"segments":[]}}')
531
+ process_data.assert_called_once_with({'eventType': 'full', 'featureFlags': [], 'segments': []})
532
+ assert wsapp.close_statuses == []
533
+ finally:
534
+ streaming.stop()
535
+ broadcaster.stop()
536
+
537
+
538
+ def test_streaming_data_processing_failure_keeps_connection_open(mocker):
539
+ streaming, broadcaster = _idle_streaming()
540
+ wsapp = _RecordingWebSocketApp()
541
+ streaming._Streaming__wsapp = wsapp
542
+ process_data = mocker.patch.object(streaming, '_on_process_data', side_effect=[False, True])
543
+ error_log = mocker.patch.object(streaming_module.log, 'error')
544
+ message = ('{"messageType":"data-sync","data":'
545
+ '{"eventType":"full","featureFlags":[],"segments":[]}}')
546
+ try:
547
+ streaming._on_message(wsapp, message)
548
+ assert wsapp.close_statuses == []
549
+ assert not streaming._Streaming__self_closed()
550
+ error_log.assert_called_once()
551
+
552
+ streaming._on_message(wsapp, message)
553
+ assert process_data.call_count == 2
554
+ assert wsapp.close_statuses == []
555
+ assert not streaming._Streaming__self_closed()
556
+ error_log.assert_called_once()
557
+ finally:
558
+ streaming.stop()
559
+ broadcaster.stop()
@@ -1,3 +0,0 @@
1
- {
2
- "version":"1.1.8"
3
- }
@@ -1,4 +0,0 @@
1
- certifi>=2018.4.16
2
- urllib3>=1.22.0
3
- python-dateutil>=2.8.2
4
- websocket-client>=1.0.0
File without changes
File without changes