<div align="center">
<img src="Logo.png" alt="gtext Logo" width="200"/>
# ðŠ gtext
**The text wizard** - Transform text files with pluggable extensions.
</div>
[](https://badge.fury.io/py/gtext)
[](https://github.com/genropy/gtext/actions/workflows/test.yml)
[](https://codecov.io/gh/genropy/gtext)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://gtext.readthedocs.io/)
---
## âĻ What is gtext?
gtext is a **universal text processor** with a pluggable extension system. Transform any text file through customizable plugins:
- ð **Include files** (static, dynamic, glob patterns)
- ðĪ **AI processing** (summarization, translation)
- ðŧ **Code generation** (headers, boilerplate)
- â
**Validation** (links, spelling)
- ð **And much more...**
Created by the **Genro Team**. Universal and standalone.
---
## ð Quick Start
### Installation
```bash
pip install gtext
```
### Basic Usage
#### File Extension Convention
gtext uses the **`.gtext` extension** to identify source files:
```bash
# Double extension (auto-detect output format)
document.md.gtext â document.md
script.py.gtext â script.py
config.yaml.gtext â config.yaml
```
#### Example
**Source file (`report.md.gtext`):**
````markdown
# Monthly Report
## Company Stats
```include
cli: python scripts/get_stats.py --format markdown
```
## Team Structure
```include
docs/team-structure.md
```
## All Project Docs
```include
glob: projects/**/README.md
```
````
**Generate expanded document:**
```bash
# Auto-detect output (strip .gtext extension)
gtext render report.md.gtext
# Or specify output file/directory
gtext render report.md.gtext report.md
gtext render report.md.gtext output/
# Process multiple files or patterns
gtext render "docs/**/*.gtext" output/
```
**Re-render after changes (using saved metadata):**
```bash
# Modify report.md.gtext, then refresh
gtext refresh report.md.gtext
# Or refresh all .gtext files with saved outputs
gtext refresh
```
**Result (`report.md`):**
```markdown
# Monthly Report
## Company Stats
| Metric | Value |
|--------|-------|
| Revenue | $1.2M |
| Users | 10,453 |
## Team Structure
[content from docs/team-structure.md]
## All Project Docs
[all README.md files from projects/**/]
```
> **ð New in v0.2.0**: The `render` command now intelligently handles single files, multiple files, and patterns. The old `cast` and `cast-all` commands are deprecated (but still work) and will be removed in v0.3.0.
---
## ð Learning with Interactive Tutorials
The best way to learn gtext is through our **hands-on Jupyter notebooks**.
### Run Online (No Installation Required)
[](https://mybinder.org/v2/gh/genropy/gtext/main?filepath=notebooks)
Click the badge above to launch an interactive Jupyter environment in your browser. Ready in ~2 minutes!
### Run Locally
```bash
# 1. Install Jupyter
pip install jupyter notebook
# 2. Navigate to notebooks directory
cd notebooks
# 3. Launch Jupyter
jupyter notebook
# 4. Open 01_rag_prompt_engineering.ipynb and start learning!
```
### Tutorial Contents
| Notebook | Topic | Duration | Level |
|----------|-------|----------|-------|
| 01 - RAG & Prompt Engineering | AI/LLM integration, composable prompts | 30 min | Intermediate |
More tutorials coming soon! See [notebooks/README.md](notebooks/README.md) for the complete learning guide.
---
## ðŊ Key Features
### 1. Include Static Files
```markdown
```include
path/to/file.md
```
```
### 2. Include Command Output
```markdown
```include
cli: genro project list --format markdown
```
```
### 3. Include Multiple Files with Glob
```markdown
```include
glob: docs/**/*.md
```
```
### 4. Mix All Types
```markdown
```include
header.md
cli: python get_stats.py
glob: sections/*.md
footer.md
```
```
---
## ð Use Cases
### Documentation
- **Living docs** that update from real data
- **Multi-file documentation** aggregation
- **Auto-generated API docs** from code
### Code Management
- **License headers** across codebase
- **Boilerplate injection**
- **Shared imports** and configs
### Reporting
- **Dynamic reports** with live database queries
- **System monitoring** snapshots
- **Business dashboards** in Markdown
### Content Management
- **Blog post templates** with includes
- **Multi-language content**
- **Reusable content blocks**
---
## ð ïļ CLI Commands
```bash
# Expand single file (auto-detect output)
gtext cast document.md.gtext
# Explicit output path
gtext cast document.md.gtext -o output.md
# Expand all .gtext files in directory
gtext cast-all docs/**/*.gtext
# Watch mode (auto-regenerate on changes)
gtext watch docs/**/*.gtext
# Dry run (preview without writing)
gtext cast document.md.gtext --dry-run
```
---
## ð Plugin System
gtext is built on a **pluggable architecture**. Extensions are easy to create:
```python
from gtext.extensions import BaseExtension
class MyExtension(BaseExtension):
name = "my-plugin"
def process(self, content: str, context: dict) -> str:
# Your transformation logic
return transformed_content
```
**Built-in extensions:**
- `include` - Include static files
- `include-cli` - Include command output
- `include-glob` - Include files matching patterns
**Future extensions:**
- `ai-summarize` - AI-powered summarization
- `ai-translate` - Multi-language translation
- `validate-links` - Check for broken links
- `generate-toc` - Auto table of contents
- And more...
---
## ð Documentation
Full documentation available at: **[gtext.readthedocs.io](https://gtext.readthedocs.io/)**
- [Installation](https://gtext.readthedocs.io/en/latest/installation/)
- [Quick Start](https://gtext.readthedocs.io/en/latest/quickstart/)
- [Extensions Guide](https://gtext.readthedocs.io/en/latest/extensions/)
- [API Reference](https://gtext.readthedocs.io/en/latest/api/)
- [Examples](https://gtext.readthedocs.io/en/latest/examples/)
---
## ðĪ Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
---
## ð License
MIT License - see [LICENSE](LICENSE) for details.
---
## ð About
**gtext** is created by **Giovanni Porcari** with contributions from the Genro Team.
Like a weaverbird ðŠķ that masterfully weaves materials together, gtext weaves different content sources into unified documents.
gtext is:
- â
**Standalone** - No dependencies on other frameworks
- â
**Universal** - Works with any text format
- â
**Open** - MIT licensed and community-driven
---
## ð Links
- **GitHub**: [github.com/genropy/gtext](https://github.com/genropy/gtext)
- **PyPI**: [pypi.org/project/gtext](https://pypi.org/project/gtext)
- **Documentation**: [gtext.readthedocs.io](https://gtext.readthedocs.io/)
- **Issues**: [github.com/genropy/gtext/issues](https://github.com/genropy/gtext/issues)
- **Genro Project**: [github.com/genropy/genro-next-generation](https://github.com/genropy/genro-next-generation)
---
**Made with âĻ by the Genro Team**
Raw data
{
"_id": null,
"home_page": null,
"name": "gtext",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "text, processor, markdown, documentation, plugins, extensions",
"author": "Genro Team",
"author_email": "Giovanni Porcari <giovanni.porcari@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/36/ba/4969909a184c1dd47c07d31a4ef464820cf3ed5679b027e9ed6b9caab262/gtext-0.2.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n<img src=\"Logo.png\" alt=\"gtext Logo\" width=\"200\"/>\n\n# \ud83e\ude84 gtext\n\n**The text wizard** - Transform text files with pluggable extensions.\n\n</div>\n\n[](https://badge.fury.io/py/gtext)\n[](https://github.com/genropy/gtext/actions/workflows/test.yml)\n[](https://codecov.io/gh/genropy/gtext)\n[](https://www.python.org/downloads/)\n[](https://opensource.org/licenses/MIT)\n[](https://gtext.readthedocs.io/)\n\n---\n\n## \u2728 What is gtext?\n\ngtext is a **universal text processor** with a pluggable extension system. Transform any text file through customizable plugins:\n\n- \ud83d\udcdd **Include files** (static, dynamic, glob patterns)\n- \ud83e\udd16 **AI processing** (summarization, translation)\n- \ud83d\udcbb **Code generation** (headers, boilerplate)\n- \u2705 **Validation** (links, spelling)\n- \ud83d\udd04 **And much more...**\n\nCreated by the **Genro Team**. Universal and standalone.\n\n---\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install gtext\n```\n\n### Basic Usage\n\n#### File Extension Convention\n\ngtext uses the **`.gtext` extension** to identify source files:\n\n```bash\n# Double extension (auto-detect output format)\ndocument.md.gtext \u2192 document.md\nscript.py.gtext \u2192 script.py\nconfig.yaml.gtext \u2192 config.yaml\n```\n\n#### Example\n\n**Source file (`report.md.gtext`):**\n\n````markdown\n# Monthly Report\n\n## Company Stats\n\n```include\ncli: python scripts/get_stats.py --format markdown\n```\n\n## Team Structure\n\n```include\ndocs/team-structure.md\n```\n\n## All Project Docs\n\n```include\nglob: projects/**/README.md\n```\n````\n\n**Generate expanded document:**\n\n```bash\n# Auto-detect output (strip .gtext extension)\ngtext render report.md.gtext\n\n# Or specify output file/directory\ngtext render report.md.gtext report.md\ngtext render report.md.gtext output/\n\n# Process multiple files or patterns\ngtext render \"docs/**/*.gtext\" output/\n```\n\n**Re-render after changes (using saved metadata):**\n\n```bash\n# Modify report.md.gtext, then refresh\ngtext refresh report.md.gtext\n\n# Or refresh all .gtext files with saved outputs\ngtext refresh\n```\n\n**Result (`report.md`):**\n\n```markdown\n# Monthly Report\n\n## Company Stats\n\n| Metric | Value |\n|--------|-------|\n| Revenue | $1.2M |\n| Users | 10,453 |\n\n## Team Structure\n\n[content from docs/team-structure.md]\n\n## All Project Docs\n\n[all README.md files from projects/**/]\n```\n\n> **\ud83c\udd95 New in v0.2.0**: The `render` command now intelligently handles single files, multiple files, and patterns. The old `cast` and `cast-all` commands are deprecated (but still work) and will be removed in v0.3.0.\n\n---\n\n## \ud83d\udcd3 Learning with Interactive Tutorials\n\nThe best way to learn gtext is through our **hands-on Jupyter notebooks**.\n\n### Run Online (No Installation Required)\n\n[](https://mybinder.org/v2/gh/genropy/gtext/main?filepath=notebooks)\n\nClick the badge above to launch an interactive Jupyter environment in your browser. Ready in ~2 minutes!\n\n### Run Locally\n\n```bash\n# 1. Install Jupyter\npip install jupyter notebook\n\n# 2. Navigate to notebooks directory\ncd notebooks\n\n# 3. Launch Jupyter\njupyter notebook\n\n# 4. Open 01_rag_prompt_engineering.ipynb and start learning!\n```\n\n### Tutorial Contents\n\n| Notebook | Topic | Duration | Level |\n|----------|-------|----------|-------|\n| 01 - RAG & Prompt Engineering | AI/LLM integration, composable prompts | 30 min | Intermediate |\n\nMore tutorials coming soon! See [notebooks/README.md](notebooks/README.md) for the complete learning guide.\n\n---\n\n## \ud83c\udfaf Key Features\n\n### 1. Include Static Files\n\n```markdown\n```include\npath/to/file.md\n```\n```\n\n### 2. Include Command Output\n\n```markdown\n```include\ncli: genro project list --format markdown\n```\n```\n\n### 3. Include Multiple Files with Glob\n\n```markdown\n```include\nglob: docs/**/*.md\n```\n```\n\n### 4. Mix All Types\n\n```markdown\n```include\nheader.md\ncli: python get_stats.py\nglob: sections/*.md\nfooter.md\n```\n```\n\n---\n\n## \ud83d\udcda Use Cases\n\n### Documentation\n\n- **Living docs** that update from real data\n- **Multi-file documentation** aggregation\n- **Auto-generated API docs** from code\n\n### Code Management\n\n- **License headers** across codebase\n- **Boilerplate injection**\n- **Shared imports** and configs\n\n### Reporting\n\n- **Dynamic reports** with live database queries\n- **System monitoring** snapshots\n- **Business dashboards** in Markdown\n\n### Content Management\n\n- **Blog post templates** with includes\n- **Multi-language content**\n- **Reusable content blocks**\n\n---\n\n## \ud83d\udee0\ufe0f CLI Commands\n\n```bash\n# Expand single file (auto-detect output)\ngtext cast document.md.gtext\n\n# Explicit output path\ngtext cast document.md.gtext -o output.md\n\n# Expand all .gtext files in directory\ngtext cast-all docs/**/*.gtext\n\n# Watch mode (auto-regenerate on changes)\ngtext watch docs/**/*.gtext\n\n# Dry run (preview without writing)\ngtext cast document.md.gtext --dry-run\n```\n\n---\n\n## \ud83d\udd0c Plugin System\n\ngtext is built on a **pluggable architecture**. Extensions are easy to create:\n\n```python\nfrom gtext.extensions import BaseExtension\n\nclass MyExtension(BaseExtension):\n name = \"my-plugin\"\n\n def process(self, content: str, context: dict) -> str:\n # Your transformation logic\n return transformed_content\n```\n\n**Built-in extensions:**\n- `include` - Include static files\n- `include-cli` - Include command output\n- `include-glob` - Include files matching patterns\n\n**Future extensions:**\n- `ai-summarize` - AI-powered summarization\n- `ai-translate` - Multi-language translation\n- `validate-links` - Check for broken links\n- `generate-toc` - Auto table of contents\n- And more...\n\n---\n\n## \ud83d\udcd6 Documentation\n\nFull documentation available at: **[gtext.readthedocs.io](https://gtext.readthedocs.io/)**\n\n- [Installation](https://gtext.readthedocs.io/en/latest/installation/)\n- [Quick Start](https://gtext.readthedocs.io/en/latest/quickstart/)\n- [Extensions Guide](https://gtext.readthedocs.io/en/latest/extensions/)\n- [API Reference](https://gtext.readthedocs.io/en/latest/api/)\n- [Examples](https://gtext.readthedocs.io/en/latest/examples/)\n\n---\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n---\n\n## \ud83d\udcdc License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n## \ud83c\udf1f About\n\n**gtext** is created by **Giovanni Porcari** with contributions from the Genro Team.\n\nLike a weaverbird \ud83e\udeb6 that masterfully weaves materials together, gtext weaves different content sources into unified documents.\n\ngtext is:\n- \u2705 **Standalone** - No dependencies on other frameworks\n- \u2705 **Universal** - Works with any text format\n- \u2705 **Open** - MIT licensed and community-driven\n\n---\n\n## \ud83d\udd17 Links\n\n- **GitHub**: [github.com/genropy/gtext](https://github.com/genropy/gtext)\n- **PyPI**: [pypi.org/project/gtext](https://pypi.org/project/gtext)\n- **Documentation**: [gtext.readthedocs.io](https://gtext.readthedocs.io/)\n- **Issues**: [github.com/genropy/gtext/issues](https://github.com/genropy/gtext/issues)\n- **Genro Project**: [github.com/genropy/genro-next-generation](https://github.com/genropy/genro-next-generation)\n\n---\n\n**Made with \u2728 by the Genro Team**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The text wizard - Transform text files with pluggable extensions",
"version": "0.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/genropy/gtext/issues",
"Documentation": "https://gtext.readthedocs.io",
"Homepage": "https://github.com/genropy/gtext",
"Repository": "https://github.com/genropy/gtext"
},
"split_keywords": [
"text",
" processor",
" markdown",
" documentation",
" plugins",
" extensions"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "16f085baff2ef52cb8e4bca3987703a20305bed5642af54f023d179823ffba41",
"md5": "d2663b53990441ec55ca2295d0635b9b",
"sha256": "4243609333ade5ee7c0ed8f3f2318964cda9f179b4b3cc2a296c1fcacdf0f7b7"
},
"downloads": -1,
"filename": "gtext-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d2663b53990441ec55ca2295d0635b9b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 20584,
"upload_time": "2025-11-02T18:18:07",
"upload_time_iso_8601": "2025-11-02T18:18:07.457337Z",
"url": "https://files.pythonhosted.org/packages/16/f0/85baff2ef52cb8e4bca3987703a20305bed5642af54f023d179823ffba41/gtext-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "36ba4969909a184c1dd47c07d31a4ef464820cf3ed5679b027e9ed6b9caab262",
"md5": "25975a5951129c1622891d8c296c1828",
"sha256": "2880f316f3d7c7636060c08afefd4fba5f200e167866aa2d9a2ced80592d5c7c"
},
"downloads": -1,
"filename": "gtext-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "25975a5951129c1622891d8c296c1828",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 23813,
"upload_time": "2025-11-02T18:18:09",
"upload_time_iso_8601": "2025-11-02T18:18:09.582676Z",
"url": "https://files.pythonhosted.org/packages/36/ba/4969909a184c1dd47c07d31a4ef464820cf3ed5679b027e9ed6b9caab262/gtext-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-02 18:18:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "genropy",
"github_project": "gtext",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": null,
"specs": []
},
{
"name": "jupyter",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "notebook",
"specs": [
[
">=",
"6.5.0"
]
]
}
],
"lcname": "gtext"
}