flagsmith-common 3.12.0__tar.gz → 3.12.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.12.0 → flagsmith_common-3.12.1}/PKG-INFO +1 -1
  2. flagsmith_common-3.12.1/pyproject.toml +192 -0
  3. flagsmith_common-3.12.0/pyproject.toml → flagsmith_common-3.12.1/pyproject.toml.orig +1 -1
  4. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/cli/run.py +6 -0
  5. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/main.py +13 -4
  6. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/LICENSE +0 -0
  7. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/README.md +0 -0
  8. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/__init__.py +0 -0
  9. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/__init__.py +0 -0
  10. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/app.py +0 -0
  11. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/cli/__init__.py +0 -0
  12. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/cli/healthcheck.py +0 -0
  13. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/constants.py +0 -0
  14. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/docgen/__init__.py +0 -0
  15. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/docgen/events.py +0 -0
  16. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/logging.py +0 -0
  17. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/management/__init__.py +0 -0
  18. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/management/commands/__init__.py +0 -0
  19. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/management/commands/docgen.py +0 -0
  20. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/management/commands/start.py +0 -0
  21. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/management/commands/waitfordb.py +0 -0
  22. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/metrics.py +0 -0
  23. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/middleware.py +0 -0
  24. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/otel.py +0 -0
  25. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/sentry.py +0 -0
  26. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/templates/docgen-events.md +0 -0
  27. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/templates/docgen-metrics.md +0 -0
  28. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/types.py +0 -0
  29. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/urls.py +0 -0
  30. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/utils.py +0 -0
  31. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/core/views.py +0 -0
  32. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/environments/permissions.py +0 -0
  33. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/__init__.py +0 -0
  34. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/multivariate/__init__.py +0 -0
  35. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/multivariate/serializers.py +0 -0
  36. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/serializers.py +0 -0
  37. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/versioning/__init__.py +0 -0
  38. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/features/versioning/serializers.py +0 -0
  39. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/__init__.py +0 -0
  40. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/conf.py +0 -0
  41. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/constants.py +0 -0
  42. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/logging.py +0 -0
  43. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/metrics.py +0 -0
  44. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/metrics_server.py +0 -0
  45. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/middleware.py +0 -0
  46. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/processors.py +0 -0
  47. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/gunicorn/utils.py +0 -0
  48. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/lint_tests.py +0 -0
  49. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/migrations/__init__.py +0 -0
  50. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/migrations/helpers/__init__.py +0 -0
  51. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/migrations/helpers/postgres_helpers.py +0 -0
  52. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/organisations/permissions.py +0 -0
  53. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/projects/permissions.py +0 -0
  54. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/prometheus/__init__.py +0 -0
  55. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/prometheus/utils.py +0 -0
  56. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/py.typed +0 -0
  57. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/test_tools/__init__.py +0 -0
  58. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/test_tools/plugin.py +0 -0
  59. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/test_tools/types.py +0 -0
  60. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/test_tools/utils.py +0 -0
  61. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/common/types.py +0 -0
  62. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/__init__.py +0 -0
  63. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/api.py +0 -0
  64. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/constants.py +0 -0
  65. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/dynamodb.py +0 -0
  66. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/py.typed +0 -0
  67. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/pydantic_types.py +0 -0
  68. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/types.py +0 -0
  69. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/utils.py +0 -0
  70. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/flagsmith_schemas/validators.py +0 -0
  71. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/__init__.py +0 -0
  72. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/admin.py +0 -0
  73. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/apps.py +0 -0
  74. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/constants.py +0 -0
  75. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/decorators.py +0 -0
  76. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/exceptions.py +0 -0
  77. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/health.py +0 -0
  78. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/managers.py +0 -0
  79. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/metrics.py +0 -0
  80. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0001_initial.py +0 -0
  81. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0002_healthcheckmodel.py +0 -0
  82. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0003_add_completed_to_task.py +0 -0
  83. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0004_recreate_task_indexes.py +0 -0
  84. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0005_update_conditional_index_conditions.py +0 -0
  85. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0006_auto_20230221_0802.py +0 -0
  86. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0007_add_is_locked.py +0 -0
  87. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0008_add_get_task_to_process_function.py +0 -0
  88. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0009_add_recurring_task_run_first_run_at.py +0 -0
  89. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0010_task_priority.py +0 -0
  90. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0011_add_priority_to_get_tasks_to_process.py +0 -0
  91. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0012_add_locked_at_and_timeout.py +0 -0
  92. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0013_add_last_picked_at.py +0 -0
  93. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0014_add_trace_context.py +0 -0
  94. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/0015_add_is_disabled.py +0 -0
  95. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/__init__.py +0 -0
  96. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0008_get_recurring_tasks_to_process.sql +0 -0
  97. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0008_get_tasks_to_process.sql +0 -0
  98. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0011_get_tasks_to_process.sql +0 -0
  99. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0012_get_recurringtasks_to_process.sql +0 -0
  100. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0013_get_recurringtasks_to_process.sql +0 -0
  101. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/0015_get_recurringtasks_to_process.sql +0 -0
  102. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/migrations/sql/__init__.py +0 -0
  103. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/models.py +0 -0
  104. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/monitoring.py +0 -0
  105. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/processor.py +0 -0
  106. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/py.typed +0 -0
  107. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/routers.py +0 -0
  108. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/serializers.py +0 -0
  109. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/task_registry.py +0 -0
  110. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/task_run_method.py +0 -0
  111. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/tasks.py +0 -0
  112. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/threads.py +0 -0
  113. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/types.py +0 -0
  114. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/urls.py +0 -0
  115. {flagsmith_common-3.12.0 → flagsmith_common-3.12.1}/src/task_processor/utils.py +0 -0
  116. {flagsmith_common-3.12.0 → flagsmith_common-3.12.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.12.0
3
+ Version: 3.12.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
@@ -0,0 +1,192 @@
1
+ [project]
2
+ name = "flagsmith-common"
3
+ version = "3.12.1"
4
+ description = "Flagsmith's common library"
5
+ requires-python = ">=3.11,<4.0"
6
+ dependencies = []
7
+ license = "BSD-3-Clause"
8
+ license-files = ["LICENSE"]
9
+ readme = "README.md"
10
+ classifiers = [
11
+ "Framework :: Django",
12
+ "Framework :: Pytest",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: BSD License",
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ test-tools = [
19
+ "pyfakefs (>=6,<7)",
20
+ "pytest-django (>=4,<5)",
21
+ ]
22
+ common-core = [
23
+ "flagsmith-common[otel]",
24
+ "django (>4,<6)",
25
+ "django-health-check",
26
+ "djangorestframework-recursive",
27
+ "djangorestframework",
28
+ "drf-spectacular (>=0.28.0,<1)",
29
+ "drf-writable-nested",
30
+ "environs (<16)",
31
+ "gunicorn (>=19.1)",
32
+ "opentelemetry-instrumentation-django (>=0.46b0,<1)",
33
+ "opentelemetry-instrumentation-psycopg2 (>=0.46b0,<1)",
34
+ "opentelemetry-instrumentation-redis (>=0.46b0,<1)",
35
+ "redis (>=5,<6)",
36
+ "prometheus-client (>=0.0.16)",
37
+ "psycopg2-binary (>=2.9,<3)",
38
+ "requests",
39
+ "simplejson (>=3,<4)",
40
+ ]
41
+ otel = [
42
+ "inflection",
43
+ "opentelemetry-api (>=1.25,<2)",
44
+ "opentelemetry-sdk (>=1.25,<2)",
45
+ "opentelemetry-exporter-otlp-proto-grpc (>=1.25,<2)",
46
+ "opentelemetry-exporter-otlp-proto-http (>=1.25,<2)",
47
+ "sentry-sdk (>=2.0.0,<3.0.0)",
48
+ "structlog (>=24.4,<26)",
49
+ "typing_extensions",
50
+ ]
51
+ task-processor = [
52
+ "backoff (>=2.2.1,<3.0.0)",
53
+ "django (>4,<6)",
54
+ "django-health-check",
55
+ "environs (<16)",
56
+ "opentelemetry-api (>=1.25,<2)",
57
+ "prometheus-client (>=0.0.16)",
58
+ ]
59
+ flagsmith-schemas = [
60
+ "simplejson",
61
+ "typing_extensions",
62
+ "flagsmith-flag-engine>6",
63
+ ]
64
+
65
+ [[project.authors]]
66
+ name = "Matthew Elwell"
67
+
68
+ [[project.authors]]
69
+ name = "Gagan Trivedi"
70
+
71
+ [[project.authors]]
72
+ name = "Kim Gustyr"
73
+
74
+ [[project.authors]]
75
+ name = "Zach Aysan"
76
+
77
+ [[project.authors]]
78
+ name = "Francesco Lo Franco"
79
+
80
+ [[project.authors]]
81
+ name = "Rodrigo López Dato"
82
+
83
+ [[project.authors]]
84
+ name = "Evandro Myller"
85
+
86
+ [[project.authors]]
87
+ name = "Wadii Zaim"
88
+
89
+ [[project.maintainers]]
90
+ name = "Flagsmith Team"
91
+ email = "support@flagsmith.com"
92
+
93
+ [project.urls]
94
+ Changelog = "https://github.com/flagsmith/flagsmith-common/blob/main/CHANGELOG.md"
95
+ Download = "https://github.com/flagsmith/flagsmith-common/releases"
96
+ Homepage = "https://flagsmith.com"
97
+ Issues = "https://github.com/flagsmith/flagsmith-common/issues"
98
+ Repository = "https://github.com/flagsmith/flagsmith-common"
99
+
100
+ [project.scripts]
101
+ flagsmith = "common.core.main:main"
102
+ flagsmith-lint-tests = "common.lint_tests:main"
103
+
104
+ [project.entry-points.pytest11]
105
+ flagsmith-test-tools = "common.test_tools.plugin"
106
+
107
+ [dependency-groups]
108
+ dev = [
109
+ "diff-cover>=10.2.0",
110
+ "dj-database-url (>=3.1.2, <3.2.0)",
111
+ "django-stubs (>=5.1.3, <6.0.0)",
112
+ "djangorestframework-stubs (>=3.15.3, <4.0.0)",
113
+ "mypy (>=1.15.0, <2.0.0)",
114
+ "pre-commit",
115
+ "pydantic>=2.12.5",
116
+ "pyfakefs (>=6.2.0, <6.3.0)",
117
+ "pytest (>=9.0.3, <9.1.0)",
118
+ "pytest-asyncio (>=1.0.0, <2.0.0)",
119
+ "pytest-cov (>=7.1.0, <7.2.0)",
120
+ "pytest-django (>=4.10.0, <5.0.0)",
121
+ "pytest-freezegun (>=0.4.2, <1.0.0)",
122
+ "pytest-httpserver (>=1.1.3, <2.0.0)",
123
+ "pytest-mock (>=3.14.0, <4.0.0)",
124
+ "setuptools (>=83.0.0, <83.1.0)",
125
+ "types-python-dateutil (>=2.9.0.20250516, <3.0.0)",
126
+ "types-simplejson (>=3.20.0.20250326, <4.0.0)",
127
+ ]
128
+
129
+ [build-system]
130
+ requires = ["uv_build>=0.9.17,<0.10.0"]
131
+ build-backend = "uv_build"
132
+
133
+ [tool.uv.build-backend]
134
+ module-name = [
135
+ "common",
136
+ "task_processor",
137
+ "flagsmith_schemas",
138
+ ]
139
+
140
+ [tool.coverage.report]
141
+ exclude_also = [
142
+ "if TYPE_CHECKING:",
143
+ "if typing.TYPE_CHECKING:",
144
+ '@(abc\\.)?abstractmethod',
145
+ ]
146
+
147
+ [tool.pytest.ini_options]
148
+ addopts = [
149
+ "--ds=settings.dev",
150
+ "-vvvv",
151
+ "-p",
152
+ "no:warnings",
153
+ ]
154
+ console_output_style = "count"
155
+
156
+ [tool.ruff]
157
+ line-length = 88
158
+ indent-width = 4
159
+ target-version = "py311"
160
+ extend-exclude = ["migrations"]
161
+
162
+ [tool.ruff.format]
163
+ quote-style = "double"
164
+ indent-style = "space"
165
+ skip-magic-trailing-comma = false
166
+ line-ending = "auto"
167
+ docstring-code-format = true
168
+ docstring-code-line-length = "dynamic"
169
+
170
+ [tool.ruff.lint]
171
+ select = [
172
+ "C901",
173
+ "E4",
174
+ "E7",
175
+ "E9",
176
+ "F",
177
+ "I",
178
+ "W",
179
+ ]
180
+ ignore = []
181
+ fixable = ["ALL"]
182
+ unfixable = []
183
+
184
+ [tool.mypy]
185
+ plugins = ["mypy_django_plugin.main"]
186
+ strict = true
187
+
188
+ [tool.django-stubs]
189
+ django_settings_module = "settings.dev"
190
+
191
+ [tool.drf-stubs]
192
+ enabled = true
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flagsmith-common"
3
- version = "3.12.0"
3
+ version = "3.12.1"
4
4
  description = "Flagsmith's common library"
5
5
  requires-python = ">=3.11,<4.0"
6
6
  dependencies = []
@@ -8,6 +8,7 @@ import os
8
8
  import shlex
9
9
 
10
10
  from django.conf import settings
11
+ from django.core.exceptions import ImproperlyConfigured
11
12
  from django.core.management import (
12
13
  execute_from_command_line as django_execute_from_command_line,
13
14
  )
@@ -57,6 +58,11 @@ def serve(argv: list[str], *, prog: str) -> None:
57
58
 
58
59
  def run_task_processor(argv: list[str], *, prog: str) -> None:
59
60
  """Migrate, wait for migrations to be applied, then start the task processor."""
61
+ if not getattr(settings, "TASK_PROCESSOR_MODE", False):
62
+ raise ImproperlyConfigured(
63
+ f"{prog} {argv} is not supported as an entrypoint. "
64
+ "Please use `flagsmith start task-processor` to start the Task processor."
65
+ )
60
66
  _migrate()
61
67
  databases: list[str] = getattr(
62
68
  settings, "FLAGSMITH_WAIT_FOR_MIGRATIONS_DATABASES", ["default"]
@@ -21,6 +21,15 @@ env = Env()
21
21
  logger = logging.getLogger(__name__)
22
22
 
23
23
 
24
+ def _is_task_processor(argv: list[str]) -> bool:
25
+ """
26
+ Returns True if the current running process is inferred to be the task processor,
27
+ i.e. that it was run by either `flagsmith start task-processor` or
28
+ `flagsmith run-task-processor`.
29
+ """
30
+ return not {"task-processor", "run-task-processor"}.isdisjoint(argv)
31
+
32
+
24
33
  @contextlib.contextmanager
25
34
  def ensure_cli_env() -> typing.Generator[None, None, None]:
26
35
  """
@@ -50,7 +59,9 @@ def ensure_cli_env() -> typing.Generator[None, None, None]:
50
59
  if "docgen" in sys.argv:
51
60
  os.environ["DOCGEN_MODE"] = "true"
52
61
 
53
- if "task-processor" in sys.argv:
62
+ task_processor_mode = _is_task_processor(sys.argv)
63
+
64
+ if task_processor_mode:
54
65
  # A hacky way to signal we're not running the API
55
66
  os.environ["RUN_BY_PROCESSOR"] = "true"
56
67
 
@@ -70,9 +81,7 @@ def ensure_cli_env() -> typing.Generator[None, None, None]:
70
81
  )
71
82
 
72
83
  default_service_name = (
73
- "flagsmith-task-processor"
74
- if "task-processor" in sys.argv
75
- else "flagsmith-api"
84
+ "flagsmith-task-processor" if task_processor_mode else "flagsmith-api"
76
85
  )
77
86
  service_name = env.str("OTEL_SERVICE_NAME", default_service_name)
78
87
  otel_protocol = typing.cast(