Skip to main content
#+title: Readme

Compyte is a component library for python which lets you have components in html. It takes in a html with the *Compyte* syntax and returns the html with component results. It has a integrated python run envirionment with the syntax.

load stuff (using python exec to load python to the python envirionment)
#+begin_src django
{$ import os $}
{$ name='Compyte'+' toilet' $}
#+end_src

executing (using eval and replaces with result)
#+begin_src django
{% name %}
{% 10 +10 %}
#+end_src

** Components
Components are added with as html with the compontent='[path-to-component-file]'.
The attributes in the html tag will get added to a props dict and passed to the component file. where it can be accesed

#+begin_src django
{% props['propname'] %}
#+end_src

Check out the example down bellow

*** Example

This is a example of the *Compyte* html

- index.html
#+begin_src html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Untitled</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.12/dist/full.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>

<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
</head>
<body>
{$ import os $}
<h1>{% os.getcwd() %}</h1>
<card component="./tests/card.html" >
{$ string = 'what is ' + str(10-2) $}
<h1 class="text-4xl font-bold" >test</h1>
<btn title="click" onclick="alert('{% string %}')" component="./tests/button.html"></btn>
</card>
</body>
</html>

#+end_src

-card.html
#+begin_src html
<div class="bg-base-200 rounded-lg p-12" >
{% props['children'] %}
</div>
#+end_src

-button.html
#+begin_src html
<button onclick="{% props['onclick'] %}" class="btn btn-primary" >
{% props['title'] %}
</button>
#+end_src


-main.py
#+begin_src python
from compyte import *

output = open('tests/output.html','w')
output.write(parse(open("tests/index.html","r").read()))

#+end_src

Release files for Compyter 0.0.4

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

Source distribution (sdist)

Source distribution for Compyter 0.0.4
File Size Uploaded
compyter-0.0.4.tar.gz 4.6 kB Details

Built distribution (wheel)

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

Total release size:9.3 kB

Release files / compyter-0.0.4.tar.gz

Download URL compyter-0.0.4.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
625ea70d1e83e1f6be7fb2d5a67b5fc61732a660f3ca902491a2dbbd0d96afb1
BLAKE2b-256 checksum
How to use checksums
a177c1c322353af034eedc61887bc07a5ccc5713614af97c7053ee2634d0a7ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / Compyter-0.0.4-py3-none-any.whl

Download URL Compyter-0.0.4-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b27cff62618558d74a5bf16e5daf2deec30dfc33618a34831745a3e08405925
BLAKE2b-256 checksum
How to use checksums
f55fb790e51490c8ac3ff686531813308c786aeaac25ab610ffbf32ac10e754b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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