Skip to main content

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) 2023 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.

Metadata

Release files for py3html 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py3html 1.0.2
File Size Uploaded
py3html-1.0.2.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py3html 1.0.2
File Interpreter ABI Platform
py3html-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / py3html-1.0.2.tar.gz

Download URL py3html-1.0.2.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d5d1ba49e79c85849e7233623774fb0c22808e1a7128a9b14eb490d928673c69
BLAKE2b-256 checksum
How to use checksums
8d2be962bbb79ffb3693c759834c846b753450f8575fa113e822aede4c112154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1033-azure

Release files / py3html-1.0.2-py3-none-any.whl

Download URL py3html-1.0.2-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96b537c8b682691be6e8b8e914ab7ebc49ce02ad016d6d1239d5724f2d49e355
BLAKE2b-256 checksum
How to use checksums
665aa682508135bdfe5e3e3d8a9ab7fa5af2ccccda3109cd5071b1ccb90e9c96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1033-azure

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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