webwidgets 0.2.1__tar.gz → 1.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 (60) hide show
  1. {webwidgets-0.2.1 → webwidgets-1.1.0}/.github/workflows/ci-full.yml +2 -3
  2. {webwidgets-0.2.1 → webwidgets-1.1.0}/.github/workflows/ci-quick.yml +2 -3
  3. webwidgets-1.1.0/.gitignore +2 -0
  4. webwidgets-1.1.0/PKG-INFO +71 -0
  5. webwidgets-1.1.0/README.md +53 -0
  6. {webwidgets-0.2.1 → webwidgets-1.1.0}/pyproject.toml +8 -0
  7. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/compilation/test_css.py +144 -137
  8. webwidgets-1.1.0/tests/compilation/test_css_rule.py +108 -0
  9. webwidgets-1.1.0/tests/compilation/test_css_sections.py +191 -0
  10. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/compilation/test_html_node.py +44 -4
  11. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/compilation/test_html_tags.py +22 -4
  12. webwidgets-1.1.0/tests/conftest.py +20 -0
  13. webwidgets-1.1.0/tests/utility/test_indentation.py +29 -0
  14. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/utility/test_validation.py +92 -27
  15. webwidgets-1.1.0/tests/website/__init__.py +11 -0
  16. webwidgets-1.1.0/tests/website/test_website.py +408 -0
  17. webwidgets-1.1.0/tests/widgets/__init__.py +11 -0
  18. webwidgets-1.1.0/tests/widgets/conftest.py +48 -0
  19. webwidgets-1.1.0/tests/widgets/containers/__init__.py +11 -0
  20. webwidgets-1.1.0/tests/widgets/containers/test_box.py +110 -0
  21. webwidgets-1.1.0/tests/widgets/containers/test_page.py +143 -0
  22. webwidgets-1.1.0/tests/widgets/render_page.py +58 -0
  23. webwidgets-1.1.0/tests/widgets/test_render_page.py +61 -0
  24. webwidgets-1.1.0/tests/wrap_core_css.py +37 -0
  25. webwidgets-1.1.0/webwidgets/__init__.py +18 -0
  26. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/css/__init__.py +3 -2
  27. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/css/css.py +107 -123
  28. webwidgets-1.1.0/webwidgets/compilation/css/css_rule.py +104 -0
  29. webwidgets-1.1.0/webwidgets/compilation/css/sections/__init__.py +14 -0
  30. webwidgets-1.1.0/webwidgets/compilation/css/sections/css_section.py +106 -0
  31. webwidgets-1.1.0/webwidgets/compilation/css/sections/preamble.py +40 -0
  32. webwidgets-1.1.0/webwidgets/compilation/css/sections/rule_section.py +43 -0
  33. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/html/__init__.py +3 -2
  34. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/html/html_node.py +42 -4
  35. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/html/html_tags.py +43 -1
  36. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/utility/__init__.py +1 -0
  37. webwidgets-1.1.0/webwidgets/utility/indentation.py +25 -0
  38. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/utility/validation.py +68 -1
  39. webwidgets-1.1.0/webwidgets/website/__init__.py +14 -0
  40. webwidgets-1.1.0/webwidgets/website/compiled_website.py +34 -0
  41. webwidgets-1.1.0/webwidgets/website/website.py +88 -0
  42. webwidgets-1.1.0/webwidgets/widgets/__init__.py +14 -0
  43. {webwidgets-0.2.1/webwidgets → webwidgets-1.1.0/webwidgets/widgets/containers}/__init__.py +3 -3
  44. webwidgets-1.1.0/webwidgets/widgets/containers/box.py +70 -0
  45. webwidgets-1.1.0/webwidgets/widgets/containers/container.py +38 -0
  46. webwidgets-1.1.0/webwidgets/widgets/containers/page.py +59 -0
  47. webwidgets-1.1.0/webwidgets/widgets/widget.py +33 -0
  48. webwidgets-0.2.1/.gitignore +0 -1
  49. webwidgets-0.2.1/PKG-INFO +0 -18
  50. webwidgets-0.2.1/README.md +0 -5
  51. {webwidgets-0.2.1 → webwidgets-1.1.0}/.github/workflows/cd.yml +0 -0
  52. {webwidgets-0.2.1 → webwidgets-1.1.0}/LICENSE +0 -0
  53. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/__init__.py +0 -0
  54. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/compilation/__init__.py +0 -0
  55. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/utility/__init__.py +0 -0
  56. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/utility/test_representation.py +0 -0
  57. {webwidgets-0.2.1 → webwidgets-1.1.0}/tests/utility/test_sanitizing.py +0 -0
  58. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/compilation/__init__.py +0 -0
  59. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/utility/representation.py +0 -0
  60. {webwidgets-0.2.1 → webwidgets-1.1.0}/webwidgets/utility/sanitizing.py +0 -0
@@ -64,15 +64,14 @@ jobs:
64
64
  uses: actions/setup-python@v3
65
65
  with:
66
66
  python-version: ${{ matrix.python-version }}
67
- - name: Install pytest
67
+ - name: Upgrading pip
68
68
  run: |
69
69
  python -c "import platform; print('OS', platform.system())"
70
70
  python -c "import sys; print('Python version', sys.version)"
71
71
  python -m pip install --upgrade pip
72
- pip install pytest
73
72
  - name: Build and install
74
73
  run: |
75
- pip install .
74
+ pip install .[dev]
76
75
  # Removing webwidgets directory so imports come from build
77
76
  rm -r webwidgets
78
77
  - name: Test with pytest
@@ -59,16 +59,15 @@ jobs:
59
59
  uses: actions/setup-python@v3
60
60
  with:
61
61
  python-version: ${{ matrix.python-version }}
62
- - name: Install pytest
62
+ - name: Upgrading pip
63
63
  run: |
64
64
  python -c "import sys; print('Python version', sys.version)"
65
65
  python -m pip install --upgrade pip
66
- pip install pytest
67
66
  - name: Build and install
68
67
  run: |
69
68
  echo "Current directory:"
70
69
  ls -la
71
- pip install .
70
+ pip install .[dev]
72
71
  # Removing webwidgets directory so imports come from build
73
72
  rm -r webwidgets
74
73
  echo "Removed webwidgets directory. New content:"
@@ -0,0 +1,2 @@
1
+ __pycache__
2
+ ignore
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: webwidgets
3
+ Version: 1.1.0
4
+ Summary: A Python package for designing web UIs.
5
+ Project-URL: Source code, https://github.com/mlaasri/WebWidgets
6
+ Author: mlaasri
7
+ License-File: LICENSE
8
+ Keywords: design,webui
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.9
12
+ Provides-Extra: dev
13
+ Requires-Dist: numpy; extra == 'dev'
14
+ Requires-Dist: pillow; extra == 'dev'
15
+ Requires-Dist: pytest; extra == 'dev'
16
+ Requires-Dist: selenium; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # WebWidgets
20
+
21
+ ![CI Status](https://img.shields.io/github/actions/workflow/status/mlaasri/WebWidgets/ci-full.yml?branch=main)
22
+
23
+ A Python package for creating web UIs
24
+
25
+ ## Installation
26
+
27
+ You can install **WebWidgets** with `pip`. To install the latest stable version, run:
28
+
29
+ ```bash
30
+ pip install webwidgets
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ **WebWidgets** allows you to create custom widgets and build websites with them. For example:
36
+
37
+ ```python
38
+ import webwidgets as ww
39
+ from webwidgets.compilation.html import HTMLNode, RawText
40
+
41
+ # A <div> element
42
+ class Div(HTMLNode):
43
+ pass
44
+
45
+ # A simple text widget
46
+ class Text(ww.Widget):
47
+ def build(self):
48
+ return Div([RawText("Hello, World!")])
49
+
50
+ # A website with one page containing a Text widget
51
+ page = ww.Page([Text()])
52
+ website = ww.Website([page])
53
+
54
+ # Compile the website into HTML code
55
+ compiled = website.compile()
56
+ print(compiled.html_content[0])
57
+ ```
58
+
59
+ Prints the following result:
60
+
61
+ ```console
62
+ <!DOCTYPE html>
63
+ <html>
64
+ <head></head>
65
+ <body>
66
+ <div>
67
+ Hello, World!
68
+ </div>
69
+ </body>
70
+ </html>
71
+ ```
@@ -0,0 +1,53 @@
1
+ # WebWidgets
2
+
3
+ ![CI Status](https://img.shields.io/github/actions/workflow/status/mlaasri/WebWidgets/ci-full.yml?branch=main)
4
+
5
+ A Python package for creating web UIs
6
+
7
+ ## Installation
8
+
9
+ You can install **WebWidgets** with `pip`. To install the latest stable version, run:
10
+
11
+ ```bash
12
+ pip install webwidgets
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ **WebWidgets** allows you to create custom widgets and build websites with them. For example:
18
+
19
+ ```python
20
+ import webwidgets as ww
21
+ from webwidgets.compilation.html import HTMLNode, RawText
22
+
23
+ # A <div> element
24
+ class Div(HTMLNode):
25
+ pass
26
+
27
+ # A simple text widget
28
+ class Text(ww.Widget):
29
+ def build(self):
30
+ return Div([RawText("Hello, World!")])
31
+
32
+ # A website with one page containing a Text widget
33
+ page = ww.Page([Text()])
34
+ website = ww.Website([page])
35
+
36
+ # Compile the website into HTML code
37
+ compiled = website.compile()
38
+ print(compiled.html_content[0])
39
+ ```
40
+
41
+ Prints the following result:
42
+
43
+ ```console
44
+ <!DOCTYPE html>
45
+ <html>
46
+ <head></head>
47
+ <body>
48
+ <div>
49
+ Hello, World!
50
+ </div>
51
+ </body>
52
+ </html>
53
+ ```
@@ -21,6 +21,14 @@ classifiers = [
21
21
  [project.urls]
22
22
  "Source code" = "https://github.com/mlaasri/WebWidgets"
23
23
 
24
+ [project.optional-dependencies]
25
+ dev = [
26
+ "numpy",
27
+ "pillow",
28
+ "pytest",
29
+ "selenium"
30
+ ]
31
+
24
32
  [tool.hatch.version]
25
33
  path = "webwidgets/__init__.py"
26
34