flagsmith-flag-engine 0.1.0__tar.gz → 0.1.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 (42) hide show
  1. Flagsmith Flag Engine-0.1.1/Flagsmith_Flag_Engine.egg-info/PKG-INFO +35 -0
  2. flagsmith-flag-engine-0.1.0/Flagsmith_Flag_Engine.egg-info/SOURCES.txt → Flagsmith Flag Engine-0.1.1/Flagsmith_Flag_Engine.egg-info/SOURCES.txt +1 -7
  3. Flagsmith Flag Engine-0.1.1/PKG-INFO +35 -0
  4. flagsmith-flag-engine-0.1.0/flag_engine/environments/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/environments/schemas.py +6 -6
  5. flagsmith-flag-engine-0.1.0/flag_engine/features/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/features/schemas.py +11 -17
  6. flagsmith-flag-engine-0.1.0/flag_engine/identities/models.py → Flagsmith Flag Engine-0.1.1/flag_engine/identities/models.py +8 -0
  7. flagsmith-flag-engine-0.1.0/flag_engine/identities/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/identities/schemas.py +17 -14
  8. flagsmith-flag-engine-0.1.0/flag_engine/organisations/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/organisations/schemas.py +5 -5
  9. flagsmith-flag-engine-0.1.0/flag_engine/projects/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/projects/schemas.py +6 -6
  10. flagsmith-flag-engine-0.1.0/flag_engine/segments/schemas.py → Flagsmith Flag Engine-0.1.1/flag_engine/segments/schemas.py +19 -9
  11. Flagsmith Flag Engine-0.1.1/setup.py +15 -0
  12. flagsmith-flag-engine-0.1.0/Flagsmith_Flag_Engine.egg-info/PKG-INFO +0 -43
  13. flagsmith-flag-engine-0.1.0/PKG-INFO +0 -43
  14. flagsmith-flag-engine-0.1.0/flag_engine/utils/fields.py +0 -18
  15. flagsmith-flag-engine-0.1.0/setup.py +0 -28
  16. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/Flagsmith_Flag_Engine.egg-info/dependency_links.txt +0 -0
  17. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/Flagsmith_Flag_Engine.egg-info/requires.txt +0 -0
  18. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/Flagsmith_Flag_Engine.egg-info/top_level.txt +0 -0
  19. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/LICENSE.txt +0 -0
  20. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/README.md +0 -0
  21. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/__init__.py +0 -0
  22. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/__init__.py +0 -0
  23. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/builders.py +0 -0
  24. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/integrations/__init__.py +0 -0
  25. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/integrations/models.py +0 -0
  26. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/integrations/schemas.py +0 -0
  27. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/environments/models.py +0 -0
  28. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/features/__init__.py +0 -0
  29. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/features/constants.py +0 -0
  30. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/features/models.py +0 -0
  31. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/identities/__init__.py +0 -0
  32. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/identities/builders.py +0 -0
  33. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/organisations/__init__.py +0 -0
  34. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/organisations/models.py +0 -0
  35. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/projects/__init__.py +0 -0
  36. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/projects/models.py +0 -0
  37. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/segments/__init__.py +0 -0
  38. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/segments/constants.py +0 -0
  39. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/segments/models.py +0 -0
  40. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/utils/__init__.py +0 -0
  41. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/flag_engine/utils/hashing.py +0 -0
  42. {flagsmith-flag-engine-0.1.0 → Flagsmith Flag Engine-0.1.1}/setup.cfg +0 -0
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.1
2
+ Name: Flagsmith-Flag-Engine
3
+ Version: 0.1.1
4
+ Summary: Flag engine for the Flagsmith API.
5
+ Home-page: http://pypi.python.org/pypi/flagsmith-flag-engine/
6
+ Author: Matthew Elwell
7
+ Author-email: matthew.elwell@flagsmith.com
8
+ License: LICENSE.txt
9
+ Platform: UNKNOWN
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.txt
12
+
13
+ [![Feature Flag, Remote Config and A/B Testing platform, Flagsmith](https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png)](https://www.flagsmith.com/)
14
+
15
+ [Flagsmith](https://www.flagsmith.com/) is an open source, fully featured, Feature Flag and Remote Config service. Use
16
+ our hosted API, deploy to your own private cloud, or run on-premise.
17
+
18
+ # Flagsmith Flag Engine
19
+
20
+ This project powers the core [Flagsmith API](https://github.com/Flagsmith/flagsmith-api) flag evaluations engine.
21
+
22
+ ## Setup
23
+
24
+ ```bash
25
+ python -m venv .venv
26
+ source .venv/bin/activate
27
+ python -m pip install -r requirements-dev.txt
28
+ ```
29
+
30
+ ## Design
31
+
32
+ * Marshmallow Schemas
33
+ * Plain Python
34
+
35
+
@@ -34,10 +34,4 @@ flag_engine/segments/constants.py
34
34
  flag_engine/segments/models.py
35
35
  flag_engine/segments/schemas.py
36
36
  flag_engine/utils/__init__.py
37
- flag_engine/utils/fields.py
38
- flag_engine/utils/hashing.py
39
- flagsmith_flag_engine.egg-info/PKG-INFO
40
- flagsmith_flag_engine.egg-info/SOURCES.txt
41
- flagsmith_flag_engine.egg-info/dependency_links.txt
42
- flagsmith_flag_engine.egg-info/requires.txt
43
- flagsmith_flag_engine.egg-info/top_level.txt
37
+ flag_engine/utils/hashing.py
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.1
2
+ Name: Flagsmith Flag Engine
3
+ Version: 0.1.1
4
+ Summary: Flag engine for the Flagsmith API.
5
+ Home-page: http://pypi.python.org/pypi/flagsmith-flag-engine/
6
+ Author: Matthew Elwell
7
+ Author-email: matthew.elwell@flagsmith.com
8
+ License: LICENSE.txt
9
+ Platform: UNKNOWN
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.txt
12
+
13
+ [![Feature Flag, Remote Config and A/B Testing platform, Flagsmith](https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png)](https://www.flagsmith.com/)
14
+
15
+ [Flagsmith](https://www.flagsmith.com/) is an open source, fully featured, Feature Flag and Remote Config service. Use
16
+ our hosted API, deploy to your own private cloud, or run on-premise.
17
+
18
+ # Flagsmith Flag Engine
19
+
20
+ This project powers the core [Flagsmith API](https://github.com/Flagsmith/flagsmith-api) flag evaluations engine.
21
+
22
+ ## Setup
23
+
24
+ ```bash
25
+ python -m venv .venv
26
+ source .venv/bin/activate
27
+ python -m pip install -r requirements-dev.txt
28
+ ```
29
+
30
+ ## Design
31
+
32
+ * Marshmallow Schemas
33
+ * Plain Python
34
+
35
+
@@ -1,13 +1,14 @@
1
- from marshmallow import Schema, fields, post_load
1
+ from marshmallow import fields
2
2
 
3
3
  from flag_engine.environments.integrations.schemas import IntegrationSchema
4
4
  from flag_engine.environments.models import EnvironmentModel
5
5
  from flag_engine.features.schemas import FeatureStateSchema
6
6
  from flag_engine.projects.schemas import ProjectSchema
7
- from flag_engine.utils.fields import ListOrDjangoRelatedManagerField
7
+ from flag_engine.utils.marshmallow.fields import ListOrDjangoRelatedManagerField
8
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
8
9
 
9
10
 
10
- class EnvironmentSchema(Schema):
11
+ class EnvironmentSchema(LoadToModelSchema):
11
12
  id = fields.Int()
12
13
  api_key = fields.Str()
13
14
  feature_states = ListOrDjangoRelatedManagerField(
@@ -21,6 +22,5 @@ class EnvironmentSchema(Schema):
21
22
  mixpanel_config = fields.Nested(IntegrationSchema, required=False, allow_none=True)
22
23
  amplitude_config = fields.Nested(IntegrationSchema, required=False, allow_none=True)
23
24
 
24
- @post_load()
25
- def make_environment(self, data: dict, **kwargs) -> EnvironmentModel:
26
- return EnvironmentModel(**data)
25
+ class Meta:
26
+ model_class = EnvironmentModel
@@ -8,39 +8,33 @@ from flag_engine.features.models import (
8
8
  MultivariateFeatureOptionModel,
9
9
  MultivariateFeatureStateValueModel,
10
10
  )
11
- from flag_engine.utils.fields import ListOrDjangoRelatedManagerField
11
+ from flag_engine.utils.marshmallow.fields import ListOrDjangoRelatedManagerField
12
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
12
13
 
13
14
 
14
- class FeatureSchema(Schema):
15
+ class FeatureSchema(LoadToModelSchema):
15
16
  id = fields.Int()
16
17
  name = fields.Str()
17
18
  type = fields.Str()
18
19
 
19
- @post_load()
20
- def make_feature(self, data, **kwargs) -> FeatureModel:
21
- return FeatureModel(**data)
20
+ class Meta:
21
+ model_class = FeatureModel
22
22
 
23
23
 
24
- class MultivariateFeatureOptionSchema(Schema):
24
+ class MultivariateFeatureOptionSchema(LoadToModelSchema):
25
25
  value = fields.Field(allow_none=True)
26
26
 
27
- @post_load()
28
- def make_multivariate_feature_option(
29
- self, data, **kwargs
30
- ) -> MultivariateFeatureOptionModel:
31
- return MultivariateFeatureOptionModel(**data)
27
+ class Meta:
28
+ model_class = MultivariateFeatureOptionModel
32
29
 
33
30
 
34
- class MultivariateFeatureStateValueSchema(Schema):
31
+ class MultivariateFeatureStateValueSchema(LoadToModelSchema):
35
32
  id = fields.Int()
36
33
  multivariate_feature_option = fields.Nested(MultivariateFeatureOptionSchema)
37
34
  percentage_allocation = fields.Decimal(validate=[validate.Range(0, 100)])
38
35
 
39
- @post_load()
40
- def make_multivariate_feature_state_value(
41
- self, data, **kwargs
42
- ) -> MultivariateFeatureStateValueModel:
43
- return MultivariateFeatureStateValueModel(**data)
36
+ class Meta:
37
+ model_class = MultivariateFeatureStateValueModel
44
38
 
45
39
 
46
40
  class FeatureStateSchema(Schema):
@@ -28,6 +28,10 @@ class IdentityModel:
28
28
  identity_features: typing.List[FeatureStateModel] = field(default_factory=list)
29
29
  identity_traits: typing.List[TraitModel] = field(default_factory=list)
30
30
 
31
+ @property
32
+ def composite_key(self):
33
+ return self.generate_composite_key(self.environment_api_key, self.identifier)
34
+
31
35
  def get_all_feature_states(
32
36
  self, environment: EnvironmentModel
33
37
  ) -> typing.List[FeatureStateModel]:
@@ -51,6 +55,10 @@ class IdentityModel:
51
55
  for rule in segment.rules
52
56
  )
53
57
 
58
+ @staticmethod
59
+ def generate_composite_key(env_key: str, identifier: str) -> str:
60
+ return f"{env_key}_{identifier}"
61
+
54
62
  def _matches_segment_rule(self, rule: SegmentRuleModel, segment_id: int) -> bool:
55
63
  matches_conditions = (
56
64
  rule.matching_function(
@@ -1,22 +1,23 @@
1
1
  import typing
2
+ from datetime import datetime
3
+
4
+ from marshmallow import EXCLUDE, fields, post_dump, utils
2
5
 
3
- from marshmallow import Schema, fields, post_load, utils, post_dump, EXCLUDE
4
6
  from flag_engine.features.schemas import FeatureStateSchema
5
7
  from flag_engine.identities.models import IdentityModel, TraitModel
6
- from flag_engine.utils.fields import ListOrDjangoRelatedManagerField
7
- from datetime import datetime
8
+ from flag_engine.utils.marshmallow.fields import ListOrDjangoRelatedManagerField
9
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
8
10
 
9
11
 
10
- class TraitSchema(Schema):
12
+ class TraitSchema(LoadToModelSchema):
11
13
  trait_key = fields.Str()
12
14
  trait_value = fields.Str()
13
15
 
14
- @post_load
15
- def make_trait(self, data, **kwargs):
16
- return TraitModel(**data)
16
+ class Meta:
17
+ model_class = TraitModel
17
18
 
18
19
 
19
- class IdentitySchema(Schema):
20
+ class IdentitySchema(LoadToModelSchema):
20
21
  id = fields.Int()
21
22
  identifier = fields.Str()
22
23
  composite_key = fields.Str(dump_only=True)
@@ -38,14 +39,16 @@ class IdentitySchema(Schema):
38
39
  class Meta:
39
40
  # to exclude dump only fields, e.g: composite_key
40
41
  unknown = EXCLUDE
41
-
42
- @post_load
43
- def make_identity(self, data, **kwargs):
44
- return IdentityModel(**data)
42
+ model_class = IdentityModel
45
43
 
46
44
  @post_dump
47
- def generate_composite_key(self, data, **kwargs):
48
- data["composite_key"] = f"{data['environment_api_key']}_{data['identifier']}"
45
+ def generate_composite_key(self, data: typing.Dict[str, typing.Any], **kwargs):
46
+ data.setdefault(
47
+ "composite_key",
48
+ IdentityModel.generate_composite_key(
49
+ env_key=data["environment_api_key"], identifier=data["identifier"]
50
+ ),
51
+ )
49
52
  return data
50
53
 
51
54
  def serialize_environment_api_key(self, obj: typing.Any) -> int:
@@ -1,15 +1,15 @@
1
- from marshmallow import Schema, fields, post_load
1
+ from marshmallow import fields
2
2
 
3
3
  from flag_engine.organisations.models import OrganisationModel
4
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
4
5
 
5
6
 
6
- class OrganisationSchema(Schema):
7
+ class OrganisationSchema(LoadToModelSchema):
7
8
  id = fields.Int()
8
9
  name = fields.Str()
9
10
  stop_serving_flags = fields.Boolean()
10
11
  persist_trait_data = fields.Boolean()
11
12
  feature_analytics = fields.Boolean()
12
13
 
13
- @post_load()
14
- def make_organisation(self, data, **kwargs) -> OrganisationModel:
15
- return OrganisationModel(**data)
14
+ class Meta:
15
+ model_class = OrganisationModel
@@ -1,12 +1,13 @@
1
- from marshmallow import Schema, fields, post_load
1
+ from marshmallow import fields
2
2
 
3
3
  from flag_engine.organisations.schemas import OrganisationSchema
4
4
  from flag_engine.projects.models import ProjectModel
5
5
  from flag_engine.segments.schemas import SegmentSchema
6
- from flag_engine.utils.fields import ListOrDjangoRelatedManagerField
6
+ from flag_engine.utils.marshmallow.fields import ListOrDjangoRelatedManagerField
7
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
7
8
 
8
9
 
9
- class ProjectSchema(Schema):
10
+ class ProjectSchema(LoadToModelSchema):
10
11
  id = fields.Int()
11
12
  name = fields.Str()
12
13
  segments = ListOrDjangoRelatedManagerField(
@@ -15,6 +16,5 @@ class ProjectSchema(Schema):
15
16
  organisation = fields.Nested(OrganisationSchema)
16
17
  hide_disabled_flags = fields.Bool()
17
18
 
18
- @post_load()
19
- def make_project(self, data, **kwargs) -> ProjectModel:
20
- return ProjectModel(**data)
19
+ class Meta:
20
+ model_class = ProjectModel
@@ -1,17 +1,25 @@
1
- from marshmallow import Schema, fields, post_load, validate
1
+ from marshmallow import fields, validate
2
2
 
3
3
  from flag_engine.segments import constants
4
- from flag_engine.segments.models import SegmentModel
5
- from flag_engine.utils.fields import ListOrDjangoRelatedManagerField
4
+ from flag_engine.segments.models import (
5
+ SegmentConditionModel,
6
+ SegmentModel,
7
+ SegmentRuleModel,
8
+ )
9
+ from flag_engine.utils.marshmallow.fields import ListOrDjangoRelatedManagerField
10
+ from flag_engine.utils.marshmallow.schemas import LoadToModelSchema
6
11
 
7
12
 
8
- class SegmentConditionSchema(Schema):
13
+ class SegmentConditionSchema(LoadToModelSchema):
9
14
  operator = fields.Str(validate=validate.OneOf(constants.CONDITION_OPERATORS))
10
15
  property_ = fields.Str(attribute="property")
11
16
  value = fields.Field()
12
17
 
18
+ class Meta:
19
+ model_class = SegmentConditionModel
13
20
 
14
- class SegmentRuleSchema(Schema):
21
+
22
+ class SegmentRuleSchema(LoadToModelSchema):
15
23
  type = fields.Str(validate=validate.OneOf(constants.RULE_TYPES))
16
24
  rules = ListOrDjangoRelatedManagerField(
17
25
  fields.Nested("SegmentRuleSchema"), required=False
@@ -20,12 +28,14 @@ class SegmentRuleSchema(Schema):
20
28
  fields.Nested(SegmentConditionSchema), required=False
21
29
  )
22
30
 
31
+ class Meta:
32
+ model_class = SegmentRuleModel
33
+
23
34
 
24
- class SegmentSchema(Schema):
35
+ class SegmentSchema(LoadToModelSchema):
25
36
  id = fields.Int()
26
37
  name = fields.Str()
27
38
  rules = ListOrDjangoRelatedManagerField(fields.Nested(SegmentRuleSchema))
28
39
 
29
- @post_load()
30
- def make_segment(self, data, **kwargs):
31
- return SegmentModel(**data)
40
+ class Meta:
41
+ model_class = SegmentModel
@@ -0,0 +1,15 @@
1
+ from setuptools import find_packages, setup
2
+
3
+ setup(
4
+ name="Flagsmith Flag Engine",
5
+ version="0.1.1",
6
+ author="Matthew Elwell",
7
+ author_email="matthew.elwell@flagsmith.com",
8
+ packages=find_packages(include=["flag_engine", "flag_engine.*"]),
9
+ url="http://pypi.python.org/pypi/flagsmith-flag-engine/",
10
+ license="LICENSE.txt",
11
+ description="Flag engine for the Flagsmith API.",
12
+ long_description=open("README.md").read(),
13
+ long_description_content_type="text/markdown",
14
+ install_requires=["marshmallow", "dataclasses"],
15
+ )
@@ -1,43 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: flagsmith-flag-engine
3
- Version: 0.1.0
4
- Summary: Flag engine for the Flagsmith API.
5
- Home-page: https://github.com/Flagsmith/flagsmith-engine
6
- Author: Flagsmith
7
- Author-email: support@flagsmith.com
8
- License: BSD3
9
- Description: [![Feature Flag, Remote Config and A/B Testing platform, Flagsmith](https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png)](https://www.flagsmith.com/)
10
-
11
- [Flagsmith](https://www.flagsmith.com/) is an open source, fully featured, Feature Flag and Remote Config service. Use
12
- our hosted API, deploy to your own private cloud, or run on-premise.
13
-
14
- # Flagsmith Flag Engine
15
-
16
- This project powers the core [Flagsmith API](https://github.com/Flagsmith/flagsmith-api) flag evaluations engine.
17
-
18
- ## Setup
19
-
20
- ```bash
21
- python -m venv .venv
22
- source .venv/bin/activate
23
- python -m pip install -r requirements-dev.txt
24
- ```
25
-
26
- ## Design
27
-
28
- * Marshmallow Schemas
29
- * Plain Python
30
-
31
- Platform: UNKNOWN
32
- Classifier: License :: OSI Approved :: BSD License
33
- Classifier: Programming Language :: Python :: 3
34
- Classifier: Programming Language :: Python :: 3.0
35
- Classifier: Programming Language :: Python :: 3.1
36
- Classifier: Programming Language :: Python :: 3.2
37
- Classifier: Programming Language :: Python :: 3.3
38
- Classifier: Programming Language :: Python :: 3.4
39
- Classifier: Programming Language :: Python :: 3.5
40
- Classifier: Programming Language :: Python :: 3.6
41
- Classifier: Programming Language :: Python :: 3.7
42
- Classifier: Programming Language :: Python :: 3.8
43
- Classifier: Programming Language :: Python :: 3.9
@@ -1,43 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: flagsmith-flag-engine
3
- Version: 0.1.0
4
- Summary: Flag engine for the Flagsmith API.
5
- Home-page: https://github.com/Flagsmith/flagsmith-engine
6
- Author: Flagsmith
7
- Author-email: support@flagsmith.com
8
- License: BSD3
9
- Description: [![Feature Flag, Remote Config and A/B Testing platform, Flagsmith](https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png)](https://www.flagsmith.com/)
10
-
11
- [Flagsmith](https://www.flagsmith.com/) is an open source, fully featured, Feature Flag and Remote Config service. Use
12
- our hosted API, deploy to your own private cloud, or run on-premise.
13
-
14
- # Flagsmith Flag Engine
15
-
16
- This project powers the core [Flagsmith API](https://github.com/Flagsmith/flagsmith-api) flag evaluations engine.
17
-
18
- ## Setup
19
-
20
- ```bash
21
- python -m venv .venv
22
- source .venv/bin/activate
23
- python -m pip install -r requirements-dev.txt
24
- ```
25
-
26
- ## Design
27
-
28
- * Marshmallow Schemas
29
- * Plain Python
30
-
31
- Platform: UNKNOWN
32
- Classifier: License :: OSI Approved :: BSD License
33
- Classifier: Programming Language :: Python :: 3
34
- Classifier: Programming Language :: Python :: 3.0
35
- Classifier: Programming Language :: Python :: 3.1
36
- Classifier: Programming Language :: Python :: 3.2
37
- Classifier: Programming Language :: Python :: 3.3
38
- Classifier: Programming Language :: Python :: 3.4
39
- Classifier: Programming Language :: Python :: 3.5
40
- Classifier: Programming Language :: Python :: 3.6
41
- Classifier: Programming Language :: Python :: 3.7
42
- Classifier: Programming Language :: Python :: 3.8
43
- Classifier: Programming Language :: Python :: 3.9
@@ -1,18 +0,0 @@
1
- import typing
2
-
3
- from marshmallow import fields
4
-
5
-
6
- class ListOrDjangoRelatedManagerField(fields.List):
7
- def _serialize(
8
- self, value, *args, **kwargs
9
- ) -> typing.Optional[typing.List[typing.Any]]:
10
- if hasattr(value, "filter"):
11
- # indicates that the object was passed from django and the 'list' is
12
- # actually a related manager field, so grab all of the filtered related
13
- # objects
14
- filter_kwargs = self.metadata.get("filter_kwargs", {})
15
- value = list(value.filter(**filter_kwargs))
16
- return super(ListOrDjangoRelatedManagerField, self)._serialize(
17
- value, *args, **kwargs
18
- )
@@ -1,28 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
- setup(
4
- name="flagsmith-flag-engine",
5
- version="0.1.0",
6
- author="Flagsmith",
7
- author_email="support@flagsmith.com",
8
- packages=find_packages(include=["flag_engine", "flag_engine.*"]),
9
- url="https://github.com/Flagsmith/flagsmith-engine",
10
- license="BSD3",
11
- description="Flag engine for the Flagsmith API.",
12
- long_description=open("README.md").read(),
13
- install_requires=["marshmallow", "dataclasses"],
14
- classifiers=[
15
- "License :: OSI Approved :: BSD License",
16
- "Programming Language :: Python :: 3",
17
- "Programming Language :: Python :: 3.0",
18
- "Programming Language :: Python :: 3.1",
19
- "Programming Language :: Python :: 3.2",
20
- "Programming Language :: Python :: 3.3",
21
- "Programming Language :: Python :: 3.4",
22
- "Programming Language :: Python :: 3.5",
23
- "Programming Language :: Python :: 3.6",
24
- "Programming Language :: Python :: 3.7",
25
- "Programming Language :: Python :: 3.8",
26
- "Programming Language :: Python :: 3.9",
27
- ],
28
- )