Skip to main content

A Python-native utility-first CSS generator and compiler.

Project description

TailPySCSS Logo

TailPySCSS v0.4.7

Analysis & Tests PyPI - Version PyPI - Downloads PyPI - Python Version License

The Python-Native Utility CSS Engine for Clean HTML

TailPySCSS is a Python-powered TailwindCSS alternative without Node.js. It is a lightweight utility-first CSS framework designed specifically for Python developers (Flask, Django, FastAPI).

If you are looking for a Python styling framework or a pure Python UI framework, this is it. Unlike traditional tools, this is a Node-less CSS engine that compiles SCSS to CSS directly in Python. It perfectly integrates with Jinja2 templates, keeping your project 100% Pythonic.

100% Python. 100% Open Source.

Created by Abdi Abdikarim


🚀 New in v0.4.0 (The 3x Bundle)

  • Universal Python Bridge: Automatically generates tailpyscss_theme.py effectively synching your frontend design tokens with your Python backend (Flask/Django/FastAPI).
  • Smart Config: Validated Python-based configuration (tailpy_config.py) with 100% Security Sanitization preventing CSS injections.
  • Performance Core: Smart MD5 Caching & 0.1s Watch Debounce for instant feedback.

📦 Installation

You can install TailPySCSS via pip or from source.

Option 1: Install via PyPI

pip install tailpyscss

Option 2: Install from Source (Development)

If you want to contribute or modify the framework:

pip install -e .

Auto-Setup for Windows

The installation attempts to automatically run:

python -m tailpyscss.cli setup-path

This adds the generic Python Scripts folder to your Windows PATH so you can use the tailpyscss command globally.

[!NOTE] Command not found? If the automatic setup failed and Windows can't find the tailpyscss command, run the setup manually:

python -m tailpyscss.cli setup-path

Then restart your terminal.

⚡ Quick Start

1. Initialize

Go to your project folder and run:

tailpyscss init

(Or use python -m tailpyscss.cli init)

This creates:

  • tailpy_config.py (Your Python-based Settings!)
  • styles/ folder (Your SCSS)

2. Build or Watch

To build once:

tailpyscss build

To watch for changes (0.1s response time):

tailpyscss watch

3. The Universal Bridge (Backend Magic)

When you run build, we generate tailpyscss_theme.py. Use it in your Python code!

import tailpyscss_theme

print(tailpyscss_theme.COLORS['primary']) 
# Output: #3b82f6 (Synced directly from your CSS logic!)

4. The Core Philosophy: Clean HTML & BEM

The main objective of TailPySCSS is to separate structure (HTML) from implementation (CSS). Instead of cluttering your HTML with classes, use SCSS BEM and the custom @apply directive.

Your SCSS (styles/main.scss):

.card {
    @apply flex flex-col bg-white p-6 rounded-lg shadow-lg;

    &__header {
        @apply text-2xl font-bold text-dark mb-4;
    }

    &__button {
        @apply px-4 py-2 bg-primary text-white rounded hover:bg-secondary transition-colors;
    }
}

5. Modular SCSS (New in v0.4.5)

You are not limited to main.scss. You can create as many SCSS files as you like (e.g., styles/components/_card.scss) and import them.

styles/main.scss:

@import "utilities";
@import "components/card"; 
// ^ The framework will automatically process @apply inside your imports!

styles/components/_card.scss:

.card {
     @apply bg-white p-6 rounded shadow;
}

⚙️ Configuration (tailpy_config.py)

We now use Native Python for configuration. Pure dynamic power.

config = {
    "colors": {
        "primary": "#3b82f6",
        "secondary": "#ec4899",
        "dark": "#1f2937",
        "light": "#f3f4f6"
    },
    # ... screens, spacing, typography
}

[!IMPORTANT] Security Guarantee: All configuration values are strictly sanitized. Attempts to inject CSS (e.g., "; body { display: none }") will raise a Security Alert and stop the build.


📚 Documentation


📄 License

MIT License. Free for commercial and private use.

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

tailpyscss-0.4.9.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

tailpyscss-0.4.9-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file tailpyscss-0.4.9.tar.gz.

File metadata

  • Download URL: tailpyscss-0.4.9.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tailpyscss-0.4.9.tar.gz
Algorithm Hash digest
SHA256 a028e132dba4fc31a08fca31de6d29b1764176eda83a174a04427d1162454146
MD5 15fbb6116fd40b9b27ff98ec5aad3783
BLAKE2b-256 05d1621d5c191d424492d66a9b865831b0a0695b1544e8c34cde67a6be06a04a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tailpyscss-0.4.9.tar.gz:

Publisher: publish.yml on tailpyscss2/tailpyscss-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tailpyscss-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: tailpyscss-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tailpyscss-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 fa63c4a3294aebd59f83f7b4f1dd973bf3a9e026907e1c0670f76cb89e4ef870
MD5 395b5bf3d5f1a5d6ad6b1501fc72063e
BLAKE2b-256 a78e7e16e70006d4159681fd923807f5d1acde790948ac1c69afdc5cf167bf82

See more details on using hashes here.

Provenance

The following attestation bundles were made for tailpyscss-0.4.9-py3-none-any.whl:

Publisher: publish.yml on tailpyscss2/tailpyscss-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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