flagsmith-common 3.16.0__tar.gz → 3.16.2__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 (118) hide show
  1. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/PKG-INFO +2 -2
  2. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/README.md +1 -0
  3. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/pyproject.toml +3 -4
  4. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/pyproject.toml.orig +3 -4
  5. flagsmith_common-3.16.2/src/common/core/cli/entrypoint.py +29 -0
  6. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/cli/healthcheck.py +12 -1
  7. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/main.py +1 -4
  8. flagsmith_common-3.16.2/src/common/features/serializers.py +21 -0
  9. flagsmith_common-3.16.0/src/common/features/serializers.py +0 -68
  10. flagsmith_common-3.16.0/src/common/features/versioning/serializers.py +0 -13
  11. flagsmith_common-3.16.0/src/task_processor/migrations/sql/__init__.py +0 -0
  12. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/LICENSE +0 -0
  13. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/__init__.py +0 -0
  14. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/__init__.py +0 -0
  15. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/app.py +0 -0
  16. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/cli/__init__.py +0 -0
  17. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/cli/run.py +0 -0
  18. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/constants.py +0 -0
  19. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/docgen/__init__.py +0 -0
  20. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/docgen/events.py +0 -0
  21. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/logging.py +0 -0
  22. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/management/__init__.py +0 -0
  23. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/management/commands/__init__.py +0 -0
  24. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/management/commands/docgen.py +0 -0
  25. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/management/commands/start.py +0 -0
  26. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/management/commands/waitfordb.py +0 -0
  27. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/metrics.py +0 -0
  28. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/middleware.py +0 -0
  29. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/otel.py +0 -0
  30. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/sentry.py +0 -0
  31. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/templates/docgen-events.md +0 -0
  32. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/templates/docgen-metrics.md +0 -0
  33. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/types.py +0 -0
  34. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/urls.py +0 -0
  35. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/utils.py +0 -0
  36. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/core/views.py +0 -0
  37. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/environments/permissions.py +0 -0
  38. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/features/__init__.py +0 -0
  39. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/features/multivariate/__init__.py +0 -0
  40. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/features/multivariate/serializers.py +0 -0
  41. {flagsmith_common-3.16.0/src/common/features/versioning → flagsmith_common-3.16.2/src/common/gunicorn}/__init__.py +0 -0
  42. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/conf.py +0 -0
  43. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/constants.py +0 -0
  44. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/logging.py +0 -0
  45. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/metrics.py +0 -0
  46. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/metrics_server.py +0 -0
  47. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/middleware.py +0 -0
  48. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/processors.py +0 -0
  49. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/gunicorn/utils.py +0 -0
  50. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/lint_tests.py +0 -0
  51. {flagsmith_common-3.16.0/src/common/gunicorn → flagsmith_common-3.16.2/src/common/migrations}/__init__.py +0 -0
  52. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/migrations/helpers/__init__.py +0 -0
  53. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/migrations/helpers/postgres_helpers.py +0 -0
  54. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/organisations/permissions.py +0 -0
  55. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/projects/permissions.py +0 -0
  56. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/prometheus/__init__.py +0 -0
  57. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/prometheus/utils.py +0 -0
  58. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/py.typed +0 -0
  59. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/test_tools/__init__.py +0 -0
  60. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/test_tools/plugin.py +0 -0
  61. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/test_tools/types.py +0 -0
  62. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/test_tools/utils.py +0 -0
  63. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/common/types.py +0 -0
  64. {flagsmith_common-3.16.0/src/common/migrations → flagsmith_common-3.16.2/src/flagsmith_schemas}/__init__.py +0 -0
  65. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/api.py +0 -0
  66. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/constants.py +0 -0
  67. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/dynamodb.py +0 -0
  68. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/py.typed +0 -0
  69. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/pydantic_types.py +0 -0
  70. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/types.py +0 -0
  71. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/utils.py +0 -0
  72. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/flagsmith_schemas/validators.py +0 -0
  73. {flagsmith_common-3.16.0/src/flagsmith_schemas → flagsmith_common-3.16.2/src/task_processor}/__init__.py +0 -0
  74. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/admin.py +0 -0
  75. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/apps.py +0 -0
  76. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/constants.py +0 -0
  77. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/decorators.py +0 -0
  78. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/exceptions.py +0 -0
  79. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/health.py +0 -0
  80. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/managers.py +0 -0
  81. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/metrics.py +0 -0
  82. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0001_initial.py +0 -0
  83. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0002_healthcheckmodel.py +0 -0
  84. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0003_add_completed_to_task.py +0 -0
  85. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0004_recreate_task_indexes.py +0 -0
  86. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0005_update_conditional_index_conditions.py +0 -0
  87. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0006_auto_20230221_0802.py +0 -0
  88. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0007_add_is_locked.py +0 -0
  89. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0008_add_get_task_to_process_function.py +0 -0
  90. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0009_add_recurring_task_run_first_run_at.py +0 -0
  91. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0010_task_priority.py +0 -0
  92. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0011_add_priority_to_get_tasks_to_process.py +0 -0
  93. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0012_add_locked_at_and_timeout.py +0 -0
  94. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0013_add_last_picked_at.py +0 -0
  95. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0014_add_trace_context.py +0 -0
  96. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/0015_add_is_disabled.py +0 -0
  97. {flagsmith_common-3.16.0/src/task_processor → flagsmith_common-3.16.2/src/task_processor/migrations}/__init__.py +0 -0
  98. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0008_get_recurring_tasks_to_process.sql +0 -0
  99. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0008_get_tasks_to_process.sql +0 -0
  100. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0011_get_tasks_to_process.sql +0 -0
  101. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0012_get_recurringtasks_to_process.sql +0 -0
  102. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0013_get_recurringtasks_to_process.sql +0 -0
  103. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/migrations/sql/0015_get_recurringtasks_to_process.sql +0 -0
  104. {flagsmith_common-3.16.0/src/task_processor/migrations → flagsmith_common-3.16.2/src/task_processor/migrations/sql}/__init__.py +0 -0
  105. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/models.py +0 -0
  106. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/monitoring.py +0 -0
  107. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/processor.py +0 -0
  108. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/py.typed +0 -0
  109. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/routers.py +0 -0
  110. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/serializers.py +0 -0
  111. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/task_registry.py +0 -0
  112. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/task_run_method.py +0 -0
  113. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/tasks.py +0 -0
  114. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/threads.py +0 -0
  115. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/types.py +0 -0
  116. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/urls.py +0 -0
  117. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/src/task_processor/utils.py +0 -0
  118. {flagsmith_common-3.16.0 → flagsmith_common-3.16.2}/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.16.0
3
+ Version: 3.16.2
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
@@ -15,7 +15,6 @@ Requires-Dist: django-health-check ; extra == 'common-core'
15
15
  Requires-Dist: djangorestframework-recursive ; extra == 'common-core'
16
16
  Requires-Dist: djangorestframework ; extra == 'common-core'
17
17
  Requires-Dist: drf-spectacular>=0.28.0,<1 ; extra == 'common-core'
18
- Requires-Dist: drf-writable-nested ; extra == 'common-core'
19
18
  Requires-Dist: environs<16 ; extra == 'common-core'
20
19
  Requires-Dist: gunicorn>=23 ; extra == 'common-core'
21
20
  Requires-Dist: opentelemetry-instrumentation-django>=0.46b0,<1 ; extra == 'common-core'
@@ -155,6 +154,7 @@ To test your metrics using the `assert_metric` fixture:
155
154
  ```python
156
155
  from common.test_tools import AssertMetricFixture
157
156
 
157
+
158
158
  def test_my_code__expected_metrics(assert_metric: AssertMetricFixture) -> None:
159
159
  # When
160
160
  my_code()
@@ -93,6 +93,7 @@ To test your metrics using the `assert_metric` fixture:
93
93
  ```python
94
94
  from common.test_tools import AssertMetricFixture
95
95
 
96
+
96
97
  def test_my_code__expected_metrics(assert_metric: AssertMetricFixture) -> None:
97
98
  # When
98
99
  my_code()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.16.0"
3
+ version = "3.16.2"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -26,7 +26,6 @@ common-core = [
26
26
  "djangorestframework-recursive",
27
27
  "djangorestframework",
28
28
  "drf-spectacular (>=0.28.0,<1)",
29
- "drf-writable-nested",
30
29
  "environs (<16)",
31
30
  "gunicorn (>=23)",
32
31
  "opentelemetry-instrumentation-django (>=0.46b0,<1)",
@@ -98,7 +97,7 @@ Issues = "https://github.com/flagsmith/flagsmith-common/issues"
98
97
  Repository = "https://github.com/flagsmith/flagsmith-common"
99
98
 
100
99
  [project.scripts]
101
- flagsmith = "common.core.main:main"
100
+ flagsmith = "common.core.cli.entrypoint:main"
102
101
  flagsmith-lint-tests = "common.lint_tests:main"
103
102
 
104
103
  [project.entry-points.pytest11]
@@ -121,7 +120,7 @@ dev = [
121
120
  "pytest-freezegun (>=0.4.2, <1.0.0)",
122
121
  "pytest-httpserver (>=1.1.3, <2.0.0)",
123
122
  "pytest-mock (>=3.14.0, <4.0.0)",
124
- "setuptools (>=83.0.0, <83.1.0)",
123
+ "setuptools (>=84.1.0, <84.2.0)",
125
124
  "types-python-dateutil (>=2.9.0.20250516, <3.0.0)",
126
125
  "types-simplejson (>=3.20.0.20250326, <4.0.0)",
127
126
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.16.0"
3
+ version = "3.16.2"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -14,7 +14,6 @@ optional-dependencies = { test-tools = [
14
14
  "djangorestframework-recursive",
15
15
  "djangorestframework",
16
16
  "drf-spectacular (>=0.28.0,<1)",
17
- "drf-writable-nested",
18
17
  "environs (<16)",
19
18
  "gunicorn (>=23)",
20
19
  "opentelemetry-instrumentation-django (>=0.46b0,<1)",
@@ -75,7 +74,7 @@ Issues = "https://github.com/flagsmith/flagsmith-common/issues"
75
74
  Repository = "https://github.com/flagsmith/flagsmith-common"
76
75
 
77
76
  [project.scripts]
78
- flagsmith = "common.core.main:main"
77
+ flagsmith = "common.core.cli.entrypoint:main"
79
78
  flagsmith-lint-tests = "common.lint_tests:main"
80
79
 
81
80
  [project.entry-points.pytest11]
@@ -98,7 +97,7 @@ dev = [
98
97
  "pytest-freezegun (>=0.4.2, <1.0.0)",
99
98
  "pytest-httpserver (>=1.1.3, <2.0.0)",
100
99
  "pytest-mock (>=3.14.0, <4.0.0)",
101
- "setuptools (>=83.0.0, <83.1.0)",
100
+ "setuptools (>=84.1.0, <84.2.0)",
102
101
  "types-python-dateutil (>=2.9.0.20250516, <3.0.0)",
103
102
  "types-simplejson (>=3.20.0.20250326, <4.0.0)",
104
103
  ]
@@ -0,0 +1,29 @@
1
+ """
2
+ The `flagsmith` console script entry point.
3
+
4
+ This module is intentionally kept lightweight: it must not import Django or any
5
+ other heavy dependencies at module level.
6
+
7
+ Health checks are commonly run at a high frequency, e.g. every few seconds by a
8
+ Docker `HEALTHCHECK` instruction, so they bypass the full CLI environment set up
9
+ by `common.core.main` to keep their CPU footprint minimal.
10
+
11
+ All other commands are delegated to `common.core.main.main`.
12
+ """
13
+
14
+ import os
15
+ import sys
16
+
17
+ from common.core.cli import healthcheck
18
+
19
+
20
+ def main(argv: list[str] = sys.argv) -> None:
21
+ if len(argv) > 1 and argv[1] in healthcheck.SUBCOMMANDS:
22
+ return healthcheck.main(
23
+ argv[2:],
24
+ prog=f"{os.path.basename(argv[0])} {argv[1]}",
25
+ )
26
+
27
+ from common.core.main import main as full_main
28
+
29
+ return full_main(argv)
@@ -2,7 +2,15 @@ import argparse
2
2
  import socket
3
3
  import urllib.parse
4
4
 
5
- import requests
5
+ # Subcommands of the `flagsmith` CLI dispatched to `main`.
6
+ # This module must stay lightweight to import, as `common.core.cli.entrypoint`
7
+ # imports it to fast-path these subcommands.
8
+ SUBCOMMANDS = (
9
+ "healthcheck",
10
+ # Backwards compatibility for task-processor health checks
11
+ # See https://github.com/Flagsmith/flagsmith-task-processor/issues/24
12
+ "checktaskprocessorthreadhealth",
13
+ )
6
14
 
7
15
  DEFAULT_PORT = 8000
8
16
  DEFAULT_TIMEOUT_SECONDS = 1
@@ -88,6 +96,9 @@ def check_http_response(
88
96
  timeout_seconds: int,
89
97
  path: str,
90
98
  ) -> None:
99
+ # Imported lazily to keep the more frequently used TCP check lightweight
100
+ import requests
101
+
91
102
  url = urllib.parse.urljoin(f"http://127.0.0.1:{port}", path)
92
103
  requests.get(
93
104
  url,
@@ -140,10 +140,7 @@ def execute_from_command_line(argv: list[str]) -> None:
140
140
  try:
141
141
  subcommand = argv[1]
142
142
  subcommand_main = {
143
- "healthcheck": healthcheck.main,
144
- # Backwards compatibility for task-processor health checks
145
- # See https://github.com/Flagsmith/flagsmith-task-processor/issues/24
146
- "checktaskprocessorthreadhealth": healthcheck.main,
143
+ **dict.fromkeys(healthcheck.SUBCOMMANDS, healthcheck.main),
147
144
  # Composite startup verbs, formerly run-docker.sh
148
145
  "serve": run.serve,
149
146
  "migrate": run.migrate,
@@ -0,0 +1,21 @@
1
+ import typing
2
+
3
+ from django.apps import apps
4
+ from rest_framework import serializers
5
+
6
+ if typing.TYPE_CHECKING:
7
+ from common.types import FeatureSegment, FeatureStateValue # noqa: F401
8
+
9
+
10
+ class FeatureStateValueSerializer(serializers.ModelSerializer["FeatureStateValue"]):
11
+ class Meta:
12
+ model = apps.get_model("features", "FeatureStateValue")
13
+ fields = ("type", "string_value", "integer_value", "boolean_value")
14
+
15
+
16
+ class CreateSegmentOverrideFeatureSegmentSerializer(
17
+ serializers.ModelSerializer["FeatureSegment"]
18
+ ):
19
+ class Meta:
20
+ model = apps.get_model("features", "FeatureSegment")
21
+ fields = ("id", "segment", "priority", "uuid")
@@ -1,68 +0,0 @@
1
- import typing
2
-
3
- from django.apps import apps
4
- from drf_writable_nested.serializers import WritableNestedModelSerializer
5
- from rest_framework import serializers
6
-
7
- from common.features.multivariate.serializers import (
8
- MultivariateFeatureStateValueSerializer,
9
- )
10
-
11
- if typing.TYPE_CHECKING:
12
- from common.types import FeatureSegment, FeatureStateValue # noqa: F401
13
-
14
-
15
- class FeatureStateValueSerializer(serializers.ModelSerializer["FeatureStateValue"]):
16
- class Meta:
17
- model = apps.get_model("features", "FeatureStateValue")
18
- fields = ("type", "string_value", "integer_value", "boolean_value")
19
-
20
-
21
- class CreateSegmentOverrideFeatureSegmentSerializer(
22
- serializers.ModelSerializer["FeatureSegment"]
23
- ):
24
- class Meta:
25
- model = apps.get_model("features", "FeatureSegment")
26
- fields = ("id", "segment", "priority", "uuid")
27
-
28
-
29
- class CreateSegmentOverrideFeatureStateSerializer(WritableNestedModelSerializer):
30
- feature_state_value = FeatureStateValueSerializer()
31
- feature_segment = CreateSegmentOverrideFeatureSegmentSerializer(
32
- required=False, allow_null=True
33
- )
34
- multivariate_feature_state_values = MultivariateFeatureStateValueSerializer(
35
- many=True, required=False
36
- )
37
-
38
- class Meta:
39
- model = apps.get_model("features", "FeatureState")
40
- fields = (
41
- "id",
42
- "feature",
43
- "enabled",
44
- "feature_state_value",
45
- "feature_segment",
46
- "deleted_at",
47
- "uuid",
48
- "created_at",
49
- "updated_at",
50
- "live_from",
51
- "environment",
52
- "identity",
53
- "change_request",
54
- "multivariate_feature_state_values",
55
- )
56
-
57
- read_only_fields = (
58
- "id",
59
- "deleted_at",
60
- "uuid",
61
- "created_at",
62
- "updated_at",
63
- "live_from",
64
- "environment",
65
- "identity",
66
- "change_request",
67
- "feature",
68
- )
@@ -1,13 +0,0 @@
1
- from common.features.serializers import (
2
- CreateSegmentOverrideFeatureStateSerializer,
3
- )
4
-
5
-
6
- class EnvironmentFeatureVersionFeatureStateSerializer(
7
- CreateSegmentOverrideFeatureStateSerializer
8
- ):
9
- class Meta(CreateSegmentOverrideFeatureStateSerializer.Meta):
10
- read_only_fields = (
11
- CreateSegmentOverrideFeatureStateSerializer.Meta.read_only_fields
12
- + ("feature",) # type: ignore[assignment]
13
- )