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
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
Built Distribution
File details
Details for the file xtracto-0.0.1.tar.gz
.
File metadata
- Download URL: xtracto-0.0.1.tar.gz
- Upload date:
- Size: 725.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d609220c8697debe1b0d1b8df5f7b847cf566d789d5528e7595a817ff6f7db7 |
|
MD5 | 0508e4a8d928a1fb82ce672c5af8c700 |
|
BLAKE2b-256 | 8f4d9317a00e3effc9cb8afb807b0f9d2ef3e7cda2422182b8ef012f1e3bf123 |
File details
Details for the file xtracto-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: xtracto-0.0.1-py3-none-any.whl
- Upload date:
- Size: 752.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037d0b0fbee90dd38d519a6604939cc524b4f43090e0e69fdbc7f01a0fccd602 |
|
MD5 | 40b6510b1ec83d866563884403811ee9 |
|
BLAKE2b-256 | b0b22283ef1ad1b592461404ea42ed278d65b28439eb8d3229f02d7adc40b91b |