Skip to main content

phyal

Quickly build websites without the hassle of HTML

phyal was born out of a problem, like many good opensource startups alike. phyal was made to solve an issue I had encountered with people I knew and others online of the struggle of learning and implementing HTML. Many of them had already known another language such as Python and JavaScript. Since I was most comfortable with Python, and many new frontend learners would already have encountered Python previously (and if not, Python has a simple syntax), I started seeking help from others who had created frameworks and got to work. As I worked and wrote code, phyal's presense grew with it.

When the planning and begining's of the larget phyal update that I had worked on so far (0.3.0), other fans of phyal jumped into help. They gave suggestions, pull requests, and more, making my job so much easier so I could get the update out in a timely manor without burnout.

This journey led me in a direction I never thought I would take. It was challenging, but rewarding, with new knowledge and experience. phyal has allowed me to grow as a programmer, and in the future probably much more. So I hope you enjoy working with phyal as much as I did working on it.

  • SalladShooter Owner and Maintainer

🙂 Get Started

⬇️ Installation

Get started with phyal in less than a minute by first using pip install phyal in your Shell. And by adding import phyal in your Python file. It‘s as easy as that.

📐 File Setup

Quickly setup your main Python file with these steps

  • First a route needs to be defined, it can be simple like this, or contain multiple routes to access multiple pages.
app = App()
​
@app.route('/')
def index(request):
You can easily add your CSS and JavaScript with just a few lines.
css_link = Tags.link().attr('href', '/static/style.css').attr('rel', 'stylesheet')
js_script = Tags.script().attr('src', '/static/script.js')
​
html_content = str()
  • Inside of route still add a few lines to send your Python code to phyal to render it out into something visible.
app.reload_content([html_content])
return Response(html_content, content_type='text/html')
  • Outside of your route a run function needs to be put in place.
if __name__ == '__main__':
    app.run('0.0.0.0', 5000)

Now you have completed the 🙂 Get Started section, and you can proceed to learn the simple syntax of phyal.

✍️ Syntax

Quickly learn the simple phyal syntax to get started right away

phyal components go hand in hand with HTML elements but are written in the Python programming language. Here’s a quickstart guide to the phyal syntax.

  • You can use an element by setting up an advised html_content variable ->
html_content = str(
    Tags.#element
)
  • You can then add your element to the line, for example the paragraph element or

    ->

Tags.p('Hello, world!')

The first set of parentheses on all elements is for text (if it is used withen HTML, think <a> tags, or <h1> tags, etc.)

  • Then you can add attributes, things like HREF's SRC's ALT's would fall in this category. You would add .attribute(# attribute()) to your line, for example an tag ->
Tags.a('Link').attr('href', 'https://google.com')
  • You can add ID's like so .id('') (such as uses in JavaScript in CSS), for example with a

    tag ->

Tags.p('Hello, world!').id('my_id')
  • You can also add children to the elements in a hireachy system like HTML like so .add_children(Tags.) # Element, for example a

    tag ->

Tags.div().id('container').child(
    Tags.h1('Title').id('title'),
    # Add more children here if needed
)

Now that you have mastered the phyal syntax you should be able to use phyal to it‘s largest potential, if you come across any errors make sure to create an issue here.


GitHub Integrations

Metadata

Release files for phyal 0.4.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 phyal 0.4.1
File Size Uploaded
phyal-0.4.1.tar.gz 5.2 kB Details

Built distribution (wheel)

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

Total release size: 10.7 kB

Release files / phyal-0.4.1.tar.gz

Download URL phyal-0.4.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d508f4348bd9de6c57f9b84c784b57e593a24624ca31babc647a6a5dc9ae4b57
BLAKE2b-256 checksum
How to use checksums
b84a265b04d6d507044f8e678c304e75646de7962cb2657e04845f04de9afa9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.5 CPython/3.10.14 Linux/6.5.0-1025-gcp

Release files / phyal-0.4.1-py3-none-any.whl

Download URL phyal-0.4.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b0d105afd7c661f2cc68d8890f73f39a6f4b3d231b53690675130848833c97d
BLAKE2b-256 checksum
How to use checksums
e169d07e52cd8a33f8caaa6f5129f396db7db1f7e65d1ed6bef6a2f21a91e0f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.5 CPython/3.10.14 Linux/6.5.0-1025-gcp

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

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