Daxa: The Ultimate Data Storage Language & Virtual File System (Python Implementation)
This repository contains the Python implementation of Daxa, a powerful data storage language designed for flexibility, human-readability, and efficient data representation. This version also introduces DexFS, a virtual file system built on top of Daxa, allowing structured data and arbitrary file content to be organized within Daxa files.
Crafted with ❤️ by Lion (@lionxlover). Connect with me: Telegram | Instagram
- Rich Type System: Supports primitives (integers, floats, bool, string, bytes, datetime, UUID), structs, enums, arrays, maps, and an
anytype for maximum flexibility. - Schema Definition: Define data structures with a clear, concise Daxa schema syntax.
- Field constraints:
@minLength,@maxLength,@minValue,@maxValue,@pattern. - Type aliasing for cleaner schemas.
- Optional fields and default values.
- Field constraints:
- Text Format (
.daxa): Human-readable and editable.- Clear separation of schema and data blocks.
- Support for comments and simple attributes.
- Binary Format (
.dax): Stubbed for future high-performance, compact storage (serialization logic to be fully implemented).- Conceptual support for compression (Zstd, LZ4) and encryption (AES-256-GCM).
- Diagramming Capabilities:
- Embed diagram definitions directly within Daxa files.
- Support for
source_dsl(e.g., Mermaid, Graphviz DOT) andstructured_datafor diagrams. - Renderers for Graphviz and Mermaid (via Pyppeteer).
- DexFS - Daxa Virtual File System:
- Store hierarchical file and directory structures within a Daxa dataset.
- Files in DexFS can hold any
DaxaValueas their payload (text, binary, complex Daxa structs). - POSIX-like metadata (permissions, timestamps, owner - simplified).
- API and CLI for VFS operations (ls, mkdir, cat, put, rm, mv, stat).
- Command-Line Interface (CLI):
daxa info: Display summary of Daxa files.daxa validate: Validate data against schema.daxa convert: Convert between Daxa text and (eventually) binary formats, and to/from other formats (JSON, YAML).daxa diagram render: Render embedded diagrams to various output formats (SVG, PNG).daxa fs ...: A suite of commands to interact with DexFS instances.- (Planned:
daxa query,daxa schema export)
- Graphical User Interface (GUI):
- Built with PyQt6 for a modern, cross-platform experience.
- Schema Explorer: Navigate struct, enum, and type alias definitions.
- Data Viewer: Inspect top-level datasets (raw text, JSON-like tree for complex data).
- Diagram Viewer: Display rendered diagrams.
- DexFS Browser: Navigate and manage files/directories within DexFS instances.
- Property Editor: View details of selected schema items, data entries, or FS nodes.
- Console Output: For logs, validation errors, and messages.
- Theming support (basic light/dark themes via QSS).
- Background threading for responsive UI during file loading and other long operations.
- Application preferences and window state persistence.
- Database Utilities (Conceptual):
- Stubs for mapping Daxa schemas to SQL DDL or ORM models.
- Stubs for exporting Daxa data to database-friendly formats.
(A brief overview of the tree view from the previous prompt, focusing on daxa/core, daxa/fs, daxa/cli, daxa/gui)
daxa_python/
├── daxa/ # Main Daxa package
│ ├── core/ # Language core (parser, schema, value, validator, writers)
│ ├── fs/ # DexFS virtual file system logic
│ ├── cli/ # Command-line interface
│ ├── gui/ # Graphical user interface
│ ├── renderers/ # Diagram rendering engines
│ ├── db_utils/ # Database utilities (stubs)
│ └── ...
├── assets/ # Icons, logos, stylesheets
├── examples/ # Example .daxa files
├── tests/ # Unit and integration tests
└── ...
- Python 3.9+
- Graphviz (for diagram rendering - install system-wide:
apt-get install graphvizorbrew install graphviz) - A Chromium-based browser (for Mermaid rendering via Pyppeteer, will be downloaded by Pyppeteer if not found/configured).
-
Clone the repository:
git clone https://github.com/lionxlover/daxa_python.git # Replace with your actual repo URL cd daxa_python
-
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install Daxa in editable mode: This makes the
daxaCLI anddaxa-guiscripts available in your environment.pip install -e .
Show help:
daxa --help
daxa fs --helpInspect a Daxa file:
daxa info examples/my_virtual_fs.daxaValidate a Daxa file:
daxa validate examples/my_virtual_fs.daxaRender a diagram from a Daxa file:
# Assuming simple_diagram.daxa has a diagram dataset named 'my_flow'
daxa diagram render examples/simple_diagram.daxa my_flow -o output_flow.svgDexFS CLI Examples:
Initialize a new DexFS within new_fs.daxa under the dataset name main_fs:
daxa fs init new_fs.daxa::main_fs --label "My Main VFS" --saveList root of main_fs in new_fs.daxa:
daxa fs ls new_fs.daxa::main_fs::/Create a directory:
daxa fs mkdir new_fs.daxa::main_fs::/documents --savePut a local file into DexFS:
echo "Hello DexFS" > local_hello.txt
daxa fs put local_hello.txt new_fs.daxa::main_fs::/documents/hello.txt --type string --saveCat a file from DexFS:
daxa fs cat new_fs.daxa::main_fs::/documents/hello.txtRemove a file:
daxa fs rm new_fs.daxa::main_fs::/documents/hello.txt --saveLaunch the Daxa GUI:
daxa-guiOr, if the gui_scripts entry point isn't working (e.g., during development without full install):
python -m daxa.gui.main_windowThe GUI allows opening .daxa files, exploring their schema, viewing data, rendering diagrams, and browsing embedded DexFS instances.
- Type Checking:
mypy daxa/ tests/ - Linting/Formatting:
ruff check . && ruff format .(or your preferred tools like Black, Flake8) - Testing:
pytest
(Details on how to run tests would go here.)
This Python implementation is a comprehensive foundation. Future work could include:
- Full Binary Format Implementation: Complete serialization/deserialization for
.daxfiles. - Advanced Parser: Replace the regex/state-based text parser with a robust parser generator library (e.g., Lark) for better error handling, performance, and maintainability with complex Daxa syntax.
- Performance Optimization: For large file handling, parsing, and VFS operations.
- Enhanced DexFS Features:
- Permissions model refinement.
- Symbolic links.
- Efficient search/indexing within DexFS.
- Snapshotting capabilities.
- Schema Evolution/Migration Tools: For managing changes to Daxa schemas over time.
- Full Database Utility Implementation: Concrete DDL/ORM generation and data import/export tools.
- Daxa Language Server Protocol (LSP): For IDE integration (syntax highlighting, auto-completion, validation in editors like VS Code).
- Plugin System: Allow extending Daxa with custom renderers, validators, or data handlers.
- Web Interface/API: For accessing and managing Daxa data and DexFS instances over HTTP.
- Advanced GUI Features: True data editing, schema design tools, collaborative features (ambitious).
Contributions are welcome! If you're interested in contributing, please feel free to:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes.
- Add tests for your changes.
- Ensure all tests pass and linters/formatters are happy.
- Submit a pull request with a clear description of your changes.
(Consider adding a CONTRIBUTING.md file for more detailed guidelines).
Daxa Python Edition is licensed under the MIT License.
This project is a labor of love and an exploration into building a comprehensive data language and virtual file system. Your feedback and contributions are highly appreciated!
Lion (@lionxlover)
