Skip to main content

A modern, Tailwind CSS-based UI library for Python web frameworks

Project description

EidosUI 🎨

A modern, flexible Tailwind CSS-based UI library for Python web frameworks. Built for maximum developer flexibility while providing excellent defaults.

[!CAUTION] This library is not ready for anything yet. IN fact, this readme is more of design ideas than anything as much of what's in here isn't implemented yet!

Design

Base CSS

  • styles.css : defines all the core css logic to create classes like edios-mark, eidos-small, etc.
  • light.css/dark.css : These define lots of css variables used in styles.css and are themes

Users would create a custom theme by copying light/dark css files and changing the variable definitions.

Styles

This has enums that make the Base CSS clases accessible in python. For example:

styles.typography.h1 or styles.buttons.primary

Tags

def H1(*content, cls: str = None, **kwargs) -> air.H1:
    """Semantic H1 heading"""
    return air.H1(*content, cls=stringify(styles.typography.h1, cls), **kwargs)

def Mark(*content, cls: str = None, **kwargs) -> air.Mark:
    """Highlighted text"""
    return .Mark(*content, cls=stringify(styles.typography.mark, cls), **kwargs)

def Small(*content, cls: str = , **kwargs) -> air.Small:
    """Small text"""
    return air.Small(*content, cls=stringify(styles.typography.small, cls), **kwargs) 

Components (Not Built Yet)

Theses are things that go beyond just exposing css to python. Here's a simple example of what might be added.

class Table:
    def __init__(self, cls: str = None, **kwargs):
        """Create an empty table with optional styling"""
        self.cls = cls
        self.kwargs = kwargs
    
    @classmethod
    def from_lists(cls, data: list[list], headers: list[str] = None, cls_: str = None, **kwargs):
        """Create table from list of lists"""
        thead = []
        if headers:
            thead = THead(Tr(*[Th(header) for header in headers]))
        
        tbody_rows = []
        for data in row_data:
            tbody_rows.append(Tr(*map(Td, row_data)))
        tbody = TBody(*tbody_rows)
        
        return Table(thead+tbody, cls=cls_, **kwargs)
    
    @classmethod
    def from_dicts(cls, data: list[dict], headers: list[str] = None, cls_: str = None, **kwargs):
        """Create table from list of dictionaries"""
        thead = []
        if headers:
            thead = THead(Tr(*[Th(header) for header in headers]))
        
        tbody_rows = []
        for row in data:
            tbody_rows.append(Tr(*[Td(row.get(header, "")) for header in (headers or list(row.keys()))]))
        tbody = TBody(*tbody_rows)
        
        return Table(thead+tbody, cls=cls_, **kwargs)

# Usage examples:
Table.from_lists([["A", "B"], ["C", "D"]], headers=["Col1", "Col2"])
Table.from_dicts([{"name": "John", "age": 25}], headers=["Name", "Age"])

Plugins

edios-md

This will be installable with pip install "eidos[markdown]".

This is a plugin for rendering markdown that is well scoped to just markdown rendering. This module does markdown rendering well with table of contents with scrollspy, code highlighting, latex rendering, etc. It must be used with EidosUI as it uses css variables from there for the styling (so it is always in sync with the theme)

Project details


Download files

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

Source Distribution

eidosui-0.2.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

eidosui-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file eidosui-0.2.0.tar.gz.

File metadata

  • Download URL: eidosui-0.2.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for eidosui-0.2.0.tar.gz
Algorithm Hash digest
SHA256 58c41e9d680f4e659b9b087ceedd1025a5a70dcd49833d3f0296b6cd8562ea14
MD5 128ad6eeef8d94665af9ac4d8518e641
BLAKE2b-256 ac368b51d378e58a2dbd4356b4f7da1dde86ce6e998523482ffbe3331bdd6b07

See more details on using hashes here.

File details

Details for the file eidosui-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: eidosui-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for eidosui-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d4e9a84080e46847fd281fea7d57d4f87a14eb4f402105280560062ad20c30b
MD5 9db0e9d1d4537a03e48eda254385e1e6
BLAKE2b-256 7c9f1631a5b304bb55d077ca69d1a4b952bed1be78e9b38d915578c3997d7a6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page