Skip to main content

Fude (筆) is a library for representing HTML in Python. It uses Lists to represent elements, and Dicts to represent an element’s attributes.

Fude is inspired by Hiccup https://github.com/weavejester/hiccup

Syntax

Here is a basic example of Fude syntax:

>>> fude.html('text')
'text'

>>> fude.html(['tag'])
'<tag />'

>>> fude.html(['div', 'bar'])
'<div>bar</div>'

>>> fude.html(['span', {'class': 'foo'}, 'bar'])
'<span class="foo">bar</span>'

>>> fude.html(['div', 'bar', ['span', 'baz'], ['span', 'bang']])
'<div>bar<span>baz</span><span>bang</span></div>'

>>> fude.html(['div', 'bar', [['span', 'baz'], ['span', 'bang']]])
'<div>bar<span>baz</span><span>bang</span></div>'

The first element of the List is used as the element name. The second attribute can optionally be a Dict, in which case it is used to supply the element’s attributes. Every other element is considered part of the tag’s body.

And provides a CSS-like shortcut for denoting id and class attributes:

>>> fude.html(['div#foo.bar.baz', 'bang'])
'<div class="bar baz" id="foo">bang</div>'

>>> fude.html(['#foo.bar.baz', 'bang'])
'<div class="bar baz" id="foo">bang</div>'

If the body of the element is a List, its contents will be expanded out into the element body. This makes working with functions like map and List comprehensions:

>>> fude.html(['ul', [['li', x] for x in range(1, 4)]])
'<ul><li>1</li><li>2</li><li>3</li></ul>'

Metadata

Release files for fude 1.0.1

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

Source distribution (sdist)

Source distribution for fude 1.0.1
File Size Uploaded Provenance
fude-1.0.1.tar.gz 2.3 kB Without provenance Details

Release files / fude-1.0.1.tar.gz

Download URL fude-1.0.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb7c7331b517d63bdf0248c9e6e0210bd71782f71050c58397e99e139e570dc
BLAKE2b-256 checksum
How to use checksums
2ebe4724e0a87addf9b50caa74bfd0414858a77bfe36b176eb51950f82730066
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for fude 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

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