A framework that let's you compose websites in Python with ease!

Related tags

MiscellaneousPerry
Overview

Perry

Perry <= A framework that let's you compose websites in Python with ease!

Perry works similar to Qt and Flutter, allowing you to create component collections. Say you want to create a div with some text and an image. To do that you'd first need to create the page:

from Perry import component, pageView, serve, Composite

Let's break it down:

  • Component - A given element that can be added anywhere on the page
  • pageView - Creates a page with a route for us, we can load styles, JS and other things into it by using the 'styles' argument
  • Serve - A Flask based micro-server for Perry
  • Composite - The most important part! This tells our components to build themselves recursively as well as creating the skeleton, route and debugging info.

Now let's create the page

Homepage = component(pageView, _Inherit = True)
# a pageView is also a component, but inherits different functionality

# Assign page contents
Homepage <= {
  'title': 'Home', # Title of the page 
  'path':'',       # Route on the webserver, no need to include the starting /
  'styles': [bootstrap], # Styles and other components, here we load bootstrap which is included in Extras
  'DOM': pageView.DOM,   # DOM, not yet implemented but worth using in case you want to upgrade to a newer verion of Perry later
  'components': HomepageContents # A ComponentSource with our elements
}

This page will just show up as an error as we haven't yet created our component source! This can be done through importing ComponentSource

HomepageContents = ComponentSource(
  DIV(
    Label('Hello World!', 'h1'),
    Card(
        Image('Image URL'),
        CardText('Sample Text which has attributes for bootstrap cards', 'p')   
    ),
    Label('Good bye!', 'h1')
  )
)

You'll get something like this. The trailing comment is used for debugging

Hello World!

Sample Text which has attributes for bootstrap cards

Good bye!

Running on Perry v0.9 with Debug Mode on!

">
<body>
     
   <div id="" class="">
      <h1 id=""> Hello World! h1>
       
      <div style="width: 18rem;" id="" class="card, ">
         <div class="card-body">
            <img src="Image URL" id="style=''">
             
            <p id="class='card-text'"> Sample Text which has attributes for bootstrap cards p>
             
         div>
      div>
       
      <h1 id=""> Good bye! h1>
       
   div>  <p id=""> Running on Perry v0.9 with Debug Mode on! p>   body>

Custom Element Bundles and Styling

Want to bundle together multiple elements and create a universal one? That's easy to do!

OurCoolNewElement = DIV(
    Label('Hello, I have custom stuff!', 'h1', id = 'CoolTitle'),
    cclass = 'NewElement'
)
# Let's give it some style
ourCustomStyle = style()
ourCustomStyle <= {
  'author':'HUSKI3',
  'source':'Local-made ;)'
  'ctype':'css',
  'css' : '''
  .NewElement {
    color: white;
    background: black;
  }
  '''}
# And now add it to the components
HomepageContents = ComponentSource(
  DIV(
    Label('Hello World!', 'h1'),
    OurCoolNewElement , # <--- here
    Label('Good bye!', 'h1')
  )
)

You'll need to load the style when defining the homepage contents!

Homepage <= {
  ...,
  'styles': [some, styles, ourCustomStyle],
  ...
}

Adding JS Support

At the moment JS doesn't have direct support through built in components, but you can use JQueryEngine and JQueryEngineStrapper from Extras.

# First we create the component with JQuery, give it a pageView to wrap around (WIP)
js = JQueryEngine(pageView, cid = 'coolscript')
# Now you load in the script, it can either be a string or a read from file
js <= ( open('PerryApp/coolscript.js','r').read() )
# To load it in, you need to add JQueryEngineStrapper to the styles of the page and add the js component to the components
HomepageContents.add( js )

Serving pages with Flask

In Perry you always serve pages as a Composite collection, this way they are built and then loaded on Flask on the specified routes.

# Serve our pages as a composite collection
serve <= Composite(Homepage, About, OtherPage, debug = True)
Owner
Linkus
Back-end Dev. Forma is the best. Check out @RocKing1001 for his cool projects!
Linkus
Hexa is an advanced browser.It can carry out all the functions present in a browser.

Hexa is an advanced browser.It can carry out all the functions present in a browser.It is coded in the language Python using the modules PyQt5 and sys mainly.It is gonna get developed more in the fut

1 Dec 10, 2021
Appointment Tracker that allows user to input client information and update if needed.

Appointment-Tracker Appointment Tracker allows an assigned admin to input client information regarding their appointment and their appointment time. T

IS Coding @ KSU 1 Nov 30, 2021
Versión preliminar análisis general de Covid-19 en Colombia

Covid_Colombia_v09 Versión: Python 3.8.8 1/ La base de datos del Ministerio de Salud (Minsalud Colombia) está en https://www.datos.gov.co/Salud-y-Prot

Julián Gómez 1 Jan 30, 2022
Un script en python qui permet d'automatique bumpée (disboard.org) tout les 2h

auto-bumper Un script en python qui permet d'automatique bumpée (disboard.org) tout les 2h Pour la première utilisation, 1.Lancer Install.bat 2.(faire

!! 1 Jan 09, 2022
Boot.img patcher for Tolino ebook readers to enable ADB and root.

I'm not responsible for any damage to your devices by running this tool. Please note that you may loose warranty when using this, although (This is no

Aaron Dewes 9 Nov 13, 2022
An app about keyboards, originating from the design of u/Sonnenschirm

keebapp-backend An app about keyboards, originating from the design of u/Sonnenschirm Setup Firstly, ensure that the environment for python is install

8 Sep 04, 2022
An OrpheusDL Tidal module

OrpheusDL - Tidal A Tidal module for the OrpheusDL modular archival music program Report Bug · Request Feature Table of content About OrpheusDL - Tida

Daniel 54 Dec 29, 2022
An app to help people apply for admissions on schools/hostels

Admission-helper About An app to help people apply for admissions on schools/hostels This app is a rewrite of Admission-helper-beta-v5.8.9 and I impor

Advik 3 Apr 24, 2022
Improving Representations via Similarities

embetter warning I like to build in public, but please don't expect anything yet. This is alpha stuff! notes Improving Representations via Similaritie

vincent d warmerdam 229 Jan 08, 2023
用于导出墨墨背单词的词库,并生成适用于 List 背单词,不背单词,欧陆词典等的自定义词库

maimemo-export 用于导出墨墨背单词的词库,并生成适用于 List 背单词,欧陆词典,不背单词等的自定义词库。 仓库内已经导出墨墨背单词所有自带词库(暂不包括云词库),多达 900 种词库,可以在仓库中选择需要的词库下载(下载单个文件的方法),也可以去 蓝奏云(密码:666) 下载打包好

ourongxing 293 Dec 29, 2022
Python interface to ISLEX, an English IPA pronunciation dictionary with syllable and stress marking.

pysle Questions? Comments? Feedback? Pronounced like 'p' + 'isle'. An interface to a pronunciation dictionary with stress markings (ISLEX - the intern

Tim 38 Dec 14, 2022
Palestra sobre desenvolvimento seguro de imagens e containers para a DockerCon 2021 sala Brasil

Segurança de imagens e containers direto na pipeline Palestra sobre desenvolvimento seguro de imagens e containers para a DockerCon 2021 sala Brasil.

Fernando Guisso 10 May 19, 2022
Cup Noodle Vending Maching Ordering Queue

Noodle-API Cup Noodle Vending Machine Ordering Queue Install dependencies in virtual environment python3 -m venv

Jonas Kazlauskas 1 Dec 09, 2021
A python program with an Objective-C GUI for building and booting OpenCore on both legacy and modern Macs

A python program with an Objective-C GUI for building and booting OpenCore on both legacy and modern Macs, see our in-depth Guide for more information.

dortania 4.7k Jan 02, 2023
This is a small Panel applet for the Budgie Desktop to display the battery charge of a connected Bluetooth device.

BudgieBluetoothBattery This is a small Panel applet for the Budgie Desktop to display the battery charge of a connected Bluetooth device. It uses the

Konstantin Köhring 7 Dec 05, 2022
The Official Jaseci Code Repository

Jaseci Release Notes Version 1.2.2 Updates Added new built-ins for nodes and edges (context, info, and details) Fixed dot output Added reset command t

136 Dec 20, 2022
An example module hooking system, will be used in PySAMP.

An example module hooking system, will be used in PySAMP.

2 May 01, 2022
The worst and slowest programming language you have ever seen

VenumLang this is a complete joke EXAMPLE: fizzbuzz in venumlang x = 0

Venum 7 Mar 12, 2022
This alerts you when the avalanche score a goal

This alerts you when the avalanche score a goal

Davis Burrill 1 Jan 15, 2022
Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

Dungeon Dice Rolls is an aplication that the user can roll dices (d4, d6, d8, d10, d12, d20 and d100) and store the results in one of the 6 arrays.

Bracero 1 Dec 31, 2021