wizard-codegen 0.1.7__tar.gz → 0.1.8__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.
Files changed (24) hide show
  1. wizard_codegen-0.1.7/README.md → wizard_codegen-0.1.8/PKG-INFO +88 -48
  2. wizard_codegen-0.1.7/PKG-INFO → wizard_codegen-0.1.8/README.md +73 -63
  3. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/proto/protoc_runner.py +5 -1
  4. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/pyproject.toml +2 -2
  5. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/utils/path.py +6 -2
  6. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/.gitignore +0 -0
  7. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/cli/__init__.py +0 -0
  8. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/cli/main.py +0 -0
  9. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/__init__.py +0 -0
  10. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/config.py +0 -0
  11. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/context_builder.py +0 -0
  12. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/filter.py +0 -0
  13. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/renderer.py +0 -0
  14. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/core/writer.py +0 -0
  15. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/hooks/__init__.py +0 -0
  16. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/hooks/hooks.py +0 -0
  17. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/proto/__init__.py +0 -0
  18. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/proto/discover.py +0 -0
  19. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/proto/fds_loader.py +0 -0
  20. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/proto/proto_source.py +0 -0
  21. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/tests/fixtures/hooks/__init__.py +0 -0
  22. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/tests/fixtures/hooks/type_mapping.py +0 -0
  23. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/utils/__init__.py +0 -0
  24. {wizard_codegen-0.1.7 → wizard_codegen-0.1.8}/utils/name.py +0 -0
@@ -1,3 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: wizard-codegen
3
+ Version: 0.1.8
4
+ Summary: A powerful, template-driven code generation tool for Protocol Buffers
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: click==8.3.1
7
+ Requires-Dist: jinja2==3.1.6
8
+ Requires-Dist: protobuf==6.33.2
9
+ Requires-Dist: pydantic-core==2.41.5
10
+ Requires-Dist: pydantic==2.12.5
11
+ Requires-Dist: pyyaml==6.0.3
12
+ Requires-Dist: rich==14.2.0
13
+ Requires-Dist: typer==0.21.0
14
+ Description-Content-Type: text/markdown
15
+
1
16
  # 🧙 Wizard Codegen
2
17
 
3
18
  [![CircleCI](https://dl.circleci.com/status-badge/img/gh/ConsultingMD/wizard-codegen/tree/main.svg?style=svg&circle-token=CCIPRJ_6cYihJ2CPYtLrt8VjrCcSV_f02bbbce30f122a85da4e93588e8887e973128fd)](https://dl.circleci.com/status-badge/redirect/gh/ConsultingMD/wizard-codegen/tree/main)
@@ -56,17 +71,48 @@ Wizard Codegen transforms your `.proto` definitions into typed code for multiple
56
71
 
57
72
  ## 🚀 Quick Start
58
73
 
74
+ ### 1. Install Prerequisites
75
+
76
+ **Protocol Buffer Compiler (protoc):**
77
+
59
78
  ```bash
60
- # 1. Clone and setup
61
- git clone <your-repo-url>
62
- cd wizard-codegen
63
- make deps
79
+ # macOS
80
+ brew install protobuf
81
+
82
+ # Ubuntu/Debian
83
+ sudo apt install -y protobuf-compiler
84
+
85
+ # Verify installation
86
+ protoc --version
87
+ ```
64
88
 
65
- # 2. Create your configuration
66
- cat > wizard/codegen.yaml << 'EOF'
89
+ **uv (Python package manager):**
90
+
91
+ ```bash
92
+ # macOS/Linux
93
+ curl -LsSf https://astral.sh/uv/install.sh | sh
94
+
95
+ # Or via Homebrew
96
+ brew install uv
97
+
98
+ # Verify installation
99
+ uv --version
100
+ ```
101
+
102
+ ### 2. Install Wizard Codegen
103
+
104
+ ```bash
105
+ uv tool install wizard-codegen
106
+ ```
107
+
108
+ ### 3. Create Configuration
109
+
110
+ Create `wizard/codegen.yaml` in your project:
111
+
112
+ ```yaml
67
113
  proto:
114
+ root: "path/to/your/protos" # Local path to proto files
68
115
  cache_dir: ".cache/protos"
69
- root: "path/to/your/protos"
70
116
  files:
71
117
  - "**/*.proto"
72
118
 
@@ -81,13 +127,19 @@ targets:
81
127
  all:
82
128
  - name: "*Form"
83
129
  output: "components/{{ item.name.kebab_case }}/index.tsx"
84
- EOF
130
+ ```
85
131
 
86
- # 3. Generate code
87
- uv run wizard-codegen generate
132
+ ### 4. Generate Code
88
133
 
89
- # Or with verbose output
90
- uv run wizard-codegen --verbose generate
134
+ ```bash
135
+ # Generate code
136
+ wizard-codegen generate
137
+
138
+ # Preview changes without writing files
139
+ wizard-codegen --dry-run generate
140
+
141
+ # Verbose output for debugging
142
+ wizard-codegen --verbose generate
91
143
  ```
92
144
 
93
145
  ---
@@ -96,64 +148,52 @@ uv run wizard-codegen --verbose generate
96
148
 
97
149
  ### Prerequisites
98
150
 
99
- - **Python 3.10+**
100
- - **[uv](https://docs.astral.sh/uv/)** — Fast Python package manager (installed via `ih-setup upgrade`)
101
- - **protoc** (Protocol Buffer Compiler) [Installation Guide](https://grpc.io/docs/protoc-installation/)
102
- - **Git** (for fetching proto sources from repositories)
151
+ | Requirement | Description | Installation |
152
+ |-------------|-------------|--------------|
153
+ | **Python 3.10+** | Runtime | [python.org](https://www.python.org/downloads/) |
154
+ | **uv** | Fast Python package manager | See Quick Start or [docs.astral.sh/uv](https://docs.astral.sh/uv/) |
155
+ | **protoc** | Protocol Buffer Compiler | See Quick Start or [grpc.io](https://grpc.io/docs/protoc-installation/) |
156
+ | **Git** | For fetching proto sources | Usually pre-installed |
103
157
 
104
- ### Install via uv tool (Recommended)
158
+ ### Install via uv (Recommended)
105
159
 
106
160
  ```bash
107
- # Install protobuf compiler
108
- brew install protobuf
109
-
110
- # Install wizard-codegen from public PyPI
111
161
  uv tool install wizard-codegen
112
162
  ```
113
163
 
114
- #### Upgrade
164
+ ### Upgrade
115
165
 
116
166
  ```bash
117
167
  uv tool upgrade wizard-codegen
118
168
  ```
119
169
 
120
- ### From Source
170
+ ### Install from Source (for development)
121
171
 
122
172
  ```bash
123
- # Clone the repository
124
- git clone <repo-url>
173
+ git clone <internal-repo-url>
125
174
  cd wizard-codegen
126
-
127
- # Install protobuf compiler
128
- brew install protobuf
129
-
130
- # Install dependencies
131
- make deps
132
-
133
- # Install the cli
134
- make install
135
-
136
- # Run the CLI
137
- wizard-codegen --version
175
+ make deps # Install dependencies
176
+ make install # Install CLI tool
138
177
  ```
139
178
 
140
- #### Upgrade From Source
179
+ ### Upgrade from Source
180
+
141
181
  ```bash
142
182
  make upgrade
143
- ````
183
+ ```
144
184
 
145
185
  ### Dependencies
146
186
 
147
- Dependencies are managed in `pyproject.toml` and locked in `uv.lock`:
187
+ Core dependencies (managed in `pyproject.toml`):
148
188
 
149
- ```
150
- typer==0.20.1 # CLI framework
151
- pydantic==2.12.5 # Configuration validation
152
- jinja2==3.1.6 # Template engine
153
- rich==14.2.0 # Beautiful terminal output
154
- protobuf==6.33.2 # Proto descriptor handling
155
- pyyaml==6.0.3 # YAML configuration
156
- ```
189
+ | Package | Version | Purpose |
190
+ |---------|---------|---------|
191
+ | typer | 0.20.1 | CLI framework |
192
+ | pydantic | 2.12.5 | Configuration validation |
193
+ | jinja2 | 3.1.6 | Template engine |
194
+ | rich | 14.2.0 | Terminal output |
195
+ | protobuf | 6.33.2 | Proto descriptor handling |
196
+ | pyyaml | 6.0.3 | YAML configuration |
157
197
 
158
198
  ---
159
199
 
@@ -1,18 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: wizard-codegen
3
- Version: 0.1.7
4
- Summary: A powerful, template-driven code generation tool for Protocol Buffers
5
- Requires-Python: >=3.10
6
- Requires-Dist: click==8.3.1
7
- Requires-Dist: jinja2==3.1.6
8
- Requires-Dist: protobuf==6.33.2
9
- Requires-Dist: pydantic-core==2.41.5
10
- Requires-Dist: pydantic==2.12.5
11
- Requires-Dist: pyyaml==6.0.3
12
- Requires-Dist: rich==14.2.0
13
- Requires-Dist: typer==0.20.1
14
- Description-Content-Type: text/markdown
15
-
16
1
  # 🧙 Wizard Codegen
17
2
 
18
3
  [![CircleCI](https://dl.circleci.com/status-badge/img/gh/ConsultingMD/wizard-codegen/tree/main.svg?style=svg&circle-token=CCIPRJ_6cYihJ2CPYtLrt8VjrCcSV_f02bbbce30f122a85da4e93588e8887e973128fd)](https://dl.circleci.com/status-badge/redirect/gh/ConsultingMD/wizard-codegen/tree/main)
@@ -71,17 +56,48 @@ Wizard Codegen transforms your `.proto` definitions into typed code for multiple
71
56
 
72
57
  ## 🚀 Quick Start
73
58
 
59
+ ### 1. Install Prerequisites
60
+
61
+ **Protocol Buffer Compiler (protoc):**
62
+
74
63
  ```bash
75
- # 1. Clone and setup
76
- git clone <your-repo-url>
77
- cd wizard-codegen
78
- make deps
64
+ # macOS
65
+ brew install protobuf
66
+
67
+ # Ubuntu/Debian
68
+ sudo apt install -y protobuf-compiler
69
+
70
+ # Verify installation
71
+ protoc --version
72
+ ```
79
73
 
80
- # 2. Create your configuration
81
- cat > wizard/codegen.yaml << 'EOF'
74
+ **uv (Python package manager):**
75
+
76
+ ```bash
77
+ # macOS/Linux
78
+ curl -LsSf https://astral.sh/uv/install.sh | sh
79
+
80
+ # Or via Homebrew
81
+ brew install uv
82
+
83
+ # Verify installation
84
+ uv --version
85
+ ```
86
+
87
+ ### 2. Install Wizard Codegen
88
+
89
+ ```bash
90
+ uv tool install wizard-codegen
91
+ ```
92
+
93
+ ### 3. Create Configuration
94
+
95
+ Create `wizard/codegen.yaml` in your project:
96
+
97
+ ```yaml
82
98
  proto:
99
+ root: "path/to/your/protos" # Local path to proto files
83
100
  cache_dir: ".cache/protos"
84
- root: "path/to/your/protos"
85
101
  files:
86
102
  - "**/*.proto"
87
103
 
@@ -96,13 +112,19 @@ targets:
96
112
  all:
97
113
  - name: "*Form"
98
114
  output: "components/{{ item.name.kebab_case }}/index.tsx"
99
- EOF
115
+ ```
100
116
 
101
- # 3. Generate code
102
- uv run wizard-codegen generate
117
+ ### 4. Generate Code
103
118
 
104
- # Or with verbose output
105
- uv run wizard-codegen --verbose generate
119
+ ```bash
120
+ # Generate code
121
+ wizard-codegen generate
122
+
123
+ # Preview changes without writing files
124
+ wizard-codegen --dry-run generate
125
+
126
+ # Verbose output for debugging
127
+ wizard-codegen --verbose generate
106
128
  ```
107
129
 
108
130
  ---
@@ -111,64 +133,52 @@ uv run wizard-codegen --verbose generate
111
133
 
112
134
  ### Prerequisites
113
135
 
114
- - **Python 3.10+**
115
- - **[uv](https://docs.astral.sh/uv/)** — Fast Python package manager (installed via `ih-setup upgrade`)
116
- - **protoc** (Protocol Buffer Compiler) [Installation Guide](https://grpc.io/docs/protoc-installation/)
117
- - **Git** (for fetching proto sources from repositories)
136
+ | Requirement | Description | Installation |
137
+ |-------------|-------------|--------------|
138
+ | **Python 3.10+** | Runtime | [python.org](https://www.python.org/downloads/) |
139
+ | **uv** | Fast Python package manager | See Quick Start or [docs.astral.sh/uv](https://docs.astral.sh/uv/) |
140
+ | **protoc** | Protocol Buffer Compiler | See Quick Start or [grpc.io](https://grpc.io/docs/protoc-installation/) |
141
+ | **Git** | For fetching proto sources | Usually pre-installed |
118
142
 
119
- ### Install via uv tool (Recommended)
143
+ ### Install via uv (Recommended)
120
144
 
121
145
  ```bash
122
- # Install protobuf compiler
123
- brew install protobuf
124
-
125
- # Install wizard-codegen from public PyPI
126
146
  uv tool install wizard-codegen
127
147
  ```
128
148
 
129
- #### Upgrade
149
+ ### Upgrade
130
150
 
131
151
  ```bash
132
152
  uv tool upgrade wizard-codegen
133
153
  ```
134
154
 
135
- ### From Source
155
+ ### Install from Source (for development)
136
156
 
137
157
  ```bash
138
- # Clone the repository
139
- git clone <repo-url>
158
+ git clone <internal-repo-url>
140
159
  cd wizard-codegen
141
-
142
- # Install protobuf compiler
143
- brew install protobuf
144
-
145
- # Install dependencies
146
- make deps
147
-
148
- # Install the cli
149
- make install
150
-
151
- # Run the CLI
152
- wizard-codegen --version
160
+ make deps # Install dependencies
161
+ make install # Install CLI tool
153
162
  ```
154
163
 
155
- #### Upgrade From Source
164
+ ### Upgrade from Source
165
+
156
166
  ```bash
157
167
  make upgrade
158
- ````
168
+ ```
159
169
 
160
170
  ### Dependencies
161
171
 
162
- Dependencies are managed in `pyproject.toml` and locked in `uv.lock`:
172
+ Core dependencies (managed in `pyproject.toml`):
163
173
 
164
- ```
165
- typer==0.20.1 # CLI framework
166
- pydantic==2.12.5 # Configuration validation
167
- jinja2==3.1.6 # Template engine
168
- rich==14.2.0 # Beautiful terminal output
169
- protobuf==6.33.2 # Proto descriptor handling
170
- pyyaml==6.0.3 # YAML configuration
171
- ```
174
+ | Package | Version | Purpose |
175
+ |---------|---------|---------|
176
+ | typer | 0.20.1 | CLI framework |
177
+ | pydantic | 2.12.5 | Configuration validation |
178
+ | jinja2 | 3.1.6 | Template engine |
179
+ | rich | 14.2.0 | Terminal output |
180
+ | protobuf | 6.33.2 | Proto descriptor handling |
181
+ | pyyaml | 6.0.3 | YAML configuration |
172
182
 
173
183
  ---
174
184
 
@@ -19,7 +19,11 @@ def build_descriptor_set(
19
19
  fds_path = expand_path(config.proto.source.fds).resolve()
20
20
  return fds_path, None
21
21
 
22
- cache_dir = expand_path(config.proto.cache_dir).resolve() if config.proto.cache_dir else (Path.cwd() / ".cache")
22
+ if config.proto.cache_dir:
23
+ cache_dir = expand_path(config.proto.cache_dir, mkdir=True).resolve()
24
+ else:
25
+ cache_dir = Path.cwd() / ".cache"
26
+ cache_dir.mkdir(parents=True, exist_ok=True)
23
27
  out_dir = Path(tempfile.mkdtemp(prefix="wizard_protoc_codegen_", dir=cache_dir))
24
28
  fds_path = out_dir / "descriptor.pb"
25
29
 
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "wizard-codegen"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = "A powerful, template-driven code generation tool for Protocol Buffers"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  dependencies = [
8
- "typer==0.20.1",
8
+ "typer==0.21.0",
9
9
  "pydantic==2.12.5",
10
10
  "pydantic_core==2.41.5",
11
11
  "jinja2==3.1.6",
@@ -8,7 +8,7 @@ from pathlib import Path
8
8
  import os
9
9
 
10
10
 
11
- def expand_path(path_str: str) -> Path:
11
+ def expand_path(path_str: str, *, mkdir: bool = False) -> Path:
12
12
  """
13
13
  Expand environment variables and ~ in a path string.
14
14
 
@@ -18,10 +18,14 @@ def expand_path(path_str: str) -> Path:
18
18
 
19
19
  Args:
20
20
  path_str: Path string that may contain variables
21
+ mkdir: If True, create the directory (and parents) if it doesn't exist
21
22
 
22
23
  Returns:
23
24
  Path object with variables expanded
24
25
  """
25
26
  expanded = os.path.expandvars(path_str) # $VAR, ${VAR}
26
27
  expanded = os.path.expanduser(expanded) # ~
27
- return Path(expanded)
28
+ path = Path(expanded)
29
+ if mkdir:
30
+ path.mkdir(parents=True, exist_ok=True)
31
+ return path