Skip to main content

MyPy8TML

A new way to create a html code inside python

Status of project: in progress...

GitHub

Download

$pip install mypy8tml

Easy start

Generating a simple code:

from mypy_8tml import MyPy8TML

html = MyPy8TML()
html.h1['Hello world']()
code = html.generate()
print(code)
  • Use MyPy8TML( ) to start the class
  • Call the property (name of tag)
  • Put content between the tag using -> []
  • close tag calling the class -> ()

Using flask to render code

So let's do a form

Remember to download Flask first
pip install flask

Pyhton code:

from flask import Flask, render_template_string
from mypy_8tml import MyPy8TML

app = Flask(__name__)

register = MyPy8TML().init_html('Form', 'pt')

register.div.in_class('flex-box')\
        .form.in_class('form')\
            .h1[' Just a simple form']()\
            .p['e-mail :'](-1).input.in_type('email')()\
            .p['password :'](-1).input.in_type('password')()\
            .button.in_type('submit')['submit']()


@app.route('/')
def index():
    return render_template_string(register.generate())

app.run(debug=True)
  • init_html creates a basic html structure
  • Call suports int values, and this values means, a number of times that tags will be closed
  • in_ prefix values puts contents inside tags like class, type, id and etc.
  • Download files

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

    Source Distribution

    mypy8tml-0.2.1.tar.gz (10.1 kB view details)

    Uploaded Source

    File details

    Details for the file mypy8tml-0.2.1.tar.gz.

    File metadata

    • Download URL: mypy8tml-0.2.1.tar.gz
    • Upload date:
    • Size: 10.1 kB
    • Tags: Source
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/4.0.2 CPython/3.10.10

    File hashes

    Hashes for mypy8tml-0.2.1.tar.gz
    Algorithm Hash digest
    SHA256 a313416a34087ef40827d53996d36f27d1cb2aed35d8abcef7e5fd1afd6fa789
    MD5 5259991e56ada3f9eb3e739b4f66aa66
    BLAKE2b-256 2d3911079e4850c23c7cdffcf93a4084288f2dc035e787b7bcc10a3d44cb2ead

    See more details on using hashes here.

    Release history Release notifications | RSS feed

    This release

    0.2.1 This release

    1 file

    0.1.1

    1 file

    Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page