flagsmith 5.0.0__tar.gz → 5.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flagsmith
3
- Version: 5.0.0
3
+ Version: 5.0.1
4
4
  Summary: Flagsmith Python SDK
5
5
  License: BSD3
6
6
  License-File: LICENSE
@@ -16,7 +16,8 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
- Requires-Dist: flagsmith-flag-engine (>=10.0.0,<11.0.0)
19
+ Requires-Dist: flagsmith-flag-engine (>=10.0.1,<11.0.0)
20
+ Requires-Dist: iso8601 (>=2.1.0,<3.0.0) ; python_version < "3.11"
20
21
  Requires-Dist: requests (>=2.32.3,<3.0.0)
21
22
  Requires-Dist: requests-futures (>=1.0.1,<2.0.0)
22
23
  Requires-Dist: sseclient-py (>=1.8.0,<2.0.0)
@@ -49,7 +49,7 @@ class MultivariateFeatureStateValueModel(typing.TypedDict):
49
49
 
50
50
  class FeatureStateModel(typing.TypedDict):
51
51
  enabled: bool
52
- feature_segment: NotRequired[FeatureSegmentModel]
52
+ feature_segment: NotRequired[typing.Optional[FeatureSegmentModel]]
53
53
  feature_state_value: object
54
54
  feature: FeatureModel
55
55
  featurestate_uuid: str
@@ -28,6 +28,7 @@ from flagsmith.types import (
28
28
  StreamEvent,
29
29
  TraitConfig,
30
30
  )
31
+ from flagsmith.utils.datetime import fromisoformat
31
32
 
32
33
  OverrideKey = typing.Tuple[
33
34
  int,
@@ -69,9 +70,7 @@ def map_sse_event_to_stream_event(event: sseclient.Event) -> StreamEvent:
69
70
  def map_environment_document_to_environment_updated_at(
70
71
  environment_document: dict[str, typing.Any],
71
72
  ) -> datetime:
72
- if (
73
- updated_at := datetime.fromisoformat(environment_document["updated_at"])
74
- ).tzinfo is None:
73
+ if (updated_at := fromisoformat(environment_document["updated_at"])).tzinfo is None:
75
74
  return updated_at.replace(tzinfo=timezone.utc)
76
75
  return updated_at.astimezone(tz=timezone.utc)
77
76
 
@@ -267,7 +266,7 @@ def _map_environment_document_feature_states_to_feature_contexts(
267
266
  for multivariate_feature_state_value in multivariate_feature_state_values
268
267
  ]
269
268
 
270
- if "feature_segment" in feature_state:
271
- feature_context["priority"] = feature_state["feature_segment"]["priority"]
269
+ if feature_segment := feature_state.get("feature_segment"):
270
+ feature_context["priority"] = feature_segment["priority"]
272
271
 
273
272
  yield feature_context
@@ -0,0 +1,10 @@
1
+ import sys
2
+
3
+ if sys.version_info >= (3, 11):
4
+ from datetime import datetime
5
+
6
+ fromisoformat = datetime.fromisoformat
7
+ else:
8
+ import iso8601
9
+
10
+ fromisoformat = iso8601.parse_date
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "flagsmith"
3
- version = "5.0.0"
3
+ version = "5.0.1"
4
4
  description = "Flagsmith Python SDK"
5
5
  authors = ["Flagsmith <support@flagsmith.com>"]
6
6
  license = "BSD3"
@@ -10,7 +10,8 @@ documentation = "https://docs.flagsmith.com"
10
10
  packages = [{ include = "flagsmith" }]
11
11
 
12
12
  [tool.poetry.dependencies]
13
- flagsmith-flag-engine = "^10.0.0"
13
+ flagsmith-flag-engine = "^10.0.1"
14
+ iso8601 = { version = "^2.1.0", python = "<3.11" }
14
15
  python = ">=3.9,<4"
15
16
  requests = "^2.32.3"
16
17
  requests-futures = "^1.0.1"
File without changes
File without changes
File without changes
File without changes
File without changes