Skip to main content

A Python library to create websites using only Python code

Project description

Nolite: The Full-Stack Python Web Framework

PyPI version License: MIT Build Status

Build beautiful, database-driven web applications using only Python

Nolite is a full-stack web framework for Python developers who want to create robust web applications without the steep learning curve of modern frontend development or complex backend configurations. Our mission is to provide an intuitive, batteries-included, and purely Pythonic way to build for the web.


Key Features

  • Truly Full-Stack: From frontend rendering to backend logic and database management, Nolite provides a single, unified Python environment.
  • Pythonic Styling: Style your UI components using simple Python keyword arguments. Nolite translates bg_color="blue" into the correct CSS, so you don't have to.
  • Database Included: Built-in integration with SQLAlchemy and SQLite gets you started with a powerful ORM and a zero-config database from day one.
  • Component-Based UI: Build your user interface with a rich library of components, from basic tags like Div to advanced, interactive elements like Navbar and Slider.
  • Command-Line Interface: Nolite comes with a CLI to instantly generate a new, well-structured, full-stack project, so you can start developing immediately.
  • Powered by Flask: Nolite is built on the solid foundation of Flask, giving you access to its powerful ecosystem and extensions. It works seamlessly with standard Flask features like Blueprints.

Quick Start: Your First Nolite Project in 60 Seconds

Nolite's Command-Line Interface (CLI) is the fastest and recommended way to start a new project.

1. Installation

First, install Nolite from PyPI. This will also make the nolite CLI tool available.

pip install nolite

2. Create a New Application

Use the python -m nolite new command to generate a new, full-stack project. This creates a new directory with a complete, ready-to-run application.

python -m nolite new my-first-app

3. Run the Development Server

Navigate into your new project directory and run the application.

cd my-first-app
python run.py

Your new Nolite application is now running at http://127.0.0.1:5000.

When you open your browser, you will see a welcome page that is dynamically rendering content from a pre-configured SQLite database. You have just created and launched a full-stack web application!


The Nolite Workflow: A Glimpse Inside

The project generated by nolite new has a clean, scalable structure:

my-first-app/
├── app.db            # Your application's SQLite database file
├── run.py            # The main entry point to start the server
└── app/
    ├── __init__.py   # Initializes the app, database, and routes
    ├── layout.py     # Defines a reusable page layout
    ├── models.py     # Defines your database tables (e.g., User)
    └── routes.py     # Defines your application's pages and logic

1. Define Your UI with Components

Build your pages by composing components and styling them with simple keyword arguments.

# app/layout.py
from nolite.components import Card, H1, Paragraph

def info_card(title, text):
    return Card(
        padding=25,
        border_radius=8,
        box_shadow="0 5px 15px rgba(0,0,0,0.1)",
        hover_style={"transform": "translateY(-5px)"},
        transition="transform 0.2s ease-in-out",
        children=[
            H1(children=[title]),
            Paragraph(children=[text])
        ]
    )

2. Define Your Database in models.py

Create your database tables by defining simple Python classes. Nolite handles the SQL for you.

# app/models.py
from . import db

class Product(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(120), nullable=False)
    price = db.Column(db.Float, nullable=False)

3. Create Your Pages in routes.py

Define a function that returns a Page object and decorate it with a route. You can query your database directly inside this function.

# app/routes.py
from . import app
from .models import Product
from .layout import main_layout

@app.route("/")
def index():
    # Query the database for all products
    all_products = Product.query.all()

    # Use your components to build the page content
    product_cards = [info_card(p.name, f"${p.price}") for p in all_products]

    # Return the final page using your main layout
    return main_layout(children=product_cards)

Contributing

Any contribution of all kinds is welcome. Whether it's reporting a bug, suggesting a new feature, or improving the documentation.

License

This project is licensed under the MIT License.

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

nolite-0.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

nolite-0.1.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file nolite-0.1.0.tar.gz.

File metadata

  • Download URL: nolite-0.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for nolite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1bc0bdaa1264509a888a3505ae1f11647e3cadf7410c69b90cb0fc494840f832
MD5 384d94b1cae847a5434d7329fae7a721
BLAKE2b-256 884c18d851bfd7c8c814039d79ba37beaf4acb1b469bc2590da3b9abe106eec5

See more details on using hashes here.

File details

Details for the file nolite-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nolite-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for nolite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 874fc6d8c391e6fe7d161d1e1d53046115fa644464ae0c1b361619e406f816ea
MD5 b23fa2ccab640ff8aa67e21cb7613464
BLAKE2b-256 ae1a38e656e2f3bc756609124d4ae1571b74532999a9ec3abfb68d5c0255f94d

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