dashpaan 0.1.0__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 (41) hide show
  1. dashpaan-0.1.0/PKG-INFO +40 -0
  2. dashpaan-0.1.0/README.md +16 -0
  3. dashpaan-0.1.0/dashpaan/__init__.py +4 -0
  4. dashpaan-0.1.0/dashpaan.egg-info/PKG-INFO +40 -0
  5. dashpaan-0.1.0/dashpaan.egg-info/SOURCES.txt +39 -0
  6. dashpaan-0.1.0/dashpaan.egg-info/dependency_links.txt +1 -0
  7. dashpaan-0.1.0/dashpaan.egg-info/requires.txt +2 -0
  8. dashpaan-0.1.0/dashpaan.egg-info/top_level.txt +5 -0
  9. dashpaan-0.1.0/django/__init__.py +0 -0
  10. dashpaan-0.1.0/elements/__init__.py +1 -0
  11. dashpaan-0.1.0/elements/base.py +14 -0
  12. dashpaan-0.1.0/elements/button.py +23 -0
  13. dashpaan-0.1.0/elements/card.py +29 -0
  14. dashpaan-0.1.0/elements/chart_comparison.py +19 -0
  15. dashpaan-0.1.0/elements/circular_distribution.py +21 -0
  16. dashpaan-0.1.0/elements/data_table.py +27 -0
  17. dashpaan-0.1.0/elements/donut_chart.py +26 -0
  18. dashpaan-0.1.0/elements/flex.py +25 -0
  19. dashpaan-0.1.0/elements/form.py +22 -0
  20. dashpaan-0.1.0/elements/form_element_upload_image.py +35 -0
  21. dashpaan-0.1.0/elements/heading.py +19 -0
  22. dashpaan-0.1.0/elements/information.py +21 -0
  23. dashpaan-0.1.0/elements/line_chart.py +20 -0
  24. dashpaan-0.1.0/elements/navigation.py +19 -0
  25. dashpaan-0.1.0/elements/page.py +31 -0
  26. dashpaan-0.1.0/elements/pie_chart.py +25 -0
  27. dashpaan-0.1.0/elements/qr_code.py +22 -0
  28. dashpaan-0.1.0/elements/reverse.py +9 -0
  29. dashpaan-0.1.0/elements/select.py +28 -0
  30. dashpaan-0.1.0/elements/sticky_stat.py +26 -0
  31. dashpaan-0.1.0/elements/sticky_target.py +24 -0
  32. dashpaan-0.1.0/elements/switch.py +23 -0
  33. dashpaan-0.1.0/elements/tabular.py +20 -0
  34. dashpaan-0.1.0/elements/text_area_editor.py +20 -0
  35. dashpaan-0.1.0/elements/text_field.py +25 -0
  36. dashpaan-0.1.0/elements/wave_chart.py +25 -0
  37. dashpaan-0.1.0/elements/wysiwig_editor.py +21 -0
  38. dashpaan-0.1.0/flask/__init__.py +0 -0
  39. dashpaan-0.1.0/json/__init__.py +58 -0
  40. dashpaan-0.1.0/setup.cfg +4 -0
  41. dashpaan-0.1.0/setup.py +23 -0
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.2
2
+ Name: dashpaan
3
+ Version: 0.1.0
4
+ Summary: Dashpaan is a Python package for building interactive dashboards using Flask and Django.
5
+ Home-page: https://github.com/yourusername/dashpaan
6
+ Author: Monir.co
7
+ Author-email: connect@monirs.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: jdatetime
14
+ Requires-Dist: traceback-with-variables
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # Dashpaan
26
+
27
+ A brief description of your project.
28
+
29
+ ## Installation
30
+ ```bash
31
+ pip install dashpaan
32
+ ```
33
+
34
+ ## Usage
35
+ ```python
36
+ import dashpaan
37
+ ```
38
+
39
+ ## License
40
+ MIT License
@@ -0,0 +1,16 @@
1
+ # Dashpaan
2
+
3
+ A brief description of your project.
4
+
5
+ ## Installation
6
+ ```bash
7
+ pip install dashpaan
8
+ ```
9
+
10
+ ## Usage
11
+ ```python
12
+ import dashpaan
13
+ ```
14
+
15
+ ## License
16
+ MIT License
@@ -0,0 +1,4 @@
1
+ from . import django
2
+ from dashpaan import elements
3
+ from dashpaan import flask
4
+ from dashpaan import json
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.2
2
+ Name: dashpaan
3
+ Version: 0.1.0
4
+ Summary: Dashpaan is a Python package for building interactive dashboards using Flask and Django.
5
+ Home-page: https://github.com/yourusername/dashpaan
6
+ Author: Monir.co
7
+ Author-email: connect@monirs.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: jdatetime
14
+ Requires-Dist: traceback-with-variables
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # Dashpaan
26
+
27
+ A brief description of your project.
28
+
29
+ ## Installation
30
+ ```bash
31
+ pip install dashpaan
32
+ ```
33
+
34
+ ## Usage
35
+ ```python
36
+ import dashpaan
37
+ ```
38
+
39
+ ## License
40
+ MIT License
@@ -0,0 +1,39 @@
1
+ README.md
2
+ setup.py
3
+ dashpaan/__init__.py
4
+ dashpaan.egg-info/PKG-INFO
5
+ dashpaan.egg-info/SOURCES.txt
6
+ dashpaan.egg-info/dependency_links.txt
7
+ dashpaan.egg-info/requires.txt
8
+ dashpaan.egg-info/top_level.txt
9
+ django/__init__.py
10
+ elements/__init__.py
11
+ elements/base.py
12
+ elements/button.py
13
+ elements/card.py
14
+ elements/chart_comparison.py
15
+ elements/circular_distribution.py
16
+ elements/data_table.py
17
+ elements/donut_chart.py
18
+ elements/flex.py
19
+ elements/form.py
20
+ elements/form_element_upload_image.py
21
+ elements/heading.py
22
+ elements/information.py
23
+ elements/line_chart.py
24
+ elements/navigation.py
25
+ elements/page.py
26
+ elements/pie_chart.py
27
+ elements/qr_code.py
28
+ elements/reverse.py
29
+ elements/select.py
30
+ elements/sticky_stat.py
31
+ elements/sticky_target.py
32
+ elements/switch.py
33
+ elements/tabular.py
34
+ elements/text_area_editor.py
35
+ elements/text_field.py
36
+ elements/wave_chart.py
37
+ elements/wysiwig_editor.py
38
+ flask/__init__.py
39
+ json/__init__.py
@@ -0,0 +1,2 @@
1
+ jdatetime
2
+ traceback-with-variables
@@ -0,0 +1,5 @@
1
+ dashpaan
2
+ django
3
+ elements
4
+ flask
5
+ json
File without changes
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,14 @@
1
+ class Element:
2
+ kind = None
3
+ version = "v1"
4
+
5
+ def __init__(self, **kwargs):
6
+ for key, value in kwargs.items():
7
+ if hasattr(self, key):
8
+ setattr(self, key, value)
9
+
10
+ def json(self):
11
+ return {
12
+ "kind": self.kind,
13
+ "version": self.version
14
+ }
@@ -0,0 +1,23 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Button(Element):
7
+ kind = "button"
8
+
9
+ title = ""
10
+ color = ""
11
+ action = {}
12
+
13
+ def json(self):
14
+ return {
15
+ **super(Button, self).json(),
16
+ "title": self.title,
17
+ "color": self.color,
18
+ "action": self.action
19
+ }
20
+
21
+ @classmethod
22
+ def from_json(cls, obj):
23
+ return Button(**obj)
@@ -0,0 +1,29 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class Card(Element):
5
+ kind = "card"
6
+
7
+ icons = []
8
+ cover = ""
9
+ size = ""
10
+ title = ""
11
+ boxes = []
12
+ menu = {}
13
+ description = ""
14
+
15
+ def json(self):
16
+ return {
17
+ **super(Card, self).json(),
18
+ "title": self.title,
19
+ "size": self.size,
20
+ "icons": self.icons,
21
+ "boxes": self.boxes,
22
+ "menu": self.menu,
23
+ "description": self.description,
24
+ "cover": self.cover
25
+ }
26
+
27
+ @classmethod
28
+ def from_json(cls, obj):
29
+ return Card(**obj)
@@ -0,0 +1,19 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class ChartComparison(Element):
7
+ kind = "wave-chart"
8
+
9
+ data = {}
10
+
11
+ def json(self):
12
+ return {
13
+ **super(ChartComparison, self).json(),
14
+ "data": self.data
15
+ }
16
+
17
+ @classmethod
18
+ def from_json(cls, obj):
19
+ return ChartComparison(**obj)
@@ -0,0 +1,21 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class CircularDistribution(Element):
7
+ kind = "circular-distribution"
8
+
9
+ labels = {}
10
+ series = {}
11
+
12
+ def json(self):
13
+ return {
14
+ **super(CircularDistribution, self).json(),
15
+ "labels": self.labels,
16
+ "series": self.series
17
+ }
18
+
19
+ @classmethod
20
+ def from_json(cls, obj):
21
+ return CircularDistribution(**obj)
@@ -0,0 +1,27 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class DataTable(Element):
7
+ kind = "data-table"
8
+
9
+ uri = ""
10
+ title = ""
11
+ errors = {}
12
+ columns = []
13
+ rows = []
14
+
15
+ def json(self):
16
+ return {
17
+ **super(DataTable, self).json(),
18
+ "uri": self.uri,
19
+ "title": self.title,
20
+ "errors": self.errors,
21
+ "columns": self.columns,
22
+ "rows": self.rows
23
+ }
24
+
25
+ @classmethod
26
+ def from_json(cls, obj):
27
+ return DataTable(**obj)
@@ -0,0 +1,26 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class DonutChart(Element):
7
+ kind = "donut-chart"
8
+
9
+ title = ""
10
+ series = {}
11
+ labels = []
12
+ options = {}
13
+
14
+ def json(self):
15
+ return {
16
+ **super(DonutChart, self).json(),
17
+ "version": self.version,
18
+ "title": self.title,
19
+ "series": self.series,
20
+ "labels": self.labels,
21
+ "options": self.options
22
+ }
23
+
24
+ @classmethod
25
+ def from_json(cls, obj):
26
+ return DonutChart(**obj)
@@ -0,0 +1,25 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class Flex(Element):
5
+ kind = "flex"
6
+
7
+ class_name = ""
8
+ mode = ""
9
+ breakable = ""
10
+ size = ""
11
+ elements = []
12
+
13
+ def json(self):
14
+ return {
15
+ **super(Flex, self).json(),
16
+ "mode": self.mode,
17
+ "breakable": self.breakable,
18
+ "className": self.class_name,
19
+ "size": self.size,
20
+ "elements": [element.json() for element in self.elements]
21
+ }
22
+
23
+ @classmethod
24
+ def from_json(cls, obj):
25
+ return Flex(**obj)
@@ -0,0 +1,22 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Form(Element):
7
+ kind = "form"
8
+ size = ""
9
+ fields = []
10
+ buttons = []
11
+
12
+ def json(self):
13
+ return {
14
+ **super(Form, self).json(),
15
+ "size": self.size,
16
+ "fields": [field.json() for field in self.fields],
17
+ "buttons": [button.json() for button in self.buttons]
18
+ }
19
+
20
+ @classmethod
21
+ def from_json(cls, obj):
22
+ return Form(**obj)
@@ -0,0 +1,35 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class FormElementUploadImage(Element):
7
+ kind = "formElementUploadImage"
8
+
9
+ uri = ""
10
+ title = ""
11
+ data = [
12
+ {
13
+ "id": "01ff61ca-2e47-4ebe-b076-7aa9491fcbcb",
14
+ "payload": {},
15
+ "headers": {},
16
+ "url": ""
17
+ }
18
+ ]
19
+ variables = {
20
+ "bookName": "The Hard Things about Hard Things",
21
+ "categoryId": 87564521
22
+ }
23
+
24
+ def json(self):
25
+ return {
26
+ **super(FormElementUploadImage, self).json(),
27
+ "uri": self.uri,
28
+ "title": self.title,
29
+ "data": self.data,
30
+ "variables": self.variables
31
+ }
32
+
33
+ @classmethod
34
+ def from_json(cls, obj):
35
+ return FormElementUploadImage(**obj)
@@ -0,0 +1,19 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class Heading(Element):
5
+ kind = "heading"
6
+
7
+ title = ""
8
+ subtitle = ""
9
+
10
+ def json(self):
11
+ return {
12
+ **super(Heading, self).json(),
13
+ "title": self.title,
14
+ "subtitle": self.subtitle
15
+ }
16
+
17
+ @classmethod
18
+ def from_json(cls, obj):
19
+ return Heading(**obj)
@@ -0,0 +1,21 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class Information(Element):
5
+ kind = "information"
6
+
7
+ title = ""
8
+ size = ""
9
+ information = []
10
+
11
+ def json(self):
12
+ return {
13
+ **super(Information, self).json(),
14
+ "title": self.title,
15
+ "size": self.size,
16
+ "information": self.information
17
+ }
18
+
19
+ @classmethod
20
+ def from_json(cls, obj):
21
+ return Information(**obj)
@@ -0,0 +1,20 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class LineChart(Element):
7
+ kind = "chart-line"
8
+
9
+ data = {}
10
+
11
+ def json(self):
12
+ return {
13
+ **super(LineChart, self).json(),
14
+ "version": self.version,
15
+ "data": self.data
16
+ }
17
+
18
+ @classmethod
19
+ def from_json(cls, obj):
20
+ return LineChart(**obj)
@@ -0,0 +1,19 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Navigation(Element):
7
+ kind = "navigation"
8
+
9
+ items = []
10
+
11
+ def json(self):
12
+ return {
13
+ **super(Navigation, self).json(),
14
+ "items": self.items
15
+ }
16
+
17
+ @classmethod
18
+ def from_json(cls, obj):
19
+ return Navigation(**obj)
@@ -0,0 +1,31 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Page(Element):
7
+ kind = "page"
8
+
9
+ uri = ""
10
+ title = ""
11
+ data = []
12
+ variables = {}
13
+ templates = {}
14
+ elements = []
15
+ navigation = "inherit"
16
+
17
+ def json(self):
18
+ return {
19
+ **super(Page, self).json(),
20
+ "uri": self.uri,
21
+ "title": self.title,
22
+ "data": self.data,
23
+ "variables": self.variables,
24
+ "templates": self.templates,
25
+ "elements": [element.json() for element in self.elements],
26
+ "navigation": self.navigation.json() if type(self.navigation) is list else self.navigation
27
+ }
28
+
29
+ @classmethod
30
+ def from_json(cls, obj):
31
+ return Page(**obj)
@@ -0,0 +1,25 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class PieChart(Element):
7
+ kind = "pie_chart"
8
+
9
+ title = ""
10
+ series = {}
11
+ labels = []
12
+ options = {}
13
+
14
+ def json(self):
15
+ return {
16
+ **super(PieChart, self).json(),
17
+ "title": self.title,
18
+ "series": self.series,
19
+ "labels": self.labels,
20
+ "options": self.options
21
+ }
22
+
23
+ @classmethod
24
+ def from_json(cls, obj):
25
+ return PieChart(**obj)
@@ -0,0 +1,22 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class QrCode(Element):
7
+ kind = "qr_code"
8
+
9
+ size = ""
10
+ url = ""
11
+
12
+ def json(self):
13
+ return {
14
+ **super(QrCode, self).json(),
15
+ "url": self.url,
16
+ "size": self.size,
17
+
18
+ }
19
+
20
+ @classmethod
21
+ def from_json(cls, obj):
22
+ return QrCode(**obj)
@@ -0,0 +1,9 @@
1
+ from dashpaan.elements.heading import Heading
2
+
3
+
4
+ def convert(obj):
5
+ if "kind" in obj:
6
+ if obj["kind"] == "heading":
7
+ return Heading.from_json(obj)
8
+
9
+ raise ValueError("Not Valid Element")
@@ -0,0 +1,28 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class Select(Element):
5
+ kind = "select"
6
+
7
+ name = ""
8
+ default = ""
9
+ multiple = True
10
+ label = ""
11
+ options = []
12
+ value = ""
13
+ placeholder = ""
14
+
15
+ def json(self):
16
+ return {
17
+ **super(Select, self).json(),
18
+ "name": self.name,
19
+ "default": self.default,
20
+ "label": self.label,
21
+ "options": self.options,
22
+ "value": self.value,
23
+ "placeholder": self.placeholder
24
+ }
25
+
26
+ @classmethod
27
+ def from_json(cls, obj):
28
+ return Select(**obj)
@@ -0,0 +1,26 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class StickyStat(Element):
7
+ kind = "sticky-stat"
8
+
9
+ size = ""
10
+ value = 0
11
+ color = ""
12
+ title = ""
13
+
14
+ def json(self):
15
+ return {
16
+ **super(StickyStat, self).json(),
17
+ "version": self.version,
18
+ "size": self.size,
19
+ "value": self.value,
20
+ "color": self.color,
21
+ "title": self.title
22
+ }
23
+
24
+ @classmethod
25
+ def from_json(cls, obj):
26
+ return StickyStat(**obj)
@@ -0,0 +1,24 @@
1
+ from dashpaan.elements.base import Element
2
+
3
+
4
+ class StickyTarget(Element):
5
+ kind = "sticky-target"
6
+
7
+ size = ""
8
+ color = ""
9
+ data = {}
10
+ more = {}
11
+
12
+ def json(self):
13
+ return {
14
+ **super(StickyTarget, self).json(),
15
+ "version": self.version,
16
+ "size": self.size,
17
+ "color": self.color,
18
+ "data": self.data,
19
+ "more": self.more
20
+ }
21
+
22
+ @classmethod
23
+ def from_json(cls, obj):
24
+ return StickyTarget(**obj)
@@ -0,0 +1,23 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Switch(Element):
7
+ kind = "switch"
8
+
9
+ type = ""
10
+ name = ""
11
+ label = ""
12
+
13
+ def json(self):
14
+ return {
15
+ **super(Switch, self).json(),
16
+ "type": self.type,
17
+ "name": self.name,
18
+ "label": self.label
19
+ }
20
+
21
+ @classmethod
22
+ def from_json(cls, obj):
23
+ return Switch(**obj)
@@ -0,0 +1,20 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class Tabular(Element):
7
+ kind = "tabular"
8
+
9
+ tabs = []
10
+
11
+ def json(self):
12
+ return {
13
+ **super(Tabular, self).json(),
14
+ "version": self.version,
15
+ "tabs": self.tabs
16
+ }
17
+
18
+ @classmethod
19
+ def from_json(cls, obj):
20
+ return Tabular(**obj)
@@ -0,0 +1,20 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class TextAreaEditor(Element):
7
+ kind = "text-area-editor"
8
+
9
+ name = ""
10
+
11
+ def json(self):
12
+ return {
13
+ **super(TextAreaEditor, self).json(),
14
+ "version": self.version,
15
+ "name": self.name
16
+ }
17
+
18
+ @classmethod
19
+ def from_json(cls, obj):
20
+ return TextAreaEditor(**obj)
@@ -0,0 +1,25 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class TextField(Element):
7
+ kind = "text-field"
8
+
9
+ name = ""
10
+ label = ""
11
+ required = False
12
+ defaultValue = ""
13
+
14
+ def json(self):
15
+ return {
16
+ **super(TextField, self).json(),
17
+ "name": self.name,
18
+ "label": self.label,
19
+ "required": self.required,
20
+ "defaultValue": self.defaultValue
21
+ }
22
+
23
+ @classmethod
24
+ def from_json(cls, obj):
25
+ return TextField(**obj)
@@ -0,0 +1,25 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class WaveChart(Element):
7
+ kind = "wave-chart"
8
+
9
+ size = ""
10
+ title = ""
11
+ subtitle = ""
12
+ series = {}
13
+
14
+ def json(self):
15
+ return {
16
+ **super(WaveChart, self).json(),
17
+ "size": self.size,
18
+ "title": self.title,
19
+ "subtitle": self.subtitle,
20
+ "series": self.series
21
+ }
22
+
23
+ @classmethod
24
+ def from_json(cls, obj):
25
+ return WaveChart(**obj)
@@ -0,0 +1,21 @@
1
+ import json
2
+
3
+ from dashpaan.elements.base import Element
4
+
5
+
6
+ class WYSIWYGEditor(Element):
7
+ kind = "wysiwyg-editor"
8
+
9
+ name = ""
10
+ content = ""
11
+
12
+ def json(self):
13
+ return {
14
+ **super(WYSIWYGEditor, self).json(),
15
+ "name": self.name,
16
+ "content": self.content
17
+ }
18
+
19
+ @classmethod
20
+ def from_json(cls, obj):
21
+ return WYSIWYGEditor(**obj)
File without changes
@@ -0,0 +1,58 @@
1
+ from json import *
2
+ import json as origin
3
+
4
+ from datetime import datetime
5
+
6
+ from ..elements.base import Element
7
+ from dashpaan.elements.reverse import convert
8
+
9
+
10
+ class DashpaanJSONEncoder(origin.JSONEncoder):
11
+ def default(self, obj):
12
+ if isinstance(obj, Element):
13
+ return obj.json()
14
+
15
+ if isinstance(obj, datetime):
16
+ # Handle datetime serialization
17
+ return obj.isoformat()
18
+
19
+ # Fallback to the default serialization
20
+ return super().default(obj)
21
+
22
+
23
+ class DashpaanJSONDecoder(origin.JSONDecoder):
24
+ def __init__(self, *args, **kwargs):
25
+ super().__init__(object_hook=self.object_hook, *args, **kwargs)
26
+
27
+ def object_hook(self, obj):
28
+ # Deserialize Element
29
+ if "kind" in obj and "version" in obj:
30
+ return convert(obj)
31
+
32
+ # Deserialize datetime (assuming ISO 8601 format)
33
+ for key, value in obj.items():
34
+ if isinstance(value, str):
35
+ try:
36
+ obj[key] = datetime.fromisoformat(value)
37
+ except ValueError:
38
+ pass
39
+
40
+ return obj
41
+
42
+
43
+ JSONEncoder = DashpaanJSONEncoder
44
+ JSONDecoder = DashpaanJSONDecoder
45
+
46
+
47
+ def dumps(obj, *args, **kwargs):
48
+ return origin.dumps(obj, cls=DashpaanJSONEncoder, *args, **kwargs)
49
+
50
+
51
+ def loads(obj, *args, **kwargs):
52
+ return origin.loads(obj, cls=DashpaanJSONDecoder, *args, **kwargs)
53
+
54
+
55
+ __all__ = [
56
+ 'dump', 'dumps', 'load', 'loads',
57
+ 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
58
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='dashpaan',
5
+ version='0.1.0',
6
+ packages=find_packages(),
7
+ include_package_data=True,
8
+ install_requires=[
9
+ line.strip() for line in open('requirements.txt').readlines() if line.strip()
10
+ ],
11
+ author='Monir.co',
12
+ author_email='connect@monirs.com',
13
+ description='Dashpaan is a Python package for building interactive dashboards using Flask and Django.',
14
+ long_description=open('README.md').read(),
15
+ long_description_content_type='text/markdown',
16
+ url='https://github.com/yourusername/dashpaan',
17
+ classifiers=[
18
+ 'Programming Language :: Python :: 3',
19
+ 'License :: OSI Approved :: MIT License',
20
+ 'Operating System :: OS Independent',
21
+ ],
22
+ python_requires='>=3.6',
23
+ )