Skip to main content

Winged-Python is an innovative Domain-Specific Language (DSL) library for efficient HTML writing in Python.

Project description

Winged-Python

main codecov codebeat badge Reviewed by Hound

=============

Winged-Python is an innovative Domain-Specific Language (DSL) library for efficient HTML writing in Python. Mirroring its Swift counterpart, Winged-Python is based on the DSL concept, focusing on simplification and specificity in HTML generation. Using the Composite design pattern, the library enables developers to construct HTML structures in a logical, organized, and reusable manner.

This library is created to be fully independent, not requiring integration with specific server frameworks or front-end libraries. This offers developers the freedom to use Winged-Python across a variety of projects, from simple static pages to complex web applications, keeping the code clean, readable, and efficient.

Usage Example

from winged.HTML.div import Div
from winged.HTML.h import H
from winged.HTML.table import Table
from winged.HTML.string import String

divC = Div(("class", "container"))

h = H("1")
h.add(String("Hello World"))
divC.add(h)

table = Table()
table.add_table_headers(["Name", "Age", "Height", "Location"])  # Define headers

table.add_row()
table.add_in_row(String("John"))
table.add_in_row(String("25"))
table.add_in_row(String("1.80"))
table.add_in_row(String("New York"))

table.add_row()
table.add_in_row(String("Maria"))
table.add_in_row(String("23"))
table.add_in_row(String("1.50"))
table.add_in_row(String("New Jersey"))

divC.add(table)

print(divC.generate())

Output

<div class="container">
  <h1>Hello World</h1>
  <table>
    <thead>
      <th>Name</th>
      <th>Age</th>
      <th>Height</th>
      <th>Location</th>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>25</td>
        <td>1.80</td>
        <td>New York</td>
      </tr>
      <tr>
        <td>Maria</td>
        <td>23</td>
        <td>1.50</td>
        <td>New Jersey</td>
      </tr>
    </tbody>
  </table>
</div>

Contributing

To contribute, it's simple, follow the guidelines below to prepare your development environment

Create environment

User OS terminal or IDE terminal

Linux or macOS

python3 -m venv venv
source venv/bin/activate

Windows

.\venv\Scripts\activate.bat
.\venv\Scripts\activate.ps1`

Install dependencies

python3 -m pip install -r requirements.txt

Run tests

pytest

TODO

  • Make documentation with Sphinx

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

winged-python-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

winged_python-0.1.0-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file winged-python-0.1.0.tar.gz.

File metadata

  • Download URL: winged-python-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for winged-python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd9cb6ac139f8955ef86373f98e19cfc20830387d9c3fc72ca35a64f5052de4a
MD5 478f8e07888347eb6e10ddc5cad0d51d
BLAKE2b-256 91bba7056a285e838378ad674e88f249a3b0e9d95ff1d06fabdbd96230b935ff

See more details on using hashes here.

File details

Details for the file winged_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: winged_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for winged_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3d634ad93a195679a387627ee646e8216dc444ab1b79f3b7556cd366697297f
MD5 811ceac0a732aab8f51b78cde5c707c6
BLAKE2b-256 1a6ce8d5fda2b54e9b05513ea7db75f3eafae04d84b1a806229ec12508577e97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page