Skip to main content

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 pypx content using the Parser class.
  • 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


Download files

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

Source Distribution

xtracto-0.0.10.tar.gz (730.5 kB view details)

Uploaded Source

Built Distribution

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

xtracto-0.0.10-py3-none-any.whl (752.3 kB view details)

Uploaded Python 3

File details

Details for the file xtracto-0.0.10.tar.gz.

File metadata

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

File hashes

Hashes for xtracto-0.0.10.tar.gz
Algorithm Hash digest
SHA256 c2ea988e26f98302d104dccc1c85aadc372ee6470f507e45690e22ff193a7d65
MD5 a158c270825fd968294c30d752e7319b
BLAKE2b-256 a9721536d90d96bd4eca1d0eff28549750608eb9a338c0af05fb664afed9a36e

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtracto-0.0.10.tar.gz:

Publisher: publish-on-push.yml on shashstormer/xtracto

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

File details

Details for the file xtracto-0.0.10-py3-none-any.whl.

File metadata

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

File hashes

Hashes for xtracto-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 95372209737edcfda76a4e4adfbbb1c57517e336ffc2f907f377ebc6e8390b5b
MD5 c2f1e2bda585179e41bb807c11b0817e
BLAKE2b-256 6a0e2edbebd3f649e238d47d7a1dc7576da567feb68cad05e128ec8055fcda13

See more details on using hashes here.

Provenance

The following attestation bundles were made for xtracto-0.0.10-py3-none-any.whl:

Publisher: publish-on-push.yml on shashstormer/xtracto

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