A preprocessor for Python adding data modeling and structured programming
Project description
XSynth
A preprocessor for Python that adds data modeling and structured programming features.
Overview
XSynth transforms .xpy (XSynth Python) files into standard .py files, providing declarative data modeling and code generation capabilities without interfering with Python fundamentals.
Features
- Data Modeling: Define data structures with
#$ dictdeclarations - Structured Actions: Generate classes and methods with
#$ actiondeclarations - Template Substitution: Generate repetitive code patterns automatically
- Synthesis Tracking: SQLite database tracks modules, classes, and dependencies
- Two Modes: Stand-alone (minimal deps) or QuickDev integration (full features)
Installation
pip install xsynth
Or install in development mode:
pip install -e ./xsynth
XSynth requires qdbase which will be installed automatically.
Usage
Command Line
Process all .xpy files in a directory:
xsynth
Process specific files:
xsynth file1.xpy file2.xpy
Python API
from qdutils.xsynth import XSynth
# Create XSynth instance
synth = XSynth(
sources=['my_module.xpy'],
verbose=True
)
# Process files
synth.run()
XSynth File Format
XSynth files use the .xpy extension and contain special directives:
#$ dict UserData
#$ name: str
#$ email: str
#$ created: datetime
#$ action CreateUser
#$ params: UserData
#$ returns: User
These directives are processed by XSynth to generate Python code with proper class definitions, type hints, and boilerplate.
Modes
Stand-alone Mode
- Minimal dependencies (only
qdbase) - Processes
.xpyfiles in specified directories - Suitable for any Python project
QuickDev Mode
- Full integration with QuickDev framework
- Access to site configuration
- Enhanced code generation features
Part of QuickDev
XSynth is part of the QuickDev metaprogramming toolkit. Other packages include:
- qdbase - Foundation utilities (required dependency)
- qdflask - Flask authentication with role-based access control
- qdimages - Flask image management with hierarchical storage
License
MIT License - Copyright (C) Albert B. Margolis
Requirements
- Python >= 3.7
- qdbase >= 0.2.0
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 xsynth-0.3.0.tar.gz.
File metadata
- Download URL: xsynth-0.3.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
add6d977f422993bef145a192f9916f01c04a4546155698af032056bfbd402de
|
|
| MD5 |
36c62ff5618d6169af2655079989497f
|
|
| BLAKE2b-256 |
6d58ccf83a4a602f18262e661e4231318125424b6841a0ab5139440ae6aa70e0
|
File details
Details for the file xsynth-0.3.0-py3-none-any.whl.
File metadata
- Download URL: xsynth-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
544143008f162e6bb64d28d09f953cf3210f8879a9a14533b4ee9620e8eaecaa
|
|
| MD5 |
ae6c0925947611b36531efcc9963bc6d
|
|
| BLAKE2b-256 |
d48db6cef558c077e64d7151be98a3c3deb2b8e8c0e8753c0792dffb941b1b45
|