Domonic:¶
Generate HTML with Python 3¶
Domonic Not only a Python library for generating HTML
Domonic contains several evolving packages:
html : Generate html with python 3 😎
dom : DOM API in python 3 😲
javascript : js API in python 3 😳
terminal || cmd : call terminal commands with python3 😱 (see at the end)
JSON : utils for loading / decorating / transformin
SVG : Generate svg using python
aframe || x3d tags : auto generate 3d worlds with aframe. (see examples folder
dQuery - Utils for querying domonic. (alt + 0 for the º symbol)
geom - vec2, vec3 with _dunders_ as well as shape classes
Take a look at the source code and contribute!
HTML TEMPLATING¶
from domonic.html import *
mydom = html(body(h1('Hello, World!')))
print(f"{mydom}")
<!DOCTYPE html>
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
To pretty print use an f-string. Which also adds the doctype.
install¶
python3 -m pip install domonic
or if you had it before upgrade:
python3 -m pip install domonic --upgrade
CLI¶
There’s a few args you can pass to domonic on the command line to help you out.
To view the online the docs:
domonic -h
To see the version:
domonic -v
To quickly create a domonic project for prototyping:
domonic -p
To use xpath on a website (new):
domonic -x https://google.com //a
The User Guide¶
Here you can find some instructions for getting the most out of Domonic.
- html
- dom
- javascript
- events
- sitemap
- dQuery
- d3
- JSON
- constants
- terminal
- cmd
- tween
- geom
- x3d
- CDN
- decorators
- Templates and Components
- utils
- webapi
- styles
- 🚀 servers
- Running a python server to view static pages
- Serving dynamic content
- Using domonic with Cherrypy
- Using domonic with Pyramid
- Using domonic with Bottle
- Using domonic with Sanic
- Using domonic with Flask
- Using domonic with FastAPI
- Using domonic with Werkzeug
- Using domonic with Starlette
- Using domonic with Tornado
- Using domonic with Django
- Using domonic with aiohttp
- SPA’s
- Using domonic with AWS lambda
- Using domonic with Google Cloud Functions
- 🤖 autodocs
- domonic
- domonic.html
Atag()
TemplateError
a
abbr
address
applet
area
article
aside
audio
b
base
basefont
bdi
bdo
blockquote
body
br
button
canvas
caption
center
cite
closed_tag
code
col
colgroup
command
comment
content
create_element()
data
datalist
dd
details
dfn
dialog
div
dl
doctype
dt
em
embed
fieldset
figcaption
figure
font
footer
form
h1
h2
h3
h4
h5
h6
head
header
hgroup
hr
html
i
iframe
img
input
ins
isindex
kbd
keygen
label
legend
li
link
listing
main
mark
menu
menuitem
meta
meter
mod
nav
noscript
ol
optgroup
option
output
p
param
picture
plaintext
portal
pre
progress
q
render()
rp
rt
ruby
s
samp
script
section
select
small
source
span
strike
strong
style
sub
submit
summary
sup
table
tbody
td
template
textarea
tfoot
th
thead
title
tr
track
u
ul
var
video
wbr
xmp
- domonic.dom
Attr
CDATASection
CharacterData
ChildNode
Comment
DOMConfig
DOMException
DOMPoint
DOMPointReadOnly
DOMQuad
DOMStringMap
DOMTimeStamp
DOMTokenList
Document
DocumentFragment
DocumentType
Element
Entity
EntityReference
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBRElement
HTMLBaseElement
HTMLBaseFontElement
HTMLBodyElement
HTMLButtonElement
HTMLCanvasElement
HTMLCollection
HTMLContentElement
HTMLDListElement
HTMLDataElement
HTMLDataListElement
HTMLDialogElement
HTMLDivElement
HTMLDocument
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFormControlsCollection
HTMLFormElement
HTMLFrameSetElement
HTMLHRElement
HTMLHeadElement
HTMLHeadingElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLIsIndexElement
HTMLKeygenElement
HTMLLIElement
HTMLLabelElement
HTMLLegendElement
HTMLLinkElement
HTMLMapElement
HTMLMediaElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLOListElement
HTMLObjectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPortalElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLShadowElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableDataCellElement
HTMLTableElement
HTMLTableHeaderCellElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTemplateElement
HTMLTextAreaElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
Node
NodeIterator
NodeList
ParentNode
ProcessingInstruction
RadioNodeList
ShadowRoot
Text
TreeWalker
console
- domonic.javascript
Array
Boolean
Date
Error
Function
Global
Job
Map
Math
Number
ProgramKilled
Reflect
Screen
String
Window
Worker
as_signed()
clearTimeout()
decodeURI()
decodeURIComponent()
encodeURI()
encodeURIComponent()
function()
parseFloat()
parseInt()
setTimeout()
window
- domonic.terminal
TerminalException
alias
apt
ar
asa
at
awk
banner
basename
bash
batch
bc
bg
bind
builtin
cal
caller
cat
cc
cd
cflow
chgrp
chmod
chown
cksum
comm
command
compgen
complete
compopt
compress
convert
cowsay
cp
cron
crontab
csplit
ctags
curl
cut
cxref
date
dd
declare
delta
df
diff
dirname
dirs
disown
du
echo
ed
enable
env
ex
exit
expand
export
expr
fc
ffmpeg
fg
figlet
file
find
finger
fold
fort77
fuser
gcc
gencat
get
getconf
getopts
git
grep
groupadd
groupdel
groups
gunzip
gzip
head
history
iconv
ifconfig
ipconfig
ipcrm
ipcs
jobs
join
jq
kill
killall
less
let
lex
link
ln
local
locale
localedef
logger
logname
logout
lp
ls
m4
mailx
make
man
mapfile
mesg
mkdir
mkfifo
mkfile
more
mv
nautilus
newgrp
nice
nl
nm
nmap
nohup
npm
od
passwd
paste
patch
pathchk
pax
ping
pip
popd
pr
printf
prs
ps
pushd
pwd
python
qalter
qdel
qhold
qmove
qmsg
qrerun
qrls
qselect
qsig
qstat
qsub
read
readarray
readonly
reboot
renice
rm
rmdel
rmdir
rsync
sact
say
sccs
scp
sed
sh
shift
shopt
shutdown
sleep
sort
source
split
ssh
strings
strip
stty
suspend
tabs
tail
talk
tar
tee
test
time
times
touch
tput
tr
trap
true
tsort
tty
typeset
ulimit
umask
unalias
uname
uncompress
unexpand
unget
uniq
unlink
unset
uptime
useradd
userdel
users
uucp
uudecode
uuencode
uustat
uux
val
wait
wc
wget
what
who
whoami
write
xargs
yacc
zcat
- domonic.JSON
csv2json()
csvify()
flatten()
parse()
parse_file()
stringify()
tablify()
- domonic.CDN
CDN_CSS
CDN_IMG
CDN_JS
- domonic.events
AnimationEvent
BeforeUnloadEvent
ClipboardEvent
CompositionEvent
CustomEvent
DOMContentLoadedEvent
DragEvent
ErrorEvent
Event
EventDispatcher
EventTarget
ExtendableEvent
FetchEvent
FocusEvent
GamePadEvent
HashChangeEvent
InputEvent
KeyboardEvent
MessageEvent
MouseEvent
PageTransitionEvent
PointerEvent
PopStateEvent
ProgressEvent
PromiseRejectionEvent
SVGEvent
SecurityPolicyViolationEvent
StorageEvent
SubmitEvent
SyncEvent
TimerEvent
TouchEvent
TransitionEvent
TweenEvent
UIEvent
WheelEvent
- domonic.style
CSSColorProfileRule
CSSConditionRule
CSSCounterStyleRule
CSSDocumentRule
CSSFontFaceRule
CSSFontFeatureValuesRule
CSSGroupingRule
CSSImportRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleDeclaration
CSSStyleRule
CSSStyleSheet
CSSSupportsRule
MediaList
Style
StyleSheet
StyleSheetList
- domonic.utils
Utils
- domonic.decorators
as_json()
called()
check()
deprecated()
el()
iife()
instead()
log()
silence()
- domonic.svg
altGlyph
altGlyphDef
altGlyphItem
animate
animateColor
animateMotion
animateTransform
circle
clipPath
cursor
defs
desc
discard
ellipse
feBlend
feColorMatrix
feComponentTransfer
feComposite
feConvolveMatrix
feDiffuseLighting
feDisplacementMap
feDistantLight
feDropShadow
feFlood
feFuncA
feFuncB
feFuncG
feFuncR
feGaussianBlur
feImage
feMerge
feMergeNode
feMorphology
feOffset
fePointLight
feSpecularLighting
feSpotLight
feTile
feTurbulence
font
foreignObject
g
glyph
glyphRef
hatch
hatchpath
hkern
image
line
linearGradient
marker
mask
metadata
mpath
path
pattern
polygon
polyline
radialGradient
rect
solidcolor
stop
svg
switch
symbol
text
textPath
title
tref
tspan
unknown
use
view
vkern
Tween
- domonic.x3d
Anchor
Appearance
Arc2D
ArcClose2D
AudioClip
Background
BallJoint
Billboard
BinaryGeometry
BlendMode
BlendedVolumeStyle
Block
BoundaryEnhancementVolumeStyle
Box
BufferAccessor
BufferGeometry
BufferView
CADAssembly
CADFace
CADLayer
CADPart
CartoonVolumeStyle
Circle2D
ClipPlane
CollidableShape
Collision
CollisionCollection
CollisionSensor
Color
ColorChaser
ColorDamper
ColorInterpolator
ColorMaskMode
ColorRGBA
CommonSurfaceShader
ComposedCubeMapTexture
ComposedShader
ComposedTexture3D
ComposedVolumeStyle
Cone
Coordinate
CoordinateDamper
CoordinateDouble
CoordinateInterpolator
Cylinder
CylinderSensor
DepthMode
DirectionalLight
Dish
Disk2D
DoubleAxisHingeJoint
DynamicLOD
EdgeEnhancementVolumeStyle
ElevationGrid
Environment
Extrusion
Field
FloatVertexAttribute
Fog
FontStyle
GeneratedCubeMapTexture
GeoCoordinate
GeoElevationGrid
GeoLOD
GeoLocation
GeoMetadata
GeoOrigin
GeoPositionInterpolator
GeoTransform
GeoViewpoint
Group
HAnimDisplacer
HAnimHumanoid
HAnimJoint
HAnimSegment
HAnimSite
ImageTexture
ImageTexture3D
ImageTextureAtlas
IndexedFaceSet
IndexedLineSet
IndexedQuadSet
IndexedTriangleSet
IndexedTriangleStripSet
Inline
IsoSurfaceVolumeData
LOD
LineProperties
LineSet
MPRPlane
MPRVolumeStyle
Material
MatrixTextureTransform
MatrixTransform
Mesh
MetadataBoolean
MetadataDouble
MetadataFloat
MetadataInteger
MetadataSet
MetadataString
MotorJoint
MovieTexture
MultiTexture
MultiTextureCoordinate
NavigationInfo
Normal
NormalInterpolator
Nozzle
OpacityMapVolumeStyle
OrientationChaser
OrientationDamper
OrientationInterpolator
OrthoViewpoint
Param
ParticleSet
PhysicalEnvironmentLight
PhysicalMaterial
PixelTexture
PixelTexture3D
Plane
PlaneSensor
PointLight
PointSet
Polyline2D
Polypoint2D
PopGeometry
PopGeometryLevel
PositionChaser
PositionChaser2D
PositionDamper
PositionDamper2D
PositionInterpolator
PositionInterpolator2D
ProjectionVolumeStyle
Pyramid
QuadSet
RadarVolumeStyle
Rectangle2D
RectangularTorus
RefinementTexture
RemoteSelectionGroup
RenderedTexture
RigidBody
RigidBodyCollection
Route
ScalarChaser
ScalarDamper
ScalarInterpolator
Scene
SegmentedVolumeData
ShadedVolumeStyle
ShaderPart
Shape
SilhouetteEnhancementVolumeStyle
SingleAxisHingeJoint
SliderJoint
SlopedCylinder
Snout
SolidOfRevolution
Sound
Sphere
SphereSegment
SphereSensor
SplinePositionInterpolator
SpotLight
StaticGroup
StippleVolumeStyle
SurfaceShaderTexture
Switch
TexCoordDamper2D
Text
Texture
TextureCoordinate
TextureCoordinate3D
TextureCoordinateGenerator
TextureProperties
TextureTransform
TextureTransform3D
TextureTransformMatrix3D
TimeSensor
ToneMappedVolumeStyle
Torus
TouchSensor
Transform
TriangleSet
TriangleSet2D
TwoSidedMaterial
Uniform
UniversalJoint
Viewfrustum
Viewpoint
VolumeData
WorldInfo
X3D
X3DAppearanceChildNode
X3DAppearanceNode
X3DBackgroundNode
X3DBinaryContainerGeometryNode
X3DBindableNode
X3DBoundedObject
X3DChaserNode
X3DChildNode
X3DColorNode
X3DComposableVolumeRenderStyleNode
X3DComposedGeometryNode
X3DCoordinateNode
X3DDamperNode
X3DDragSensorNode
X3DEnvironmentNode
X3DEnvironmentTextureNode
X3DFogNode
X3DFollowerNode
X3DFontStyleNode
X3DGeometricPropertyNode
X3DGeometryNode
X3DGroupingNode
X3DInfoNode
X3DInterpolatorNode
X3DLODNode
X3DLightNode
X3DMaterialNode
X3DMetadataObject
X3DNBodyCollidableNode
X3DNavigationInfoNode
X3DNode
X3DPlanarGeometryNode
X3DPointingDeviceSensorNode
X3DRigidJointNode
X3DSensorNode
X3DShaderNode
X3DShapeNode
X3DSoundNode
X3DSoundSourceNode
X3DSpatialGeometryNode
X3DTexture3DNode
X3DTextureCoordinateNode
X3DTextureNode
X3DTextureTransformNode
X3DTimeDependentNode
X3DTouchSensorNode
X3DTransformNode
X3DVertexAttributeNode
X3DViewpointNode
X3DVolumeDataNode
X3DVolumeRenderStyleNode
anchor
appearance
arc2D
arcClose2D
audioClip
background
ballJoint
billboard
binaryGeometry
blendMode
blendedVolumeStyle
block
boundaryEnhancementVolumeStyle
box
bufferAccessor
bufferGeometry
bufferView
cADAssembly
cADFace
cADLayer
cADPart
cartoonVolumeStyle
circle2D
clipPlane
collidableShape
collision
collisionCollection
collisionSensor
color
colorChaser
colorDamper
colorInterpolator
colorMaskMode
colorRGBA
commonSurfaceShader
composedCubeMapTexture
composedShader
composedTexture3D
composedVolumeStyle
cone
coordinate
coordinateDamper
coordinateDouble
coordinateInterpolator
cylinder
cylinderSensor
depthMode
directionalLight
dish
disk2D
doubleAxisHingeJoint
dynamicLOD
edgeEnhancementVolumeStyle
elevationGrid
environment
extrusion
field
floatVertexAttribute
fog
fontStyle
generatedCubeMapTexture
geoCoordinate
geoElevationGrid
geoLOD
geoLocation
geoMetadata
geoOrigin
geoPositionInterpolator
geoTransform
geoViewpoint
group
hAnimDisplacer
hAnimHumanoid
hAnimJoint
hAnimSegment
hAnimSite
imageTexture
imageTexture3D
imageTextureAtlas
indexedFaceSet
indexedLineSet
indexedQuadSet
indexedTriangleSet
indexedTriangleStripSet
inline
isoSurfaceVolumeData
lOD
lineProperties
lineSet
mPRPlane
mPRVolumeStyle
material
matrixTextureTransform
matrixTransform
mesh
metadataBoolean
metadataDouble
metadataFloat
metadataInteger
metadataSet
metadataString
motorJoint
movieTexture
multiTexture
multiTextureCoordinate
navigationInfo
normal
normalInterpolator
nozzle
opacityMapVolumeStyle
orientationChaser
orientationDamper
orientationInterpolator
orthoViewpoint
param
particleSet
physicalEnvironmentLight
physicalMaterial
pixelTexture
pixelTexture3D
plane
planeSensor
pointLight
pointSet
polyline2D
polypoint2D
popGeometry
popGeometryLevel
positionChaser
positionChaser2D
positionDamper
positionDamper2D
positionInterpolator
positionInterpolator2D
projectionVolumeStyle
pyramid
quadSet
radarVolumeStyle
rectangle2D
rectangularTorus
refinementTexture
remoteSelectionGroup
renderedTexture
rigidBody
rigidBodyCollection
route
scalarChaser
scalarDamper
scalarInterpolator
scene
segmentedVolumeData
shadedVolumeStyle
shaderPart
shape
silhouetteEnhancementVolumeStyle
singleAxisHingeJoint
sliderJoint
slopedCylinder
snout
solidOfRevolution
sound
sphere
sphereSegment
sphereSensor
splinePositionInterpolator
spotLight
staticGroup
stippleVolumeStyle
surfaceShaderTexture
switch
texCoordDamper2D
text
texture
textureCoordinate
textureCoordinate3D
textureCoordinateGenerator
textureProperties
textureTransform
textureTransform3D
textureTransformMatrix3D
timeSensor
toneMappedVolumeStyle
torus
touchSensor
transform
triangleSet
triangleSet2D
twoSidedMaterial
uniform
universalJoint
viewfrustum
viewpoint
volumeData
worldInfo
x3DAppearanceChildNode
x3DAppearanceNode
x3DBackgroundNode
x3DBinaryContainerGeometryNode
x3DBindableNode
x3DBoundedObject
x3DChaserNode
x3DChildNode
x3DColorNode
x3DComposableVolumeRenderStyleNode
x3DComposedGeometryNode
x3DCoordinateNode
x3DDamperNode
x3DDragSensorNode
x3DEnvironmentNode
x3DEnvironmentTextureNode
x3DFogNode
x3DFollowerNode
x3DFontStyleNode
x3DGeometricPropertyNode
x3DGeometryNode
x3DGroupingNode
x3DInfoNode
x3DInterpolatorNode
x3DLODNode
x3DLightNode
x3DMaterialNode
x3DMetadataObject
x3DNBodyCollidableNode
x3DNavigationInfoNode
x3DNode
x3DPlanarGeometryNode
x3DPointingDeviceSensorNode
x3DRigidJointNode
x3DSensorNode
x3DShaderNode
x3DShapeNode
x3DSoundNode
x3DSoundSourceNode
x3DSpatialGeometryNode
x3DTexture3DNode
x3DTextureCoordinateNode
x3DTextureNode
x3DTextureTransformNode
x3DTimeDependentNode
x3DTouchSensorNode
x3DTransformNode
x3DVertexAttributeNode
x3DViewpointNode
x3DVolumeDataNode
x3DVolumeRenderStyleNode
x3d
- domonic.geom
matrix
- domonic.sitemap
atom_link
changefreq
create_ns_element()
geo_country
geo_geo
geo_place_name
get_sitemap()
image_caption
image_geo_location
image_image
image_license
image_loc
image_title
lastmod
loc
mobile_mobile
news_keywords
news_news
news_publication_date
news_stock_tickers
news_title
priority
sitemap
sitemap_format()
sitemap_from_urls()
sitemapindex
sitemapindex_from_urls()
url
urlset
video_category
video_content_loc
video_description
video_duration
video_price
video_price_currency
video_publication_date
video_rating
video_tags
video_thumbnail_loc
video_title
video_video
video_view_count
xhtml_link
- domonic.webapi.url
URL
URLSearchParams
- domonic.webapi.fetch
- Contribute
Join-In¶
Feel free to join in if you find it useful.
If there’s any methods you want that are missing or not complete yet. Just update the code and send a pull request.
I’ll merge and releaese asap.
EXAMPLE PROJECTS¶
A browser based file browser. Working example of how components can work: https://github.com/byteface/Blueberry/
A cron viewer: https://github.com/byteface/ezcron/
Disclaimer¶
There’s several more widely supported libraries doing HTML generation, DOM reading/manipulation, terminal wrappers etc. Maybe use one of those for production due to strictness and support.
This is becoming more of a fast prototyping library.