Skip to main content

A very simple tool to generate html with python code.

Project description

py3html

A very simple tool to generate html with python code.

Project Tabler
Author Özcan Yarımdünya
Documentation https://ozcanyarimdunya.github.io/py3html
Source code https://github.com/ozcanyarimdunya/py3html

py3html is a library that you can generate html by using same tree-structure python code.

Installation

Only python3.9+ required, no extra dependencies.

pip install py3html

Usage

Basic usage

import py3html as ph

code = ph.p("Hello, World")

code.html

Output

<p>Hello, World</p>

You can add more elements with attributes.

import py3html as ph

code = ph.div(
    ph.h1("Welcome", style="color: red"),
    ph.a("Click here!", href="example.com"),
    ph.p(
        "Login ",
        ph.small("to"),
        " continue!",
    ),
    class_="container"
)

code.html

Output

<div class="container">
  <h1 style="color: red">Welcome</h1>
  <a href="example.com">Click here!</a>
  <p>Login <small>to</small> continue!</p>
</div>

Test

This project using pytest.

make test

Documentation

Live preview

make serve-docs

Building

build-docs

LICENSE

MIT License

Copyright (c) 202 yarimdunya.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

py3html-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

py3html-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file py3html-1.0.0.tar.gz.

File metadata

  • Download URL: py3html-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1033-azure

File hashes

Hashes for py3html-1.0.0.tar.gz
Algorithm Hash digest
SHA256 76af25f392cfa37a18b80892c30a785fcf7419b16d89c70fdf18ce83bc299b0d
MD5 b1b29068fbc097f42397fd83f2588744
BLAKE2b-256 2ad9e31d04e642ae0d65832a3aee21ba5d84e69f782b0032dcae44959d2e48db

See more details on using hashes here.

File details

Details for the file py3html-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: py3html-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1033-azure

File hashes

Hashes for py3html-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b71f9a59fc7478d6d5cf7c61b9db24926b2ec424330064fb116aecb27d60fb7b
MD5 fc6101f992a4c0ba53be20b7137cc38f
BLAKE2b-256 63bcdff7e8a15084448a846c596293cccacca03b428ec84ec36509933193545b

See more details on using hashes here.

Supported by

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