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.

READ THE DOCS


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.1.tar.gz (30.6 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.1-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nolite-0.1.1.tar.gz
  • Upload date:
  • Size: 30.6 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.1.tar.gz
Algorithm Hash digest
SHA256 7b13f0846780a16e98af8bd1907867d272769f8ec408efc728fe3c57d91d194d
MD5 3753022acb7a11a0bb602adc35854561
BLAKE2b-256 1bec83e34e4f1d87b4fe248d87c655175bfa91ee34f1b84d6f571762ae6e84c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nolite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 451d42abc70d0298664b292624a7cfc4f192f9a52648bd195fe6bbfa7674f4cb
MD5 8c543d3c8d7e7d858bd746ab4028a9d5
BLAKE2b-256 ecfd224bc48517dbdf8281e2915197fce6aed83fefc9f760726e034359d3d814

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