Skip to main content

Autumn Framework - Build front-end in the back-end

What are we?

Autumn framework, a framework built to make front-end work as close as possible to back-end work. Our goal is not to provide a server or back-end, but a tool that makes front-end look like back-end. By making an ORM(Object Relational Mapping), we add an object-oriented way to write HTML documents and CSS styles directly from Python.

Why us?

You are not limited to us, there are Jinja2 and so many other libraries. What makes us unique is making you to look at a Python class rather than a div tag.

Tests proven Autumn's speed is less than one millisecond, and removing the prettifier actually makes it even faster(tho not visibly faster in some cases).

How?

The process is straight. But there are important things to consider:

  • Thread safety: While we try our best to promise thread safety, such as features like before_build, we cannot lock every read/write. Your elements are up to you, So, for reads/writes, it's best to access self._lock.
  • Dynamicity: When elements are dynamic, their dynamic must be set to True. However, if any of the tags owned are dynamic, the parent will be inferred as dynamic, therefore no need to set dynamic to True.

here is an example with HTML, another with CSS.

HTML

Instead of writing:

<div id="hello-world">Hello World!</div>

You write:

from Autumn import new

Base = new()

tag = Base.tag

class MyDiv(tag.Tag):
    def __init__(self):
        self.name = "div"
        self.closable = True
        self.identifier = "hello-world"
        self.tags = ["Hello World!"]
        # How we recommend it.
        # However, you can place spaces, tabs, and newlines, but be aware that they will be
        # Replaced with -.
        
        super().__init__()

While this seems like writing too much, it's core benefit will be seen when writing dynamic tags or when you don't know about HTML too much. Let's see an example for a dynamic tag.

import time
from Autumn import new

Base = new()


class MyText(Base.tag.Tag):
    def __init__(self, classes: list[str]):
        self.name = "p"
        self.closable = True
        self.classes = classes
        self.dynamic = True
        
        super().__init__()

    def before_build(self, **_kwargs): # Recommended.
        self.tags.append(time.time())

This will produce a well behaving Paragraph with dynamic elements.

CSS

Well, this is straight forward.

div.any-div#my-div-used-for-footer {color: #000000;}

will simply turn into:

from typing import Any
from Autumn import new

Base = new()

class MyStyle(Base.style.Style):
    
    def __init__(self):
        self.name = Base.name.Name("div", Base.name.Identifier("my-div-used-for-footer"),
                                   [Base.name.Class("any-div")])
        self.styles = [
            "color: #000000;"
        ]
        
        super().__init__()

This will also become valuable when writing dynamic CSS or when you simply don't know CSS. Let's see an example for that too.

from typing import Any
from Autumn import new

Base = new()

class MyStyle(Base.style.Style):
    
    def __init__(self):
        self.name = Base.name.Name("div", Base.name.Identifier("my-div-used-for-footer"),
                                   [Base.name.Class("any-div")])
        self.styles = [
            "color: #000000;"
        ]
        
        self.dynamic = True
        
        super().__init__()

    def before_build(self, **kwargs):
        if "style" in kwargs:
            self.styles.append(kwargs["style"])
    

A note on Thread safety

Thread safety is one of the most important parts to remember, every public and private method is thread-safe if it inherits from AbstractBase. Well, excluding getattribute, setattr, every public/private method is thread-safe, unless it's a protected method. We do not lock protected methods, as they are (mostly, by convenience) used by the public/private methods themselves.

Our future goals

Our future goals (currently) can be listed as:

  1. Out of the box experience.
  2. A stable and mature ecosystem.
  3. Complete support for HTML/CSS.
  4. Support for JavaScript, etc...

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autumn_core-1.0.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autumn_core-1.0.0-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

Details for the file autumn_core-1.0.0.tar.gz.

File metadata

  • Download URL: autumn_core-1.0.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for autumn_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 176aa8f33a48163aaa4d9d980b73e7d03a35d0e4f1f9474638cbcea1b16ad984
MD5 24ce60fa6492df0b6b6018febef210a8
BLAKE2b-256 b44d473352453092e8bd23172b507b70f37ed538ac50d6f5dfca9335a06b976e

See more details on using hashes here.

File details

Details for the file autumn_core-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: autumn_core-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 42.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for autumn_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0eec3c32b6fad0210202eee995ebcb9ab932ced6e01c950d011f785b6c8a7cd
MD5 31a048ba73c1fa2a08197399c36bd55b
BLAKE2b-256 53c6569a44d250ae9438790349bbd42580668b621561411d36f9767a9900e893

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.2

2 files

1.0.2

2 files

1.0.1

2 files

This release

1.0.0 This release

2 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