Skip to main content

python classes to create accessible HTML elements and documents

Project description

domible

Domible is a set of Python classes used to generate HTML documents and elements of arbitrary complexity. The basic idea behind domible is fairly simple, HTML elements are represented as Python objects. When an element object is evaluated, it renders the text of the HTML element. Objects can contain other element objects which will also evaluate to text when the containing object is evaluated. See below for a basic example.

Origin Story

domible is an evolution of the pymenable package which is deprecated.

Instead of using jinja templates for the basic structure of the HTML document, a root class, Html, generates the <html> element with Head and Body classes generating the <head> and <body> elements. Elements can be added to the head and body to generate HTML documents of arbitrary complexity.

I decided pymenable was too complicated using jinja templates (e.g., having to manage extra resources and learn to use jinja).

I'm not disparaging jinja, it's an awesome tool. I think it's easier though to use Python classes to create the root element as well as all the other elements for the HTML document.

Plus I wanted to change the name.

Installation

To install the domible package (which includes a simple starter script), run:

pip install domible

Along with the domible package is a script, distarter to serve as an example of how to use domible. After you pip install domible, you should be able to run distarter from the command line. Running it should result in a very simple web page shown in your default browser. See below for how to find the code for distarter.

Domible has an optional command line interface (dicli) to show some examples. To install dicli along with domible, and be able to run dicli from the command line, install domible with:

pip install domible[dicli] 

dicli is built using the Python package typer. Instead of documenting dicli here, I'll keep the internal typer supported help current. For details on how to use dicli, run:

dicli --help

Usage

At some point there will be really cool examples here using Jupyter Notebooks. Until then, the code from distarter will serve as a starting point.

To get the code for distarter, look in the site-packages, where you pip installed domible, for the distarter package. And/or, you can clone the domible repo and look in domible/src/distarter/main.py.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

domible was created by Joel Dodson. It is licensed under the terms of the MIT license.

Credits

domible was created with cookiecutter and the py-pkgs-cookiecutter template.

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

domible-0.1.0.tar.gz (85.9 kB view details)

Uploaded Source

Built Distribution

domible-0.1.0-py3-none-any.whl (90.5 kB view details)

Uploaded Python 3

File details

Details for the file domible-0.1.0.tar.gz.

File metadata

  • Download URL: domible-0.1.0.tar.gz
  • Upload date:
  • Size: 85.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Windows/10

File hashes

Hashes for domible-0.1.0.tar.gz
Algorithm Hash digest
SHA256 00c5725ed0ce06e64ad0a78ec05c52ab438a9cbe53d88d46550f8abb1faf353d
MD5 18f825338aec4e94ab12f6a990a0da70
BLAKE2b-256 66729d664ff84b145e6b4eaa25ab77150fbc75c6286174249a1aa525d625ac73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: domible-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 90.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Windows/10

File hashes

Hashes for domible-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6c05b9e51ebeb39ddb72f6522bc6b5b2c6890fd81f67c0eecc429509fb5216d
MD5 1807d7d0f0d08616976f1a414ab19b83
BLAKE2b-256 fcb945b8e59ca7610758a64bfdb2fa3f9c8642f8f7cafe195b58a8d12edaef9a

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