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.

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 content using the Parser class.
  • Automatic Server Setup: Use the App class for hassle-free server setup with FastAPI and Uvicorn.
  • Testing Support: Conduct tests on your content or files using the Tests class.

It is recommended that you use python 3.9 (as of 3rd january 2024) for best compatibility

Installation

pip install xtracto

Usage

1. Parser Class

Initialize the Parser class with the content or file path:

Example with content

from xtracto import Parser
content = "Your content here"
parser = Parser(content=content)

Example with a file path

from xtracto import Parser
file_path = "path/to/your/file.pypx"
parser = Parser(path=file_path)

2. Automatic Server Setup

Use the App class for automatic server setup:

from xtracto import App
app = App()

3. Compilation

Compile non-dynamic pages to HTML:

Example

from xtracto import Parser
parser = Parser()
parser.compile(start_path_for_map="/")

Configuration

project root is determined using the presence of xtracto.config.py it must be present otherwise will raise error.

Paths in the pypx files are relative to the project root.

Paths in the config file are relative to the project root.

The config file can be empty.

Customize project-specific configurations in the xtracto.config.py file. Update the following parameters:

  • modules_dir: Directory for modules (default: "xtractocomponents").
  • pages_dir: Directory for pages (default: "xtractopages").
  • strip_imports: Whether to strip imports (default: True).
  • raise_value_errors_while_importing: Whether to raise value errors during imports (default: True).

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.4.tar.gz (737.2 kB view details)

Uploaded Source

Built Distribution

xtracto-0.0.4-py3-none-any.whl (764.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xtracto-0.0.4.tar.gz
  • Upload date:
  • Size: 737.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for xtracto-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1a9f31fe56053591a8ec7a1ddd7d5d8a331334644e4e44a0c770d73c57c18f16
MD5 6a809fa03f44d5c690a5433bbb4f296e
BLAKE2b-256 fce8d2dc07a39c5ea3f9b26fe95c2729788b2776f078df7e898bb357bfcebefe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xtracto-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 764.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for xtracto-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e84adb548c1d060ded2b4b2ccc0ebd31272c99b36f2118d3482e02a380b9e02a
MD5 64afe44e0d4b5b246809d69d708984bb
BLAKE2b-256 f11b1f01bf6feda643b32803a933b3d4db2f767c66ed6d2af0e7b7ccac5cb07d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page