velocity-previewer 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 VM Visualizer Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: velocity-previewer
3
+ Version: 1.1.0
4
+ Summary: A modern, feature-rich PyQt5 application for previewing and rendering Velocity templates with real-time syntax highlighting, validation, and export capabilities.
5
+ Author: Josh Simnitt
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/star7js/velocity-previewer
8
+ Project-URL: Repository, https://github.com/star7js/velocity-previewer
9
+ Project-URL: Documentation, https://github.com/star7js/velocity-previewer#readme
10
+ Project-URL: Issues, https://github.com/star7js/velocity-previewer/issues
11
+ Keywords: velocity,template,previewer,pyqt5,gui,syntax-highlighting
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Text Processing :: Markup :: HTML
23
+ Classifier: Topic :: Software Development :: User Interfaces
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: airspeed>=0.6.0
28
+ Requires-Dist: pyqt5>=5.15.11
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
31
+ Requires-Dist: black>=22.0.0; extra == "dev"
32
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
33
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
34
+ Requires-Dist: PyQt5-stubs>=5.15; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Velocity Template Previewer
38
+
39
+ [![CI](https://github.com/star7js/velocity-previewer/actions/workflows/ci.yml/badge.svg)](https://github.com/star7js/velocity-previewer/actions/workflows/ci.yml) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/) ![PyQt5](https://img.shields.io/badge/PyQt5-5.15+-41CD52?logo=qt&logoColor=white)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
42
+
43
+ Desktop application for previewing and rendering Apache Velocity templates with real-time syntax highlighting and validation. Perfect for developers working with Atlassian products (Jira, Confluence), ScriptRunner, email templates, and web applications.
44
+
45
+ ![Velocity Template Previewer](examples/example-template-render.png)
46
+
47
+ ## What is This?
48
+
49
+ Apache Velocity is a Java-based template engine commonly used in:
50
+ - **Atlassian Products**: Jira email templates, Confluence macros, ScriptRunner scripts
51
+ - **Email Systems**: Dynamic email generation
52
+ - **Web Applications**: Server-side templating
53
+ - **Code Generation**: Template-based code scaffolding
54
+
55
+ This tool lets you preview and test your Velocity templates instantly without deploying to production.
56
+
57
+ ## Features
58
+
59
+ - **Real-time Preview**: See changes as you type
60
+ - **Syntax Highlighting**: Color-coded templates and JSON data
61
+ - **Validation**: Catch errors before deployment
62
+ - **Background Rendering**: Smooth performance with large templates
63
+ - **Auto-save**: Never lose your work (saves every 30 seconds)
64
+ - **Export**: Generate static HTML from your templates
65
+ - **Dark Mode**: Easy on the eyes
66
+ - **Recent Files**: Quick access to your projects
67
+
68
+ ## Installation
69
+
70
+ **Requirements:** Python 3.9+ (Windows, macOS, Linux)
71
+
72
+ ```bash
73
+ git clone https://github.com/star7js/velocity-previewer.git
74
+ cd velocity-previewer
75
+ pip install -e .
76
+ velocity-previewer
77
+ ```
78
+
79
+ ## Quick Start
80
+
81
+ 1. **Open a template**: File > Open or Ctrl+O
82
+ 2. **Add your data**: Switch to Data tab, paste JSON
83
+ 3. **Render**: Press F5
84
+ 4. **Export** (optional): File > Export to HTML
85
+
86
+ Try the included `examples/example-template.vm` with `examples/example-data.json` to see it in action.
87
+
88
+ ## Use Cases
89
+
90
+ ### Atlassian/ScriptRunner Development
91
+ Test Jira email notifications, Confluence macros, or ScriptRunner templates locally before deploying:
92
+
93
+ ```velocity
94
+ #if($issue.priority.name == "Critical")
95
+ <span style="color: red;">$issue.key - $issue.summary</span>
96
+ #end
97
+ ```
98
+
99
+ ### Email Template Design
100
+ Preview dynamic email templates with test data:
101
+
102
+ ```velocity
103
+ Hello $customer.name,
104
+
105
+ Your order #$order.id has shipped!
106
+ #foreach($item in $order.items)
107
+ - $item.name (Qty: $item.quantity)
108
+ #end
109
+ ```
110
+
111
+ ### Dynamic Reports
112
+ Generate reports from JSON data without manual formatting.
113
+
114
+ ## Keyboard Shortcuts
115
+
116
+ | Action | Shortcut |
117
+ |--------|----------|
118
+ | Render Template | F5 |
119
+ | Open Template | Ctrl+O |
120
+ | Save Template | Ctrl+S |
121
+ | Validate Template | Ctrl+Shift+V |
122
+ | Validate Data | Ctrl+Shift+D |
123
+
124
+ ## Supported Velocity Syntax
125
+
126
+ - **Variables**: `$variable`, `${variable}`
127
+ - **Directives**: `#if`, `#foreach`, `#set`, `#macro`
128
+ - **Comments**: `##` (single line), `#* ... *#` (multi-line)
129
+ - **Properties**: `$object.property`, `$array[0]`
130
+ - **Methods**: `$string.substring(0, 5)`
131
+
132
+ Full Apache Velocity specification supported via Airspeed engine.
133
+
134
+ ## Platform Support
135
+
136
+ - ✅ Windows 10/11
137
+ - ✅ macOS 10.15+
138
+ - ✅ Linux (Ubuntu, Fedora, Arch)
139
+
140
+ ## Development
141
+
142
+ ```bash
143
+ # Install dependencies
144
+ pip install -e .
145
+
146
+ # Run tests
147
+ pytest
148
+
149
+ # Type check
150
+ mypy src/
151
+
152
+ # Project structure
153
+ ├── src/velocity_previewer/ # Main package
154
+ │ ├── main.py # Application UI and logic
155
+ │ ├── renderer.py # Background rendering & context building
156
+ │ ├── styles.py # Light/dark Qt stylesheets
157
+ │ ├── utils.py # Template processing
158
+ │ └── syntax_highlighters.py # Syntax highlighting
159
+ ├── examples/ # Example templates and data
160
+ ├── tests/ # Test files
161
+ └── pyproject.toml # Project configuration
162
+ ```
163
+
164
+ Settings (window size, recent files) are saved to:
165
+ - **Windows**: `%APPDATA%/VelocityPreviewer`
166
+ - **macOS**: `~/Library/Application Support/VelocityPreviewer`
167
+ - **Linux**: `~/.config/VelocityPreviewer`
168
+
169
+ ## Troubleshooting
170
+
171
+ | Issue | Solution |
172
+ |-------|----------|
173
+ | Template won't render | Use `Tools > Validate Template` (Ctrl+Shift+V) to see errors |
174
+ | JSON parse errors | Use `Tools > Validate Data` (Ctrl+Shift+D) to check format |
175
+ | Slow performance | Large templates render in background automatically |
176
+ | App won't start | Ensure PyQt5 is installed: `pip install PyQt5` |
177
+
178
+ ## Roadmap
179
+
180
+ - [ ] Live preview mode (render on every keystroke)
181
+ - [ ] Multiple data sets for testing
182
+ - [ ] Template snippet library
183
+ - [ ] Velocity macro autocomplete
184
+
185
+ ## License
186
+
187
+ MIT License
188
+
189
+ ## Built With
190
+
191
+ - [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) - Cross-platform UI framework
192
+ - [Airspeed](https://github.com/purcell/airspeed) - Python implementation of Apache Velocity
@@ -0,0 +1,156 @@
1
+ # Velocity Template Previewer
2
+
3
+ [![CI](https://github.com/star7js/velocity-previewer/actions/workflows/ci.yml/badge.svg)](https://github.com/star7js/velocity-previewer/actions/workflows/ci.yml) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/) ![PyQt5](https://img.shields.io/badge/PyQt5-5.15+-41CD52?logo=qt&logoColor=white)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
6
+
7
+ Desktop application for previewing and rendering Apache Velocity templates with real-time syntax highlighting and validation. Perfect for developers working with Atlassian products (Jira, Confluence), ScriptRunner, email templates, and web applications.
8
+
9
+ ![Velocity Template Previewer](examples/example-template-render.png)
10
+
11
+ ## What is This?
12
+
13
+ Apache Velocity is a Java-based template engine commonly used in:
14
+ - **Atlassian Products**: Jira email templates, Confluence macros, ScriptRunner scripts
15
+ - **Email Systems**: Dynamic email generation
16
+ - **Web Applications**: Server-side templating
17
+ - **Code Generation**: Template-based code scaffolding
18
+
19
+ This tool lets you preview and test your Velocity templates instantly without deploying to production.
20
+
21
+ ## Features
22
+
23
+ - **Real-time Preview**: See changes as you type
24
+ - **Syntax Highlighting**: Color-coded templates and JSON data
25
+ - **Validation**: Catch errors before deployment
26
+ - **Background Rendering**: Smooth performance with large templates
27
+ - **Auto-save**: Never lose your work (saves every 30 seconds)
28
+ - **Export**: Generate static HTML from your templates
29
+ - **Dark Mode**: Easy on the eyes
30
+ - **Recent Files**: Quick access to your projects
31
+
32
+ ## Installation
33
+
34
+ **Requirements:** Python 3.9+ (Windows, macOS, Linux)
35
+
36
+ ```bash
37
+ git clone https://github.com/star7js/velocity-previewer.git
38
+ cd velocity-previewer
39
+ pip install -e .
40
+ velocity-previewer
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ 1. **Open a template**: File > Open or Ctrl+O
46
+ 2. **Add your data**: Switch to Data tab, paste JSON
47
+ 3. **Render**: Press F5
48
+ 4. **Export** (optional): File > Export to HTML
49
+
50
+ Try the included `examples/example-template.vm` with `examples/example-data.json` to see it in action.
51
+
52
+ ## Use Cases
53
+
54
+ ### Atlassian/ScriptRunner Development
55
+ Test Jira email notifications, Confluence macros, or ScriptRunner templates locally before deploying:
56
+
57
+ ```velocity
58
+ #if($issue.priority.name == "Critical")
59
+ <span style="color: red;">$issue.key - $issue.summary</span>
60
+ #end
61
+ ```
62
+
63
+ ### Email Template Design
64
+ Preview dynamic email templates with test data:
65
+
66
+ ```velocity
67
+ Hello $customer.name,
68
+
69
+ Your order #$order.id has shipped!
70
+ #foreach($item in $order.items)
71
+ - $item.name (Qty: $item.quantity)
72
+ #end
73
+ ```
74
+
75
+ ### Dynamic Reports
76
+ Generate reports from JSON data without manual formatting.
77
+
78
+ ## Keyboard Shortcuts
79
+
80
+ | Action | Shortcut |
81
+ |--------|----------|
82
+ | Render Template | F5 |
83
+ | Open Template | Ctrl+O |
84
+ | Save Template | Ctrl+S |
85
+ | Validate Template | Ctrl+Shift+V |
86
+ | Validate Data | Ctrl+Shift+D |
87
+
88
+ ## Supported Velocity Syntax
89
+
90
+ - **Variables**: `$variable`, `${variable}`
91
+ - **Directives**: `#if`, `#foreach`, `#set`, `#macro`
92
+ - **Comments**: `##` (single line), `#* ... *#` (multi-line)
93
+ - **Properties**: `$object.property`, `$array[0]`
94
+ - **Methods**: `$string.substring(0, 5)`
95
+
96
+ Full Apache Velocity specification supported via Airspeed engine.
97
+
98
+ ## Platform Support
99
+
100
+ - ✅ Windows 10/11
101
+ - ✅ macOS 10.15+
102
+ - ✅ Linux (Ubuntu, Fedora, Arch)
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ # Install dependencies
108
+ pip install -e .
109
+
110
+ # Run tests
111
+ pytest
112
+
113
+ # Type check
114
+ mypy src/
115
+
116
+ # Project structure
117
+ ├── src/velocity_previewer/ # Main package
118
+ │ ├── main.py # Application UI and logic
119
+ │ ├── renderer.py # Background rendering & context building
120
+ │ ├── styles.py # Light/dark Qt stylesheets
121
+ │ ├── utils.py # Template processing
122
+ │ └── syntax_highlighters.py # Syntax highlighting
123
+ ├── examples/ # Example templates and data
124
+ ├── tests/ # Test files
125
+ └── pyproject.toml # Project configuration
126
+ ```
127
+
128
+ Settings (window size, recent files) are saved to:
129
+ - **Windows**: `%APPDATA%/VelocityPreviewer`
130
+ - **macOS**: `~/Library/Application Support/VelocityPreviewer`
131
+ - **Linux**: `~/.config/VelocityPreviewer`
132
+
133
+ ## Troubleshooting
134
+
135
+ | Issue | Solution |
136
+ |-------|----------|
137
+ | Template won't render | Use `Tools > Validate Template` (Ctrl+Shift+V) to see errors |
138
+ | JSON parse errors | Use `Tools > Validate Data` (Ctrl+Shift+D) to check format |
139
+ | Slow performance | Large templates render in background automatically |
140
+ | App won't start | Ensure PyQt5 is installed: `pip install PyQt5` |
141
+
142
+ ## Roadmap
143
+
144
+ - [ ] Live preview mode (render on every keystroke)
145
+ - [ ] Multiple data sets for testing
146
+ - [ ] Template snippet library
147
+ - [ ] Velocity macro autocomplete
148
+
149
+ ## License
150
+
151
+ MIT License
152
+
153
+ ## Built With
154
+
155
+ - [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) - Cross-platform UI framework
156
+ - [Airspeed](https://github.com/purcell/airspeed) - Python implementation of Apache Velocity
@@ -0,0 +1,105 @@
1
+ [project]
2
+ name = "velocity-previewer"
3
+ version = "1.1.0"
4
+ description = "A modern, feature-rich PyQt5 application for previewing and rendering Velocity templates with real-time syntax highlighting, validation, and export capabilities."
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ license = {text = "MIT"}
8
+ authors = [
9
+ {name = "Josh Simnitt"}
10
+ ]
11
+ keywords = ["velocity", "template", "previewer", "pyqt5", "gui", "syntax-highlighting"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Topic :: Software Development :: Libraries :: Python Modules",
23
+ "Topic :: Text Processing :: Markup :: HTML",
24
+ "Topic :: Software Development :: User Interfaces",
25
+ ]
26
+ dependencies = [
27
+ "airspeed>=0.6.0",
28
+ "pyqt5>=5.15.11",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=7.0.0",
34
+ "black>=22.0.0",
35
+ "flake8>=5.0.0",
36
+ "mypy>=1.0.0",
37
+ "PyQt5-stubs>=5.15",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/star7js/velocity-previewer"
42
+ Repository = "https://github.com/star7js/velocity-previewer"
43
+ Documentation = "https://github.com/star7js/velocity-previewer#readme"
44
+ Issues = "https://github.com/star7js/velocity-previewer/issues"
45
+
46
+ [project.scripts]
47
+ velocity-previewer = "velocity_previewer.main:main"
48
+
49
+ [build-system]
50
+ requires = ["setuptools>=61.0", "wheel"]
51
+ build-backend = "setuptools.build_meta"
52
+
53
+ [tool.setuptools.packages.find]
54
+ where = ["src"]
55
+ include = ["velocity_previewer*"]
56
+ exclude = ["tests*", "docs*"]
57
+
58
+ [tool.black]
59
+ line-length = 88
60
+ target-version = ['py39']
61
+ include = '\.pyi?$'
62
+ extend-exclude = '''
63
+ /(
64
+ # directories
65
+ \.eggs
66
+ | \.git
67
+ | \.hg
68
+ | \.mypy_cache
69
+ | \.tox
70
+ | \.venv
71
+ | build
72
+ | dist
73
+ )/
74
+ '''
75
+
76
+ [tool.mypy]
77
+ python_version = "3.9"
78
+ warn_return_any = true
79
+ warn_unused_configs = true
80
+ disallow_untyped_defs = true
81
+ disallow_incomplete_defs = true
82
+ check_untyped_defs = true
83
+ disallow_untyped_decorators = true
84
+ no_implicit_optional = true
85
+ warn_redundant_casts = true
86
+ warn_unused_ignores = true
87
+ warn_no_return = true
88
+ warn_unreachable = true
89
+ strict_equality = true
90
+
91
+ [[tool.mypy.overrides]]
92
+ module = "airspeed.*"
93
+ ignore_missing_imports = true
94
+
95
+ [[tool.mypy.overrides]]
96
+ module = "velocity_previewer.main"
97
+ disallow_untyped_defs = false
98
+ disallow_incomplete_defs = false
99
+
100
+ [tool.pytest.ini_options]
101
+ testpaths = ["tests"]
102
+ python_files = ["test_*.py"]
103
+ python_classes = ["Test*"]
104
+ python_functions = ["test_*"]
105
+ addopts = "-v --tb=short"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """Velocity template previewer with syntax highlighting."""
2
+
3
+ from .main import VelocityTemplatePreviewer, main
4
+ from .utils import APP_VERSION
5
+
6
+ __version__ = APP_VERSION
7
+ __all__ = ["VelocityTemplatePreviewer", "main"]