Xtracto is a lightweight web development framework designed to simplify the process of creating dynamic web pages using Python and pypx.
Project description
Xtracto Web Development Framework
eXtensible, Configurable, and Reusable Automation Component Tool and Organizer for html through pypx
Xtracto is a lightweight web development framework designed to simplify the process of creating dynamic web pages using Python. It uses a custom markup language called pypx (Python Page eXtension) that compiles to HTML with Jinja2 templating support.
This module is a parser for pypx (custom markup language) to html
read pypx.md to understand the custom markup language
Features
- Parser Class: Easily parse and transform
pypxcontent using theParserclass. - Component System: Build reusable components and import them into your pages.
- Layout Support: Define layouts to wrap your pages with consistent headers, footers, etc.
- Jinja2 Integration: Use Jinja2 syntax for variables, loops, and logic.
- Tailwind CSS Support: Automatically generates Tailwind CSS based on your usage.
- Build System: Pre-render your pages to HTML for production.
It is recommended that you use python 3.9+ for best compatibility
Installation
pip install xtracto
Sample project
You can view a sample project at shashstormer/xtracto_website.
Usage
1. Parser Class
Initialize the Parser class with the content or file path:
Example with content
from xtracto import Parser
content = "html\n body\n h1\n Hello World"
parser = Parser(content=content)
parser.render()
print(parser.html_content)
Example with a file path
from xtracto import Parser
# Assuming you have configured xtracto.config.py
parser = Parser(path="index.pypx")
parser.render()
print(parser.html_content)
2. Building for Production
Use the Builder class to compile all your pages to HTML:
from xtracto import Builder
builder = Builder()
builder.build()
Configuration
The project root is determined by the presence of xtracto.config.py. It must be present in your project root directory.
Paths in the pypx files are relative to the project root.
Customize project-specific configurations in the xtracto.config.py file:
# xtracto.config.py
modules_dir = "xtractocomponents" # Directory for reusable components
pages_dir = "xtractopages" # Directory for your pages
build_dir = "build" # Directory for built HTML files
log_level = "info" # Logging level
reparse_tailwind = False # Whether to regenerate Tailwind CSS on render
production = False # Production mode flag
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtracto-0.0.11.tar.gz.
File metadata
- Download URL: xtracto-0.0.11.tar.gz
- Upload date:
- Size: 756.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
775ab78db7b0ce96b9fadc0a71f3d809da250ddde0ad737ec21ef839a331b76e
|
|
| MD5 |
fc6b17076e2dcaab0d1e6fd2c222ee35
|
|
| BLAKE2b-256 |
f23b08f4f828cf86539b7870307b45012730d018a8ee576129320c9c2d3fe7d5
|
Provenance
The following attestation bundles were made for xtracto-0.0.11.tar.gz:
Publisher:
publish-on-push.yml on shashstormer/xtracto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtracto-0.0.11.tar.gz -
Subject digest:
775ab78db7b0ce96b9fadc0a71f3d809da250ddde0ad737ec21ef839a331b76e - Sigstore transparency entry: 778213548
- Sigstore integration time:
-
Permalink:
shashstormer/xtracto@84687d61aaa69e998b0a926f476f35225ab4382f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/shashstormer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-push.yml@84687d61aaa69e998b0a926f476f35225ab4382f -
Trigger Event:
push
-
Statement type:
File details
Details for the file xtracto-0.0.11-py3-none-any.whl.
File metadata
- Download URL: xtracto-0.0.11-py3-none-any.whl
- Upload date:
- Size: 786.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
836ed3e2d0fcad6216bd58baf2354e5cf3e3510cf7e96436939c9905aaea7424
|
|
| MD5 |
c54a3289b08b9379ec620407e5ace6b5
|
|
| BLAKE2b-256 |
40da2a672efe577e1596640e8cd0e786d002a59e10d3039b208b472291eb4688
|
Provenance
The following attestation bundles were made for xtracto-0.0.11-py3-none-any.whl:
Publisher:
publish-on-push.yml on shashstormer/xtracto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtracto-0.0.11-py3-none-any.whl -
Subject digest:
836ed3e2d0fcad6216bd58baf2354e5cf3e3510cf7e96436939c9905aaea7424 - Sigstore transparency entry: 778213550
- Sigstore integration time:
-
Permalink:
shashstormer/xtracto@84687d61aaa69e998b0a926f476f35225ab4382f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/shashstormer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-push.yml@84687d61aaa69e998b0a926f476f35225ab4382f -
Trigger Event:
push
-
Statement type: