pyfrontkit 1.0.27__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.
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyfrontkit
3
+ Version: 1.0.27
4
+ Summary: A Python tool to generate HTML and CSS with programmable syntax.
5
+ Author-email: Eduardo Antonio Ferrera RodrΓ­guez <enzoferrera.23@gmail.com>
6
+ Project-URL: Homepage, https://github.com/Edybrown/pyfrontkit
7
+ Project-URL: Source, https://github.com/Edybrown/pyfrontkit
8
+ Project-URL: Issues, https://github.com/Edybrown/pyfrontkit/issues
9
+ Keywords: html,css,python,frontend,mlops,data app
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+
14
+ # PYFRONTKIT
15
+ ### A Pythonic DSL for Programmatic HTML & CSS Generation
16
+
17
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
18
+
19
+ **PyFrontKit** is a Python-based DSL designed to generate **HTML and CSS programmatically**, providing a clean, elegant, and highly readable syntax inspired by modern component-driven development.
20
+
21
+ It allows developers to build complete web pages using **pure Python**, without writing raw HTML manually.
22
+ Ideal for:
23
+
24
+ - rapid prototyping
25
+ - teaching HTML structure
26
+ - generating static sites
27
+ - automating documentation pages
28
+ - template-driven UI generation
29
+
30
+ ---
31
+
32
+ # πŸš€ Features
33
+
34
+ ### βœ” Pythonic HTML Syntax
35
+ Create elements using class constructors or ID-based global functions:
36
+
37
+ ```python
38
+ Div(id="container")
39
+ container(Section(ctn_p="Hello World"))
40
+ ```
41
+
42
+ ### βœ” Accumulative DOM
43
+ Any element with an `id="..."` automatically generates a global callable:
44
+
45
+ ```python
46
+ header(Div(ctn_h1="Welcome"))
47
+ ```
48
+
49
+ ### βœ” Automatic CSS File Generation
50
+ All selectors (`id`, `class`, and tag names) are scanned and exported into `style.css`.
51
+
52
+ ### βœ” Inline Style Support
53
+ Every tag accepts a native HTML5 `style="..."` attribute.
54
+
55
+ ### βœ” Clean Separation Between Content & Structure
56
+ `ctn_p`, `ctn_h1`, `ctn_div`, etc. allow pythonic, newline-based content β€” internally converted to `<p>`, `<br>`, `<h1>`, etc.
57
+
58
+ ### βœ” Ready-to-open Output
59
+ The library produces:
60
+
61
+ ```
62
+ index.html
63
+ style.css
64
+ ```
65
+
66
+ ---
67
+
68
+ # πŸ“¦ Installation
69
+
70
+ ### From PyPI (recommended)
71
+
72
+ ```bash
73
+ pip install pyfrontkit
74
+ ```
75
+
76
+ ### From GitHub
77
+
78
+ ```bash
79
+ pip install git+https://github.com/Edybrown/pyfrontkit.git
80
+ ```
81
+
82
+ ---
83
+
84
+ # πŸ’‘ Basic Usage Example
85
+
86
+ ```python
87
+ from pyfrontkit import HtmlDoc, Div, Section, Header, Nav, Ul, Li, Footer
88
+
89
+ doc = HtmlDoc(title="My Professional Page")
90
+
91
+ # Header
92
+ Header(id="header", ctn_p="Welcome to My Professional Site",
93
+ style="background-color:#2c3e50; color:white; padding:20px 0;")
94
+
95
+ # Navigation
96
+ Nav(id="nav", style="background-color:#34495e; display:flex; justify-content:center;")
97
+ nav(
98
+ Div(ctn_p="Home", style="color:white; padding:15px 25px;"),
99
+ Div(ctn_p="Services", style="color:white; padding:15px 25px;")
100
+ )
101
+
102
+ # Introduction
103
+ Section(id="intro", style="padding:40px 20px; max-width:1000px; margin:auto;")
104
+ intro(
105
+ Div(ctn_p="This is the introduction section, generated entirely in Python.")
106
+ )
107
+
108
+ # Footer
109
+ Footer(id="footer", style="background-color:#2c3e50; color:white; text-align:center; padding:20px 0;")
110
+ footer(
111
+ Div(ctn_p="Β© 2025 My Professional Site. All rights reserved.")
112
+ )
113
+
114
+ # Build files
115
+ doc.create_document()
116
+ ```
117
+
118
+ Output generated:
119
+
120
+ ```
121
+ index.html
122
+ style.css
123
+ ```
124
+
125
+ ---
126
+
127
+ # 🎨 CSS Usage Guide
128
+
129
+ PyFrontKit automatically generates a `style.css` file containing **all selectors found in the HTML**:
130
+
131
+ Example auto-generated output:
132
+
133
+ ```css
134
+ #header {}
135
+ #nav {}
136
+ #intro {}
137
+ #footer {}
138
+ div {}
139
+ section {}
140
+ ```
141
+
142
+ You can now fill these selectors manually:
143
+
144
+ ```css
145
+ #header {
146
+ background:#2c3e50;
147
+ color:white;
148
+ padding:20px 0;
149
+ }
150
+ ```
151
+
152
+ ## Styling methods
153
+
154
+ ### 1. Inline Styles (fast prototyping)
155
+
156
+ ```python
157
+ Div(ctn_p="Hello", style="color:red; margin-top:10px;")
158
+ ```
159
+
160
+ ### 2. External CSS File (recommended)
161
+
162
+ Edit the generated `style.css`:
163
+
164
+ ```css
165
+ div {
166
+ font-family: Arial, sans-serif;
167
+ }
168
+ ```
169
+
170
+ ---
171
+
172
+ # πŸ“ Examples (with screenshots)
173
+
174
+ A full set of examples is included in the repository:
175
+
176
+ ```
177
+ examples/
178
+ β”‚
179
+ β”œβ”€β”€ 01-basic/
180
+ β”‚ β”œβ”€β”€ example.py
181
+ β”‚ β”œβ”€β”€ index.html
182
+ β”‚ β”œβ”€β”€ style.css
183
+ β”‚ └── screenshot.png
184
+ β”‚
185
+ β”œβ”€β”€ 02-intermediate/
186
+ β”‚ β”œβ”€β”€ example.py
187
+ β”‚ β”œβ”€β”€ index.html
188
+ β”‚ β”œβ”€β”€ style.css
189
+ β”‚ └── screenshot.png
190
+ β”‚
191
+ └── 03-professional/
192
+ β”œβ”€β”€ example.py
193
+ β”œβ”€β”€ index.html
194
+ β”œβ”€β”€ style.css
195
+ └── screenshot.png
196
+ ```
197
+
198
+ Run any example:
199
+
200
+ ```bash
201
+ python examples/03-professional/example.py
202
+ ```
203
+
204
+ ---
205
+
206
+ # πŸ›  Roadmap
207
+
208
+ Planned features:
209
+
210
+ - βœ” **CSS Template Packs** (global themes)
211
+ - βœ” **Automatic external CSS compilation**
212
+ - βœ” **Reusable Python components**
213
+ - βœ” **Dynamic `<script>` builder**
214
+ - βœ” **Minified output mode**
215
+ - βœ” **Plugin system for custom tags**
216
+
217
+ ---
218
+
219
+ # πŸ“„ License
220
+
221
+ Released under the **GNU GPLv3** license.
222
+ You are free to use, modify, and redistribute this project.
223
+ Any derivative work must remain open-source under the same license.
224
+
225
+ ---
226
+
227
+ # πŸ‘€ Author
228
+
229
+ Created by **Eduardo Antonio Ferrera RodrΓ­guez**
230
+ A project combining:
231
+
232
+ - advanced Python OOP practice
233
+ - DSL design
234
+ - frontend structure understanding
235
+ - static web automation
236
+
237
+ Contributions, suggestions, and pull requests are welcome!
238
+
@@ -0,0 +1,225 @@
1
+ # PYFRONTKIT
2
+ ### A Pythonic DSL for Programmatic HTML & CSS Generation
3
+
4
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
5
+
6
+ **PyFrontKit** is a Python-based DSL designed to generate **HTML and CSS programmatically**, providing a clean, elegant, and highly readable syntax inspired by modern component-driven development.
7
+
8
+ It allows developers to build complete web pages using **pure Python**, without writing raw HTML manually.
9
+ Ideal for:
10
+
11
+ - rapid prototyping
12
+ - teaching HTML structure
13
+ - generating static sites
14
+ - automating documentation pages
15
+ - template-driven UI generation
16
+
17
+ ---
18
+
19
+ # πŸš€ Features
20
+
21
+ ### βœ” Pythonic HTML Syntax
22
+ Create elements using class constructors or ID-based global functions:
23
+
24
+ ```python
25
+ Div(id="container")
26
+ container(Section(ctn_p="Hello World"))
27
+ ```
28
+
29
+ ### βœ” Accumulative DOM
30
+ Any element with an `id="..."` automatically generates a global callable:
31
+
32
+ ```python
33
+ header(Div(ctn_h1="Welcome"))
34
+ ```
35
+
36
+ ### βœ” Automatic CSS File Generation
37
+ All selectors (`id`, `class`, and tag names) are scanned and exported into `style.css`.
38
+
39
+ ### βœ” Inline Style Support
40
+ Every tag accepts a native HTML5 `style="..."` attribute.
41
+
42
+ ### βœ” Clean Separation Between Content & Structure
43
+ `ctn_p`, `ctn_h1`, `ctn_div`, etc. allow pythonic, newline-based content β€” internally converted to `<p>`, `<br>`, `<h1>`, etc.
44
+
45
+ ### βœ” Ready-to-open Output
46
+ The library produces:
47
+
48
+ ```
49
+ index.html
50
+ style.css
51
+ ```
52
+
53
+ ---
54
+
55
+ # πŸ“¦ Installation
56
+
57
+ ### From PyPI (recommended)
58
+
59
+ ```bash
60
+ pip install pyfrontkit
61
+ ```
62
+
63
+ ### From GitHub
64
+
65
+ ```bash
66
+ pip install git+https://github.com/Edybrown/pyfrontkit.git
67
+ ```
68
+
69
+ ---
70
+
71
+ # πŸ’‘ Basic Usage Example
72
+
73
+ ```python
74
+ from pyfrontkit import HtmlDoc, Div, Section, Header, Nav, Ul, Li, Footer
75
+
76
+ doc = HtmlDoc(title="My Professional Page")
77
+
78
+ # Header
79
+ Header(id="header", ctn_p="Welcome to My Professional Site",
80
+ style="background-color:#2c3e50; color:white; padding:20px 0;")
81
+
82
+ # Navigation
83
+ Nav(id="nav", style="background-color:#34495e; display:flex; justify-content:center;")
84
+ nav(
85
+ Div(ctn_p="Home", style="color:white; padding:15px 25px;"),
86
+ Div(ctn_p="Services", style="color:white; padding:15px 25px;")
87
+ )
88
+
89
+ # Introduction
90
+ Section(id="intro", style="padding:40px 20px; max-width:1000px; margin:auto;")
91
+ intro(
92
+ Div(ctn_p="This is the introduction section, generated entirely in Python.")
93
+ )
94
+
95
+ # Footer
96
+ Footer(id="footer", style="background-color:#2c3e50; color:white; text-align:center; padding:20px 0;")
97
+ footer(
98
+ Div(ctn_p="Β© 2025 My Professional Site. All rights reserved.")
99
+ )
100
+
101
+ # Build files
102
+ doc.create_document()
103
+ ```
104
+
105
+ Output generated:
106
+
107
+ ```
108
+ index.html
109
+ style.css
110
+ ```
111
+
112
+ ---
113
+
114
+ # 🎨 CSS Usage Guide
115
+
116
+ PyFrontKit automatically generates a `style.css` file containing **all selectors found in the HTML**:
117
+
118
+ Example auto-generated output:
119
+
120
+ ```css
121
+ #header {}
122
+ #nav {}
123
+ #intro {}
124
+ #footer {}
125
+ div {}
126
+ section {}
127
+ ```
128
+
129
+ You can now fill these selectors manually:
130
+
131
+ ```css
132
+ #header {
133
+ background:#2c3e50;
134
+ color:white;
135
+ padding:20px 0;
136
+ }
137
+ ```
138
+
139
+ ## Styling methods
140
+
141
+ ### 1. Inline Styles (fast prototyping)
142
+
143
+ ```python
144
+ Div(ctn_p="Hello", style="color:red; margin-top:10px;")
145
+ ```
146
+
147
+ ### 2. External CSS File (recommended)
148
+
149
+ Edit the generated `style.css`:
150
+
151
+ ```css
152
+ div {
153
+ font-family: Arial, sans-serif;
154
+ }
155
+ ```
156
+
157
+ ---
158
+
159
+ # πŸ“ Examples (with screenshots)
160
+
161
+ A full set of examples is included in the repository:
162
+
163
+ ```
164
+ examples/
165
+ β”‚
166
+ β”œβ”€β”€ 01-basic/
167
+ β”‚ β”œβ”€β”€ example.py
168
+ β”‚ β”œβ”€β”€ index.html
169
+ β”‚ β”œβ”€β”€ style.css
170
+ β”‚ └── screenshot.png
171
+ β”‚
172
+ β”œβ”€β”€ 02-intermediate/
173
+ β”‚ β”œβ”€β”€ example.py
174
+ β”‚ β”œβ”€β”€ index.html
175
+ β”‚ β”œβ”€β”€ style.css
176
+ β”‚ └── screenshot.png
177
+ β”‚
178
+ └── 03-professional/
179
+ β”œβ”€β”€ example.py
180
+ β”œβ”€β”€ index.html
181
+ β”œβ”€β”€ style.css
182
+ └── screenshot.png
183
+ ```
184
+
185
+ Run any example:
186
+
187
+ ```bash
188
+ python examples/03-professional/example.py
189
+ ```
190
+
191
+ ---
192
+
193
+ # πŸ›  Roadmap
194
+
195
+ Planned features:
196
+
197
+ - βœ” **CSS Template Packs** (global themes)
198
+ - βœ” **Automatic external CSS compilation**
199
+ - βœ” **Reusable Python components**
200
+ - βœ” **Dynamic `<script>` builder**
201
+ - βœ” **Minified output mode**
202
+ - βœ” **Plugin system for custom tags**
203
+
204
+ ---
205
+
206
+ # πŸ“„ License
207
+
208
+ Released under the **GNU GPLv3** license.
209
+ You are free to use, modify, and redistribute this project.
210
+ Any derivative work must remain open-source under the same license.
211
+
212
+ ---
213
+
214
+ # πŸ‘€ Author
215
+
216
+ Created by **Eduardo Antonio Ferrera RodrΓ­guez**
217
+ A project combining:
218
+
219
+ - advanced Python OOP practice
220
+ - DSL design
221
+ - frontend structure understanding
222
+ - static web automation
223
+
224
+ Contributions, suggestions, and pull requests are welcome!
225
+
@@ -0,0 +1,82 @@
1
+ # ----------------------------------------------------------------------
2
+ # Package Configuration
3
+ # ----------------------------------------------------------------------
4
+ __version__ = "1.0.27"
5
+ __author__ = "Eduardo Antonio Ferrera Rodriguez"
6
+ __license__ = "GPLv3"
7
+
8
+ # ----------------------------------------------------------------------
9
+ # Expose CSS submodule
10
+ # ----------------------------------------------------------------------
11
+ from . import css # permite: from pyfrontkit import css
12
+
13
+ # ----------------------------------------------------------------------
14
+ # Optionally expose key CSS classes and palettes for direct import
15
+ # ----------------------------------------------------------------------
16
+ from .css.create_color import CreateColor
17
+ from .css.create_color.palettes_homologous import palette_homologous, homologous_color_rule
18
+ from .css.create_color.palettes_triadic import palette_triadic, triadic_color_rule
19
+ from .css.create_color.palettes_tetradic import palette_tetradic, tetradic_color_rule
20
+
21
+ # ----------------------------------------------------------------------
22
+ # Core modules
23
+ # ----------------------------------------------------------------------
24
+ from .html_doc import HtmlDoc
25
+ from .css_register import CSSRegistry
26
+ from .block import Block
27
+
28
+ # ----------------------------------------------------------------------
29
+ # Tags
30
+ # ----------------------------------------------------------------------
31
+ from .tags import (
32
+ Div, Section, Article, Header, Footer, Nav, Main, Aside, Button, Form, Ul, Li, A,
33
+ div, section, article, header, footer, nav, main, aside,
34
+ button, form, ul, li, a
35
+ )
36
+
37
+ # ----------------------------------------------------------------------
38
+ # Void elements
39
+ # ----------------------------------------------------------------------
40
+ from .void_element import (
41
+ VoidElement, Img, Input, Hr, Meta, Link, Source, Embed, Param, Track, Wbr, Area, Base, Col,
42
+ img, input, hr, meta, link, source, embed, param, track, wbr, area, base, col
43
+ )
44
+
45
+ # ----------------------------------------------------------------------
46
+ # Special containers
47
+ # ----------------------------------------------------------------------
48
+ from .special import Video, Audio, Picture, ObjectElement
49
+ from .special import video, audio, picture, object
50
+
51
+ # ----------------------------------------------------------------------
52
+ # Public API
53
+ # ----------------------------------------------------------------------
54
+ __all__ = [
55
+ # CSS module
56
+ "css",
57
+ "CreateColor",
58
+ "palette_homologous", "homologous_color_rule",
59
+ "palette_triadic", "triadic_color_rule",
60
+ "palette_tetradic", "tetradic_color_rule",
61
+
62
+ # Core
63
+ "HtmlDoc",
64
+ "CSSRegistry",
65
+ "Block",
66
+
67
+ # Tags
68
+ "Div", "Section", "Article", "Header", "Footer", "Nav", "Main", "Aside",
69
+ "Button", "Form", "Ul", "Li", "A",
70
+ "div", "section", "article", "header", "footer", "nav", "main", "aside",
71
+ "button", "form", "ul", "li", "a",
72
+
73
+ # Void
74
+ "VoidElement", "Img", "Input", "Hr", "Meta", "Link", "Source", "Embed",
75
+ "Param", "Track", "Wbr", "Area", "Base", "Col",
76
+ "img", "input", "hr", "meta", "link", "source", "embed", "param",
77
+ "track", "wbr", "area", "base", "col",
78
+
79
+ # Special
80
+ "Video", "Audio", "Picture", "ObjectElement",
81
+ "video", "audio", "picture", "object",
82
+ ]