pydzn 0.1.2__py3-none-any.whl → 0.1.4__py3-none-any.whl
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.
- pydzn/base_component.py +0 -1
- pydzn/components/__init__.py +10 -0
- pydzn/components/button/component.py +74 -14
- pydzn/components/card/component.py +93 -0
- pydzn/components/card/template.html +3 -0
- pydzn/components/drawer/component.py +14 -0
- pydzn/components/drawer/template.html +3 -0
- pydzn/components/hamburger_menu/component.py +210 -0
- pydzn/components/hamburger_menu/template.html +3 -0
- pydzn/components/nav_item/component.py +220 -0
- pydzn/components/nav_item/template.html +3 -0
- pydzn/components/sidebar/component.py +70 -0
- pydzn/components/sidebar/template.html +3 -0
- pydzn/components/text/component.py +15 -0
- pydzn/components/text/template.html +3 -0
- pydzn/dzn.py +96 -0
- pydzn/grid_builder.py +77 -18
- pydzn/responsive.py +24 -0
- pydzn/variants.py +215 -0
- pydzn-0.1.4.dist-info/METADATA +168 -0
- pydzn-0.1.4.dist-info/RECORD +27 -0
- pydzn-0.1.2.dist-info/METADATA +0 -38
- pydzn-0.1.2.dist-info/RECORD +0 -13
- {pydzn-0.1.2.dist-info → pydzn-0.1.4.dist-info}/WHEEL +0 -0
- {pydzn-0.1.2.dist-info → pydzn-0.1.4.dist-info}/licenses/LICENSE +0 -0
- {pydzn-0.1.2.dist-info → pydzn-0.1.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pydzn
|
3
|
+
Version: 0.1.4
|
4
|
+
Summary: Build complex websites in pure python with pydzn layout builder, semantic css classes and an extendable components library for server-side rendering.
|
5
|
+
Author-email: Ryan Kirkish <ryan@foo.com>
|
6
|
+
License: Apache-2.0
|
7
|
+
Project-URL: Homepage, https://github.com/anthonyrka/pydzn
|
8
|
+
Project-URL: Repository, https://github.com/anthonyrka/pydzn
|
9
|
+
Project-URL: Issues, https://github.com/anthonyrka/pydzn/issues
|
10
|
+
Keywords: design-system,css,utility-classes,jinja2,components,grid,htmx
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
14
|
+
Classifier: Programming Language :: Python
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Framework :: Flask
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
22
|
+
Requires-Python: >=3.10
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
License-File: LICENSE
|
25
|
+
Requires-Dist: Jinja2>=3.1
|
26
|
+
Provides-Extra: flask
|
27
|
+
Requires-Dist: Flask>=2.3; extra == "flask"
|
28
|
+
Provides-Extra: dev
|
29
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
30
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
31
|
+
Requires-Dist: black>=24; extra == "dev"
|
32
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
33
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
34
|
+
Requires-Dist: twine>=5; extra == "dev"
|
35
|
+
Dynamic: license-file
|
36
|
+
|
37
|
+
# pydzn
|
38
|
+
*Pronounced:* **[paɪ dɪˈzaɪn]** — “**pie design**” (aka **py-design**)
|
39
|
+
|
40
|
+
Build full websites in Python with server-side components, a design system that leverages semantic classes, and a grid layout builder.
|
41
|
+
|
42
|
+
## What is pydzn
|
43
|
+
pydzn or "py design" is a lightweight python library that makes it easy to design, build and serve complex websites all in python. It provides an api into CSS-grid for designing layouts and serves as a light-weight website builder with a built-in, and extendable, component library as well as a library for setting CSS semantic classes.
|
44
|
+
|
45
|
+
|
46
|
+
## Examples
|
47
|
+
- For examples see: [pydzn-website](https://github.com/anthonyrka/pydzn-website)
|
48
|
+
|
49
|
+
## References
|
50
|
+
- See [PyPI](https://pypi.org/project/pydzn/)
|
51
|
+
|
52
|
+
|
53
|
+
## A website builder for python developers (not front-end developers)
|
54
|
+
The layout builder contains a debug mode allowing you to visualize the structure of your layout. Each named region is a slot which can be passed a sub-layout or a component in the layout's render function.
|
55
|
+
|
56
|
+
<p align="center">
|
57
|
+
<img src="docs/website_builder_sortof.gif" alt="mobile" width="640">
|
58
|
+
</p>
|
59
|
+
|
60
|
+
## Responsive is built-in
|
61
|
+
Build responsive layouts with pydzn
|
62
|
+
|
63
|
+
<p align="center">
|
64
|
+
<img src="docs/pydzn_responsive.gif" alt="mobile" width="640">
|
65
|
+
</p>
|
66
|
+
|
67
|
+
The above layouts are combined desktop and mobile versions:
|
68
|
+
```python
|
69
|
+
|
70
|
+
from pydzn.grid_builder import layout_builder
|
71
|
+
|
72
|
+
# This is the Main App layout structure we've created below for DESKTOP
|
73
|
+
"""
|
74
|
+
column::left_column column::main_column
|
75
|
+
row:header_row region:left_sidebar region:appbar
|
76
|
+
row:content_row region:left_sidebar region:content
|
77
|
+
|
78
|
+
The layout accepts the following components in render function signature: left_sidebar, appbar, content
|
79
|
+
"""
|
80
|
+
AppMainLayout = (
|
81
|
+
layout_builder()
|
82
|
+
.fill_height("100vh", property="height") # sets up the page to restrict height to view height
|
83
|
+
.columns(left_column=LEFT_SIDEBAR_WIDTH, main_column="1fr") # split the main layout into two columns: sidebar and main
|
84
|
+
.rows(header_row=HEADER_HEIGHT, content_row="1fr") # add 2 rows: a header section and a content section stacked
|
85
|
+
.region("left_sidebar", col="left_column", row="header_row", row_span=2) # place the sidebar into the left_sidebar column in the first row and span both rows
|
86
|
+
.region("appbar", col="main_column", row="header_row", col_span=1) # Add the appbar to the right of sidebar in the main section and span the last row
|
87
|
+
.region("content", col="main_column", row="content_row") # declare the empty content section which is the last row in main
|
88
|
+
.build(name="AppMainLayout")
|
89
|
+
)
|
90
|
+
|
91
|
+
# This is the Main App layout structure we've created below for MOBILE
|
92
|
+
"""
|
93
|
+
column::main_column
|
94
|
+
row:header_row region:appbar
|
95
|
+
row:content_row region:content
|
96
|
+
|
97
|
+
The layout accepts the following components in render function signature: appbar, content
|
98
|
+
"""
|
99
|
+
AppMainMobileLayout = (
|
100
|
+
layout_builder()
|
101
|
+
.fill_height("100vh", property="height")
|
102
|
+
.columns(main_column="1fr")
|
103
|
+
.rows(header_row=HEADER_HEIGHT_MOBILE, content_row="1fr")
|
104
|
+
.region("appbar", col="main_column", row="header_row")
|
105
|
+
.region("content", col="main_column", row="content_row")
|
106
|
+
.build(name="AppMainMobileLayout")
|
107
|
+
)
|
108
|
+
|
109
|
+
# ----- App header menu slots -----#
|
110
|
+
AppHeaderMenuLayout = (
|
111
|
+
layout_builder()
|
112
|
+
# make the inner grid fill the parent (the appbar row), not the viewport
|
113
|
+
.fill_height("100%", property="height") # was min-height:100vh (implicit default)
|
114
|
+
.columns(brand=BRAND_WIDTH, spacer="1fr", tasks=APP_MENU_WIDTH, customers=APP_MENU_WIDTH, orders=APP_MENU_WIDTH, notifications=APP_MENU_WIDTH, user_profile=APP_MENU_WIDTH)
|
115
|
+
.rows(app_header_main=f"minmax({HEADER_HEIGHT}px, auto)") # these items don't take up the full height of the app header unless you set it here
|
116
|
+
.region("brand", col="brand", row="app_header_main")
|
117
|
+
.region("spacer", col="spacer", row="app_header_main") # empty; pushes the rest right
|
118
|
+
.region("tasks", col="tasks", row="app_header_main")
|
119
|
+
.region("customers", col="customers", row="app_header_main")
|
120
|
+
.region("orders", col="orders", row="app_header_main")
|
121
|
+
.region("notifications", col="notifications", row="app_header_main")
|
122
|
+
.region("user_profile", col="user_profile", row="app_header_main")
|
123
|
+
.build(name="AppHeaderMenuLayout")
|
124
|
+
)
|
125
|
+
|
126
|
+
# ----- App header mobile menu layout ----#
|
127
|
+
AppHeaderMobileMenuLayout = (
|
128
|
+
layout_builder()
|
129
|
+
.fill_height("100%", property="height")
|
130
|
+
.columns(brand_col=BRAND_WIDTH, spacer_col="1fr", hamburger_menu_col=100)
|
131
|
+
.rows(app_header_mobile_row=f"minmax({HEADER_HEIGHT_MOBILE}px, auto)") # this container holds the app header for mobile layout so height must match
|
132
|
+
.region("brand", col="brand_col", row="app_header_mobile_row")
|
133
|
+
.region("hamburger_menu", col="hamburger_menu_col", row="app_header_mobile_row")
|
134
|
+
.build(name="AppHeaderMobileMenuLayout")
|
135
|
+
)
|
136
|
+
|
137
|
+
```
|
138
|
+
|
139
|
+
These layouts contain render functions with a signature containing the named slots for variables, in the case of AppMainMobileLayout, the hamburger_menu slot is passed a built-in hamburger menu component:
|
140
|
+
|
141
|
+
```python
|
142
|
+
from pydzn.components import NavItem, Text, HamburgerMenu
|
143
|
+
|
144
|
+
# Right-side full-height drawer
|
145
|
+
menu_btn = HamburgerMenu(
|
146
|
+
mode="right",
|
147
|
+
drawer_width=320,
|
148
|
+
show_backdrop=True,
|
149
|
+
children=drop_down_mobile,
|
150
|
+
dzn="bg-[white]", # forwarded to the panel automatically
|
151
|
+
panel_dzn="p-[24px]" # this is how you set the semantic css classes for the drawer (panel)
|
152
|
+
).render()
|
153
|
+
|
154
|
+
|
155
|
+
mobile_html = AppHeaderMobileMenuLayout(
|
156
|
+
debug=debug,
|
157
|
+
region_dzn = {
|
158
|
+
"brand": "flex justify-center items-center",
|
159
|
+
"hamburger_menu": "flex justify-center items-center"
|
160
|
+
}
|
161
|
+
).render(
|
162
|
+
brand=brand,
|
163
|
+
hamburger_menu=menu_btn
|
164
|
+
)
|
165
|
+
```
|
166
|
+
|
167
|
+
|
168
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
pydzn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
pydzn/base_component.py,sha256=YkfAF2AN87YioV0qK-XhJlGpUj0qfA201V0W0ituIOE,5304
|
3
|
+
pydzn/dzn.py,sha256=Ph_dxXBF9Ju2GEEKJ662bzt9Hr4pJiiyuA-VJD0T_kE,16702
|
4
|
+
pydzn/grid_builder.py,sha256=7X2yn7kZMn25gPgRr4HT7nHozzjDwDon3RoarRZi6R0,13188
|
5
|
+
pydzn/responsive.py,sha256=oDJuxGjHQHvjSwgPc-ZqRiOwpKY4evYRnuKbPca5Igc,686
|
6
|
+
pydzn/variants.py,sha256=jFEqe5RcdlnLjeAI-o6jjGUZbaksk23-0PBuUb8N5W8,7809
|
7
|
+
pydzn/components/__init__.py,sha256=Z4Jz6l8LXQKBpNFaahNaAtky6XECQXLDi-qDmXyzwFo,359
|
8
|
+
pydzn/components/button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
+
pydzn/components/button/component.py,sha256=yxnlip5r-Ge1ma8XKnE0zsz42u1BRwzoOKoi3TeIak4,2525
|
10
|
+
pydzn/components/button/template.html,sha256=RD0XPzHG0DlWgwlODNNs6PU4yp0arxEsajmGoB8k2vI,99
|
11
|
+
pydzn/components/card/component.py,sha256=eDsl9IaP3zOzrgd1Fp_lk87ug-wVVGZSfaFE4sGspng,2731
|
12
|
+
pydzn/components/card/template.html,sha256=xIHvf33q7nVPeNPgSn_wVo5dyNaRiX2quWyBVtk1IDw,89
|
13
|
+
pydzn/components/drawer/component.py,sha256=F3BeNaBbrYKa2X9D_FjfBXgwqe2Qo_YR8qMinrPHCag,355
|
14
|
+
pydzn/components/drawer/template.html,sha256=xIHvf33q7nVPeNPgSn_wVo5dyNaRiX2quWyBVtk1IDw,89
|
15
|
+
pydzn/components/hamburger_menu/component.py,sha256=qZ3I5DtGA-ThxkSxyNgc-X-_EkO61kV70MK_Y1WuLgY,8106
|
16
|
+
pydzn/components/hamburger_menu/template.html,sha256=BpFjn70qDyRbeORBKBK3Uz1oJgVdZD7x7_w9tr9DPMw,64
|
17
|
+
pydzn/components/nav_item/component.py,sha256=kcyWBHqPhsSWxENkK3d8Ryga6eOcgvfG5cKYUL2HZvc,7525
|
18
|
+
pydzn/components/nav_item/template.html,sha256=BpFjn70qDyRbeORBKBK3Uz1oJgVdZD7x7_w9tr9DPMw,64
|
19
|
+
pydzn/components/sidebar/component.py,sha256=MdZyjtjZexh1d1BA3X0Hq4lRHftuYIWz9e1Cqx7dzic,2058
|
20
|
+
pydzn/components/sidebar/template.html,sha256=BpFjn70qDyRbeORBKBK3Uz1oJgVdZD7x7_w9tr9DPMw,64
|
21
|
+
pydzn/components/text/component.py,sha256=aAkhQXtUPLbApk6Cib-CVo-vQmsNvJnlHxs5QPv64pc,409
|
22
|
+
pydzn/components/text/template.html,sha256=RD0XPzHG0DlWgwlODNNs6PU4yp0arxEsajmGoB8k2vI,99
|
23
|
+
pydzn-0.1.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
24
|
+
pydzn-0.1.4.dist-info/METADATA,sha256=sk8t9fgRk0rpqnNgknBtiKKwnxCqIBkyga92-2nXA88,7279
|
25
|
+
pydzn-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
26
|
+
pydzn-0.1.4.dist-info/top_level.txt,sha256=QPNKgtzCjxN7JSGId_GxBlQaq7X8yNEzCUrYbKAXudA,6
|
27
|
+
pydzn-0.1.4.dist-info/RECORD,,
|
pydzn-0.1.2.dist-info/METADATA
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: pydzn
|
3
|
-
Version: 0.1.2
|
4
|
-
Summary: Tiny design-system utilities (Tailwind-like), composable HTML components, and a grid layout builder for Python/Jinja apps.
|
5
|
-
Author-email: Ryan Kirkish <ryan@foo.com>
|
6
|
-
License: Apache-2.0
|
7
|
-
Project-URL: Homepage, https://github.com/anthonyrka/pydzn
|
8
|
-
Project-URL: Repository, https://github.com/anthonyrka/pydzn
|
9
|
-
Project-URL: Issues, https://github.com/anthonyrka/pydzn/issues
|
10
|
-
Keywords: design-system,css,utility-classes,jinja2,components,grid,htmx
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
12
|
-
Classifier: Intended Audience :: Developers
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
14
|
-
Classifier: Programming Language :: Python
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
19
|
-
Classifier: Framework :: Flask
|
20
|
-
Classifier: Topic :: Internet :: WWW/HTTP
|
21
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
22
|
-
Requires-Python: >=3.10
|
23
|
-
Description-Content-Type: text/markdown
|
24
|
-
License-File: LICENSE
|
25
|
-
Requires-Dist: Jinja2>=3.1
|
26
|
-
Provides-Extra: flask
|
27
|
-
Requires-Dist: Flask>=2.3; extra == "flask"
|
28
|
-
Provides-Extra: dev
|
29
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
30
|
-
Requires-Dist: ruff>=0.5; extra == "dev"
|
31
|
-
Requires-Dist: black>=24; extra == "dev"
|
32
|
-
Requires-Dist: mypy>=1.10; extra == "dev"
|
33
|
-
Requires-Dist: build>=1.2; extra == "dev"
|
34
|
-
Requires-Dist: twine>=5; extra == "dev"
|
35
|
-
Dynamic: license-file
|
36
|
-
|
37
|
-
# pydzn
|
38
|
-
Python web components for server-side rendering
|
pydzn-0.1.2.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
pydzn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
pydzn/base_component.py,sha256=iXjT12Pgqgbix9Ebm7KzimDpwrkOxSwzEzK12aP0qx4,5342
|
3
|
-
pydzn/dzn.py,sha256=mdbDtI30smAjfjcnGrI2tyRVJlKZhrF0MbaPDqF1pqw,11776
|
4
|
-
pydzn/grid_builder.py,sha256=Qtxx8Si_vIqV7dwOgAs6jPUIJm0F_IvZtD2BrRWKnb8,9771
|
5
|
-
pydzn/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
pydzn/components/button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
pydzn/components/button/component.py,sha256=KF9dDoIXZ4cQ_z_g2nDrzSjr0BEJ6skLF5ur0eqgxAw,1028
|
8
|
-
pydzn/components/button/template.html,sha256=RD0XPzHG0DlWgwlODNNs6PU4yp0arxEsajmGoB8k2vI,99
|
9
|
-
pydzn-0.1.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
10
|
-
pydzn-0.1.2.dist-info/METADATA,sha256=7Nnt_30H2g9nkza7we-Mcxpb1P7krEKXRQICsfSkFac,1565
|
11
|
-
pydzn-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
-
pydzn-0.1.2.dist-info/top_level.txt,sha256=QPNKgtzCjxN7JSGId_GxBlQaq7X8yNEzCUrYbKAXudA,6
|
13
|
-
pydzn-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|