flagsmith-common 3.14.0__tar.gz → 3.15.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.
Files changed (116) hide show
  1. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/PKG-INFO +2 -2
  2. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/pyproject.toml +2 -2
  3. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/pyproject.toml.orig +2 -2
  4. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/utils.py +12 -1
  5. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/api.py +24 -0
  6. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/dynamodb.py +3 -1
  7. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/LICENSE +0 -0
  8. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/README.md +0 -0
  9. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/__init__.py +0 -0
  10. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/__init__.py +0 -0
  11. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/app.py +0 -0
  12. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/cli/__init__.py +0 -0
  13. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/cli/healthcheck.py +0 -0
  14. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/cli/run.py +0 -0
  15. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/constants.py +0 -0
  16. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/docgen/__init__.py +0 -0
  17. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/docgen/events.py +0 -0
  18. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/logging.py +0 -0
  19. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/main.py +0 -0
  20. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/management/__init__.py +0 -0
  21. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/management/commands/__init__.py +0 -0
  22. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/management/commands/docgen.py +0 -0
  23. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/management/commands/start.py +0 -0
  24. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/management/commands/waitfordb.py +0 -0
  25. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/metrics.py +0 -0
  26. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/middleware.py +0 -0
  27. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/otel.py +0 -0
  28. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/sentry.py +0 -0
  29. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/templates/docgen-events.md +0 -0
  30. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/templates/docgen-metrics.md +0 -0
  31. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/types.py +0 -0
  32. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/urls.py +0 -0
  33. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/utils.py +0 -0
  34. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/core/views.py +0 -0
  35. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/environments/permissions.py +0 -0
  36. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/__init__.py +0 -0
  37. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/multivariate/__init__.py +0 -0
  38. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/multivariate/serializers.py +0 -0
  39. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/serializers.py +0 -0
  40. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/versioning/__init__.py +0 -0
  41. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/features/versioning/serializers.py +0 -0
  42. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/__init__.py +0 -0
  43. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/conf.py +0 -0
  44. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/constants.py +0 -0
  45. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/logging.py +0 -0
  46. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/metrics.py +0 -0
  47. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/metrics_server.py +0 -0
  48. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/middleware.py +0 -0
  49. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/gunicorn/processors.py +0 -0
  50. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/lint_tests.py +0 -0
  51. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/migrations/__init__.py +0 -0
  52. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/migrations/helpers/__init__.py +0 -0
  53. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/migrations/helpers/postgres_helpers.py +0 -0
  54. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/organisations/permissions.py +0 -0
  55. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/projects/permissions.py +0 -0
  56. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/prometheus/__init__.py +0 -0
  57. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/prometheus/utils.py +0 -0
  58. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/py.typed +0 -0
  59. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/test_tools/__init__.py +0 -0
  60. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/test_tools/plugin.py +0 -0
  61. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/test_tools/types.py +0 -0
  62. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/test_tools/utils.py +0 -0
  63. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/common/types.py +0 -0
  64. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/__init__.py +0 -0
  65. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/constants.py +0 -0
  66. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/py.typed +0 -0
  67. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/pydantic_types.py +0 -0
  68. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/types.py +0 -0
  69. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/utils.py +0 -0
  70. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/flagsmith_schemas/validators.py +0 -0
  71. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/__init__.py +0 -0
  72. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/admin.py +0 -0
  73. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/apps.py +0 -0
  74. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/constants.py +0 -0
  75. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/decorators.py +0 -0
  76. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/exceptions.py +0 -0
  77. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/health.py +0 -0
  78. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/managers.py +0 -0
  79. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/metrics.py +0 -0
  80. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0001_initial.py +0 -0
  81. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0002_healthcheckmodel.py +0 -0
  82. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0003_add_completed_to_task.py +0 -0
  83. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0004_recreate_task_indexes.py +0 -0
  84. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0005_update_conditional_index_conditions.py +0 -0
  85. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0006_auto_20230221_0802.py +0 -0
  86. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0007_add_is_locked.py +0 -0
  87. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0008_add_get_task_to_process_function.py +0 -0
  88. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0009_add_recurring_task_run_first_run_at.py +0 -0
  89. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0010_task_priority.py +0 -0
  90. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0011_add_priority_to_get_tasks_to_process.py +0 -0
  91. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0012_add_locked_at_and_timeout.py +0 -0
  92. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0013_add_last_picked_at.py +0 -0
  93. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0014_add_trace_context.py +0 -0
  94. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/0015_add_is_disabled.py +0 -0
  95. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/__init__.py +0 -0
  96. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0008_get_recurring_tasks_to_process.sql +0 -0
  97. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0008_get_tasks_to_process.sql +0 -0
  98. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0011_get_tasks_to_process.sql +0 -0
  99. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0012_get_recurringtasks_to_process.sql +0 -0
  100. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0013_get_recurringtasks_to_process.sql +0 -0
  101. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/0015_get_recurringtasks_to_process.sql +0 -0
  102. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/migrations/sql/__init__.py +0 -0
  103. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/models.py +0 -0
  104. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/monitoring.py +0 -0
  105. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/processor.py +0 -0
  106. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/py.typed +0 -0
  107. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/routers.py +0 -0
  108. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/serializers.py +0 -0
  109. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/task_registry.py +0 -0
  110. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/task_run_method.py +0 -0
  111. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/tasks.py +0 -0
  112. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/threads.py +0 -0
  113. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/types.py +0 -0
  114. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/urls.py +0 -0
  115. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/utils.py +0 -0
  116. {flagsmith_common-3.14.0 → flagsmith_common-3.15.1}/src/task_processor/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flagsmith-common
3
- Version: 3.14.0
3
+ Version: 3.15.1
4
4
  Summary: Flagsmith's common library
5
5
  Author: Matthew Elwell, Gagan Trivedi, Kim Gustyr, Zach Aysan, Francesco Lo Franco, Rodrigo López Dato, Evandro Myller, Wadii Zaim
6
6
  License-Expression: BSD-3-Clause
@@ -17,7 +17,7 @@ Requires-Dist: djangorestframework ; extra == 'common-core'
17
17
  Requires-Dist: drf-spectacular>=0.28.0,<1 ; extra == 'common-core'
18
18
  Requires-Dist: drf-writable-nested ; extra == 'common-core'
19
19
  Requires-Dist: environs<16 ; extra == 'common-core'
20
- Requires-Dist: gunicorn>=19.1 ; extra == 'common-core'
20
+ Requires-Dist: gunicorn>=23 ; extra == 'common-core'
21
21
  Requires-Dist: opentelemetry-instrumentation-django>=0.46b0,<1 ; extra == 'common-core'
22
22
  Requires-Dist: opentelemetry-instrumentation-psycopg2>=0.46b0,<1 ; extra == 'common-core'
23
23
  Requires-Dist: opentelemetry-instrumentation-redis>=0.46b0,<1 ; extra == 'common-core'
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.14.0"
3
+ version = "3.15.1"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -28,7 +28,7 @@ common-core = [
28
28
  "drf-spectacular (>=0.28.0,<1)",
29
29
  "drf-writable-nested",
30
30
  "environs (<16)",
31
- "gunicorn (>=19.1)",
31
+ "gunicorn (>=23)",
32
32
  "opentelemetry-instrumentation-django (>=0.46b0,<1)",
33
33
  "opentelemetry-instrumentation-psycopg2 (>=0.46b0,<1)",
34
34
  "opentelemetry-instrumentation-redis (>=0.46b0,<1)",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.14.0"
3
+ version = "3.15.1"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -16,7 +16,7 @@ optional-dependencies = { test-tools = [
16
16
  "drf-spectacular (>=0.28.0,<1)",
17
17
  "drf-writable-nested",
18
18
  "environs (<16)",
19
- "gunicorn (>=19.1)",
19
+ "gunicorn (>=23)",
20
20
  "opentelemetry-instrumentation-django (>=0.46b0,<1)",
21
21
  "opentelemetry-instrumentation-psycopg2 (>=0.46b0,<1)",
22
22
  "opentelemetry-instrumentation-redis (>=0.46b0,<1)",
@@ -23,6 +23,7 @@ GUNICORN_FLAGSMITH_DEFAULTS = {
23
23
  "accesslog": env.str("ACCESS_LOG_LOCATION", os.devnull),
24
24
  "bind": "0.0.0.0:8000",
25
25
  "config": "python:common.gunicorn.conf",
26
+ "keepalive": env.int("GUNICORN_KEEP_ALIVE", 2),
26
27
  "logger_class": "common.gunicorn.logging.GunicornJsonCapableLogger",
27
28
  "statsd_prefix": "flagsmith.api",
28
29
  "threads": env.int("GUNICORN_THREADS", 1),
@@ -41,9 +42,19 @@ class DjangoWSGIApplication(GunicornWSGIApplication): # type: ignore[misc]
41
42
 
42
43
  def load_config(self) -> None:
43
44
  cfg_settings = self.cfg.settings
45
+ env_args = self.cfg.parser().parse_args(self.cfg.get_cmd_args_from_env())
46
+ env_options = {
47
+ key: value
48
+ for key, value in vars(env_args).items()
49
+ if key != "args" and value is not None
50
+ }
44
51
  options_items = (
45
52
  (key, value)
46
- for key, value in {**GUNICORN_FLAGSMITH_DEFAULTS, **self.options}.items()
53
+ for key, value in {
54
+ **GUNICORN_FLAGSMITH_DEFAULTS,
55
+ **env_options,
56
+ **self.options,
57
+ }.items()
47
58
  if key in cfg_settings
48
59
  )
49
60
  for key, value in options_items:
@@ -12,6 +12,8 @@ with any library that supports TypedDict, such as Pydantic or typeguard.
12
12
  When updating this module, ensure that the changes are backwards compatible.
13
13
  """
14
14
 
15
+ from typing import Any
16
+
15
17
  from flag_engine.engine import ContextValue
16
18
  from flag_engine.segments.types import ConditionOperator, RuleType
17
19
  from typing_extensions import NotRequired, TypedDict
@@ -57,6 +59,24 @@ class FeatureSegment(TypedDict):
57
59
  """The priority of this segment feature override. Lower numbers indicate stronger priority. If null or not set, the weakest priority is assumed."""
58
60
 
59
61
 
62
+ class ExperimentMetadata(TypedDict):
63
+ """Represents the experiment a feature state is part of. Only present while the experiment is running."""
64
+
65
+ id: int
66
+ """Unique identifier for the experiment in Core."""
67
+ name: str
68
+ """Name of the experiment."""
69
+ in_experiment: bool
70
+ """Whether this evaluation counts towards the experiment, i.e. whether the identity was bucketed by the experiment itself."""
71
+
72
+
73
+ class FeatureStateMetadata(TypedDict, extra_items=Any, total=False): # type: ignore[call-arg] # TODO https://github.com/python/mypy/issues/18176
74
+ """Additional, non-evaluation data about a feature state."""
75
+
76
+ experiment: ExperimentMetadata
77
+ """The experiment this feature state is part of, if any."""
78
+
79
+
60
80
  class FeatureState(TypedDict):
61
81
  """Used to define the state of a feature for an environment, segment overrides, and identity overrides."""
62
82
 
@@ -72,6 +92,8 @@ class FeatureState(TypedDict):
72
92
  """Segment override data, if this feature state is for a segment override."""
73
93
  multivariate_feature_state_values: list[MultivariateFeatureStateValue]
74
94
  """List of multivariate feature state values, if this feature state is for a multivariate feature."""
95
+ metadata: NotRequired[FeatureStateMetadata]
96
+ """Additional, non-evaluation data about this feature state. Absent if there is none."""
75
97
 
76
98
 
77
99
  class Trait(TypedDict):
@@ -161,6 +183,8 @@ class V1Flag(TypedDict):
161
183
  """Variant key for the feature state."""
162
184
  reason: NotRequired[str | None]
163
185
  """Why and how this feature state is resolved."""
186
+ metadata: NotRequired[FeatureStateMetadata]
187
+ """Additional, non-evaluation data about this feature state. Absent if there is none."""
164
188
 
165
189
 
166
190
  ### Root request schemas below. ###
@@ -7,7 +7,7 @@ when `pydantic` is installed.
7
7
  Otherwise, they serve as documentation for the structure of the data stored in DynamoDB.
8
8
  """
9
9
 
10
- from typing import Annotated, Literal
10
+ from typing import Annotated, Any, Literal
11
11
 
12
12
  from flag_engine.segments.types import ConditionOperator, RuleType
13
13
  from typing_extensions import NotRequired, TypedDict
@@ -95,6 +95,8 @@ class FeatureState(TypedDict):
95
95
 
96
96
  Total `percentage_allocation` sum of the child multivariate feature state values must be less or equal to 100.
97
97
  """
98
+ metadata: NotRequired[dict[str, Any]]
99
+ """Additional, non-evaluation data about this feature state, written by Core and served as-is by the SDK API."""
98
100
 
99
101
 
100
102
  class Trait(TypedDict):