viv-compiler 0.1.0__tar.gz → 0.1.1__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 (39) hide show
  1. {viv_compiler-0.1.0/src/viv_compiler.egg-info → viv_compiler-0.1.1}/PKG-INFO +111 -73
  2. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/README.md +110 -72
  3. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/pyproject.toml +1 -1
  4. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/cli.py +9 -8
  5. viv_compiler-0.1.1/src/viv_compiler/core/__init__.py +5 -0
  6. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/core/core.py +5 -5
  7. viv_compiler-0.1.0/src/viv_compiler/core/importer.py → viv_compiler-0.1.1/src/viv_compiler/core/includes.py +5 -5
  8. viv_compiler-0.1.1/src/viv_compiler/core/metadata.py +69 -0
  9. viv_compiler-0.1.0/src/viv_compiler/core/postprocessor.py → viv_compiler-0.1.1/src/viv_compiler/core/postprocessing.py +6 -32
  10. viv_compiler-0.1.0/src/viv_compiler/core/validator.py → viv_compiler-0.1.1/src/viv_compiler/core/validation.py +1 -24
  11. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/core/visitor.py +44 -14
  12. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/grammar/viv.peg +15 -10
  13. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/types/content_public_schemas.py +27 -4
  14. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/types/dsl_public_schemas.py +9 -3
  15. {viv_compiler-0.1.0 → viv_compiler-0.1.1/src/viv_compiler.egg-info}/PKG-INFO +111 -73
  16. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler.egg-info/SOURCES.txt +4 -3
  17. viv_compiler-0.1.0/src/viv_compiler/core/__init__.py +0 -5
  18. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/LICENSE +0 -0
  19. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/setup.cfg +0 -0
  20. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/__init__.py +0 -0
  21. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/__main__.py +0 -0
  22. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/_samples/__init__.py +0 -0
  23. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/_samples/smoke-test.viv +0 -0
  24. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/api.py +0 -0
  25. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/backports/__init__.py +0 -0
  26. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/backports/backports.py +0 -0
  27. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/config/__init__.py +0 -0
  28. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/config/config.py +0 -0
  29. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/grammar/__init__.py +0 -0
  30. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/py.typed +0 -0
  31. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/types/__init__.py +0 -0
  32. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/types/internal_types.py +0 -0
  33. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/utils/__init__.py +0 -0
  34. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/utils/_version.py +0 -0
  35. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler/utils/utils.py +0 -0
  36. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler.egg-info/dependency_links.txt +0 -0
  37. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler.egg-info/entry_points.txt +0 -0
  38. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler.egg-info/requires.txt +0 -0
  39. {viv_compiler-0.1.0 → viv_compiler-0.1.1}/src/viv_compiler.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viv-compiler
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Compiler for the DSL of Viv, an action system for emergent narrative.
5
5
  Author-email: James Ryan <mail@jamesryan.ai>
6
6
  License: MIT License
@@ -71,8 +71,6 @@ Install from PyPI:
71
71
  pip install viv-compiler
72
72
  ```
73
73
 
74
- This installs both the `viv_compiler` Python package and the `vivc` command-line interface.
75
-
76
74
  Smoke test to confirm your installation looks good:
77
75
 
78
76
  ```
@@ -156,127 +154,167 @@ vivc --input path/to/source.viv [options]
156
154
 
157
155
  ### Examples
158
156
 
159
- Compile a source file and write the resulting content bundle to file:
157
+ * Compile a source file and write the resulting content bundle to file:
160
158
 
161
- ```
162
- vivc --input /path/to/my-actions.viv --output /path/to/myContentBundle.json
163
- ```
159
+ ```
160
+ vivc --input /path/to/my-actions.viv --output /path/to/myContentBundle.json
161
+ ```
164
162
 
165
- Compile a source file and log the output in the console:
163
+ * Compile a source file and log the output in the console:
166
164
 
167
- ```
168
- vivc --input /path/to/my-actions.viv --print
169
- ```
165
+ ```
166
+ vivc --input /path/to/my-actions.viv --print
167
+ ```
170
168
 
171
- Log the version number for the installed Viv compiler:
169
+ * Log the version number for the installed Viv compiler:
172
170
 
173
- ```
174
- vivc -v
175
- ```
171
+ ```
172
+ vivc -v
173
+ ```
176
174
 
177
175
 
178
176
  ## Python API
179
177
 
180
- The API is intended for programmatic invocation of the compiler.
181
-
178
+ Once you've installed `viv-compiler`, the Viv compiler Python API can be invoked by importing `viv_compiler` into your project.
182
179
 
183
- ### `compile_from_path()`
184
180
 
185
- This function invokes the compiler for a specified Viv source file.
181
+ ### API Reference
186
182
 
187
- **Arguments**
183
+ #### `compile_from_path()`
188
184
 
189
- * `source_file_path` (`Path`)
185
+ * **Purpose**
190
186
 
191
- * Absolute path to a `.viv` source file.
187
+ * Invokes the compiler for a specified Viv source file.
192
188
 
193
- * `default_salience` (`float`)
189
+ * **Arguments**
194
190
 
195
- * Default salience for actions (if unspecified).
191
+ * `source_file_path` (`Path`)
192
+
193
+ * Absolute path to a `.viv` source file.
196
194
 
197
- * `default_associations` `(list[str])`
195
+ * `default_salience` (`float`)
198
196
 
199
- * Default associations for actions (if unspecified).
197
+ * Default salience for actions (if unspecified).
200
198
 
201
- * `default_reaction_priority` (`float`)
199
+ * `default_associations` `(list[str])`
202
200
 
203
- * Default reaction priority for actions (if unspecified).
204
-
205
- * `use_memoization` (`bool`)
201
+ * Default associations for actions (if unspecified).
206
202
 
207
- * Whether to enable memoization in the underlying PEG parser (faster but uses more memory).
203
+ * `default_reaction_priority` (`float`)
204
+
205
+ * Default reaction priority for actions (if unspecified).
206
+
207
+ * `use_memoization` (`bool`)
208
+
209
+ * Whether to enable memoization in the underlying PEG parser (faster but uses more memory).
210
+
211
+ * `debug` (`bool`)
212
+
213
+ * Whether to enable verbose debugging for the underlying PEG parser.
208
214
 
209
- * `debug` (`bool`)
215
+ * **Returns**
210
216
 
211
- * Whether to enable verbose debugging for the underlying PEG parser.
217
+ * The compiled Viv bundle, in a JSON-serializable format conforming to the `CompiledContentBundle` schema defined in the project code.
212
218
 
213
- **Returns**
219
+ * **Raises**
214
220
 
215
- * The compiled Viv bundle, in a JSON-serializable format conforming to the `CompiledContentBundle` schema defined in the project code.
221
+ * `VivCompileError`
222
+
223
+ * Raised when compilation fails.
216
224
 
217
- **Raises**
225
+ * **Example**
218
226
 
219
- * `VivCompileError`
227
+ ```python
228
+ from pathlib import Path
229
+ from viv_compiler import compile_from_path
230
+
231
+ try:
232
+ content_bundle = compile_from_path(source_file_path=Path("my-actions.viv"))
233
+ print("Compilation succeeded:", content_bundle)
234
+ except VivCompileError as e:
235
+ print("Compilation failed:", e)
236
+ ```
220
237
 
221
- * Raised when compilation fails.
222
238
 
239
+ #### `get_version()`
223
240
 
224
- ### `get_version()`
241
+ * **Purpose**
225
242
 
226
- Returns the version string for the currently installed compiler.
243
+ * Returns the version string for the currently installed compiler. All content bundles produced by the compiler will be stamped with the same version number, making them compatible with any Viv runtime with the same version number.
227
244
 
245
+ * **Arguments**
228
246
 
229
- ### `VivCompileError`
247
+ * None.
230
248
 
231
- Custom exception type raised by the API when compilation fails. Inherits from `Exception`.
249
+ * **Returns**
232
250
 
251
+ * A string constituting the version number of the installed Viv compiler.
233
252
 
234
- ### Examples
253
+ * **Example**
235
254
 
236
- Compile a source file:
255
+ ```python
256
+ from viv_compiler import get_version
257
+
258
+ version = get_version()
259
+ print("Viv compiler version:", version)
260
+ ```
237
261
 
238
- ```python
239
- from pathlib import Path
240
- from viv_compiler import compile_from_path, VivCompileError
241
262
 
242
- try:
243
- content_bundle = compile_from_path(source_file_path=Path("my-actions.viv"))
244
- print("Compilation succeeded:", content_bundle)
245
- except VivCompileError as e:
246
- print("Compilation failed:", e)
247
- ```
263
+ #### `VivCompileError`
248
264
 
249
- Print the version number for the installed Viv compiler:
265
+ * **Purpose**
250
266
 
251
- ```python
252
- from viv_compiler import get_version
253
- print(get_version())
254
- ```
267
+ * Custom exception type (inherits from `Exception`) raised by the API when compilation fails.
255
268
 
256
269
 
257
270
  ## Running from Source
258
271
 
259
272
  For contributors or developers working directly from a repo checkout:
260
273
 
261
- ```
262
- # Clone the Viv monorepo
263
- git clone https://github.com/james-owen-ryan/viv
264
- cd viv/compiler
274
+ * Clone the Viv monorepo:
265
275
 
266
- # Create a virtual environment
267
- python -m venv .venv-viv-compiler
268
- source .venv-viv-compiler/bin/activate # macOS/Linux
269
- # Windows PowerShell: .\.venv-viv-compiler\Scripts\Activate.ps1
276
+ ```
277
+ git clone https://github.com/james-owen-ryan/viv
278
+ cd viv/compiler
279
+ ```
270
280
 
271
- # Install the compiler package from source (editable)
272
- python -m pip install -e .
281
+ * Create a virtual environment:
273
282
 
274
- # Invoke the CLI directly
275
- python -m viv_compiler --test
283
+ ```
284
+ python -m venv .venv-viv-compiler
285
+ ```
276
286
 
277
- # Or use the installed console script
278
- vivc --test
279
- ```
287
+ * Activate the virtual environment...
288
+
289
+ * macOS/Linux:
290
+
291
+ ```
292
+ source .venv-viv-compiler/bin/activate
293
+ ```
294
+
295
+ * Windows PowerShell:
296
+
297
+ ```
298
+ .\.venv-viv-compiler\Scripts\Activate.ps1
299
+ ```
300
+
301
+ * Install the compiler package from source (editable):
302
+
303
+ ```
304
+ python -m pip install -e .
305
+ ```
306
+
307
+ * Invoke the CLI directly:
308
+
309
+ ```
310
+ python -m viv_compiler --test
311
+ ```
312
+
313
+ * Or use the installed console script:
314
+
315
+ ```
316
+ vivc --test
317
+ ```
280
318
 
281
319
 
282
320
  ## License
@@ -28,8 +28,6 @@ Install from PyPI:
28
28
  pip install viv-compiler
29
29
  ```
30
30
 
31
- This installs both the `viv_compiler` Python package and the `vivc` command-line interface.
32
-
33
31
  Smoke test to confirm your installation looks good:
34
32
 
35
33
  ```
@@ -113,127 +111,167 @@ vivc --input path/to/source.viv [options]
113
111
 
114
112
  ### Examples
115
113
 
116
- Compile a source file and write the resulting content bundle to file:
114
+ * Compile a source file and write the resulting content bundle to file:
117
115
 
118
- ```
119
- vivc --input /path/to/my-actions.viv --output /path/to/myContentBundle.json
120
- ```
116
+ ```
117
+ vivc --input /path/to/my-actions.viv --output /path/to/myContentBundle.json
118
+ ```
121
119
 
122
- Compile a source file and log the output in the console:
120
+ * Compile a source file and log the output in the console:
123
121
 
124
- ```
125
- vivc --input /path/to/my-actions.viv --print
126
- ```
122
+ ```
123
+ vivc --input /path/to/my-actions.viv --print
124
+ ```
127
125
 
128
- Log the version number for the installed Viv compiler:
126
+ * Log the version number for the installed Viv compiler:
129
127
 
130
- ```
131
- vivc -v
132
- ```
128
+ ```
129
+ vivc -v
130
+ ```
133
131
 
134
132
 
135
133
  ## Python API
136
134
 
137
- The API is intended for programmatic invocation of the compiler.
138
-
135
+ Once you've installed `viv-compiler`, the Viv compiler Python API can be invoked by importing `viv_compiler` into your project.
139
136
 
140
- ### `compile_from_path()`
141
137
 
142
- This function invokes the compiler for a specified Viv source file.
138
+ ### API Reference
143
139
 
144
- **Arguments**
140
+ #### `compile_from_path()`
145
141
 
146
- * `source_file_path` (`Path`)
142
+ * **Purpose**
147
143
 
148
- * Absolute path to a `.viv` source file.
144
+ * Invokes the compiler for a specified Viv source file.
149
145
 
150
- * `default_salience` (`float`)
146
+ * **Arguments**
151
147
 
152
- * Default salience for actions (if unspecified).
148
+ * `source_file_path` (`Path`)
149
+
150
+ * Absolute path to a `.viv` source file.
153
151
 
154
- * `default_associations` `(list[str])`
152
+ * `default_salience` (`float`)
155
153
 
156
- * Default associations for actions (if unspecified).
154
+ * Default salience for actions (if unspecified).
157
155
 
158
- * `default_reaction_priority` (`float`)
156
+ * `default_associations` `(list[str])`
159
157
 
160
- * Default reaction priority for actions (if unspecified).
161
-
162
- * `use_memoization` (`bool`)
158
+ * Default associations for actions (if unspecified).
163
159
 
164
- * Whether to enable memoization in the underlying PEG parser (faster but uses more memory).
160
+ * `default_reaction_priority` (`float`)
161
+
162
+ * Default reaction priority for actions (if unspecified).
163
+
164
+ * `use_memoization` (`bool`)
165
+
166
+ * Whether to enable memoization in the underlying PEG parser (faster but uses more memory).
167
+
168
+ * `debug` (`bool`)
169
+
170
+ * Whether to enable verbose debugging for the underlying PEG parser.
165
171
 
166
- * `debug` (`bool`)
172
+ * **Returns**
167
173
 
168
- * Whether to enable verbose debugging for the underlying PEG parser.
174
+ * The compiled Viv bundle, in a JSON-serializable format conforming to the `CompiledContentBundle` schema defined in the project code.
169
175
 
170
- **Returns**
176
+ * **Raises**
171
177
 
172
- * The compiled Viv bundle, in a JSON-serializable format conforming to the `CompiledContentBundle` schema defined in the project code.
178
+ * `VivCompileError`
179
+
180
+ * Raised when compilation fails.
173
181
 
174
- **Raises**
182
+ * **Example**
175
183
 
176
- * `VivCompileError`
184
+ ```python
185
+ from pathlib import Path
186
+ from viv_compiler import compile_from_path
187
+
188
+ try:
189
+ content_bundle = compile_from_path(source_file_path=Path("my-actions.viv"))
190
+ print("Compilation succeeded:", content_bundle)
191
+ except VivCompileError as e:
192
+ print("Compilation failed:", e)
193
+ ```
177
194
 
178
- * Raised when compilation fails.
179
195
 
196
+ #### `get_version()`
180
197
 
181
- ### `get_version()`
198
+ * **Purpose**
182
199
 
183
- Returns the version string for the currently installed compiler.
200
+ * Returns the version string for the currently installed compiler. All content bundles produced by the compiler will be stamped with the same version number, making them compatible with any Viv runtime with the same version number.
184
201
 
202
+ * **Arguments**
185
203
 
186
- ### `VivCompileError`
204
+ * None.
187
205
 
188
- Custom exception type raised by the API when compilation fails. Inherits from `Exception`.
206
+ * **Returns**
189
207
 
208
+ * A string constituting the version number of the installed Viv compiler.
190
209
 
191
- ### Examples
210
+ * **Example**
192
211
 
193
- Compile a source file:
212
+ ```python
213
+ from viv_compiler import get_version
214
+
215
+ version = get_version()
216
+ print("Viv compiler version:", version)
217
+ ```
194
218
 
195
- ```python
196
- from pathlib import Path
197
- from viv_compiler import compile_from_path, VivCompileError
198
219
 
199
- try:
200
- content_bundle = compile_from_path(source_file_path=Path("my-actions.viv"))
201
- print("Compilation succeeded:", content_bundle)
202
- except VivCompileError as e:
203
- print("Compilation failed:", e)
204
- ```
220
+ #### `VivCompileError`
205
221
 
206
- Print the version number for the installed Viv compiler:
222
+ * **Purpose**
207
223
 
208
- ```python
209
- from viv_compiler import get_version
210
- print(get_version())
211
- ```
224
+ * Custom exception type (inherits from `Exception`) raised by the API when compilation fails.
212
225
 
213
226
 
214
227
  ## Running from Source
215
228
 
216
229
  For contributors or developers working directly from a repo checkout:
217
230
 
218
- ```
219
- # Clone the Viv monorepo
220
- git clone https://github.com/james-owen-ryan/viv
221
- cd viv/compiler
231
+ * Clone the Viv monorepo:
222
232
 
223
- # Create a virtual environment
224
- python -m venv .venv-viv-compiler
225
- source .venv-viv-compiler/bin/activate # macOS/Linux
226
- # Windows PowerShell: .\.venv-viv-compiler\Scripts\Activate.ps1
233
+ ```
234
+ git clone https://github.com/james-owen-ryan/viv
235
+ cd viv/compiler
236
+ ```
227
237
 
228
- # Install the compiler package from source (editable)
229
- python -m pip install -e .
238
+ * Create a virtual environment:
230
239
 
231
- # Invoke the CLI directly
232
- python -m viv_compiler --test
240
+ ```
241
+ python -m venv .venv-viv-compiler
242
+ ```
233
243
 
234
- # Or use the installed console script
235
- vivc --test
236
- ```
244
+ * Activate the virtual environment...
245
+
246
+ * macOS/Linux:
247
+
248
+ ```
249
+ source .venv-viv-compiler/bin/activate
250
+ ```
251
+
252
+ * Windows PowerShell:
253
+
254
+ ```
255
+ .\.venv-viv-compiler\Scripts\Activate.ps1
256
+ ```
257
+
258
+ * Install the compiler package from source (editable):
259
+
260
+ ```
261
+ python -m pip install -e .
262
+ ```
263
+
264
+ * Invoke the CLI directly:
265
+
266
+ ```
267
+ python -m viv_compiler --test
268
+ ```
269
+
270
+ * Or use the installed console script:
271
+
272
+ ```
273
+ vivc --test
274
+ ```
237
275
 
238
276
 
239
277
  ## License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "viv-compiler"
7
- version = "0.1.0" # This gets updated programmatically by `viv/scripts/bump_version.sh`
7
+ version = "0.1.1" # This gets updated programmatically by `viv/scripts/bump_version.sh`
8
8
  description = "Compiler for the DSL of Viv, an action system for emergent narrative."
9
9
  license = { file = "LICENSE" }
10
10
  authors = [{ name = "James Ryan", email = "mail@jamesryan.ai" }]
@@ -22,16 +22,17 @@ def main() -> None:
22
22
  args = parser.parse_args()
23
23
  # If the user has requested the compiler version, print it and exit
24
24
  if args.version:
25
- print(f"\nviv_compiler {get_version()}\n")
25
+ print(get_version())
26
26
  sys.exit(0)
27
+ # If test mode is not engaged and no source file was provided, error and exit
28
+ if not args.test and not args.input:
29
+ parser.error("Unless the 'test' flag is engaged, an action file must be provided")
27
30
  # If test mode is engaged, invoke the compiler on a test file and exit
31
+ print("\nCompiling...\n", file=sys.stderr)
28
32
  if args.test:
29
33
  _run_smoke_test(args=args)
30
34
  sys.exit(0)
31
- elif not args.input:
32
- parser.error("Unless the 'test' flag is engaged, an action file must be provided")
33
35
  # Otherwise, it's showtime, so let's invoke the compiler
34
- print("\nCompiling...\n", file=sys.stderr)
35
36
  if args.output:
36
37
  path_to_output_file = Path(args.output).expanduser().resolve()
37
38
  if not path_to_output_file.parent.exists():
@@ -152,7 +153,7 @@ def _run_smoke_test(args: argparse.Namespace) -> None:
152
153
  source_file_path=sample_path,
153
154
  default_salience=float(args.default_salience),
154
155
  default_associations=args.default_associations,
155
- default_reaction_priority=float(args.default_priority),
156
+ default_reaction_priority=float(args.default_reaction_priority),
156
157
  debug=False,
157
158
  use_memoization=True,
158
159
  )
@@ -174,7 +175,7 @@ def _invoke_compiler(args: argparse.Namespace) -> CompiledContentBundle:
174
175
  source_file_path=source_file_path,
175
176
  default_salience=float(args.default_salience),
176
177
  default_associations=args.default_associations,
177
- default_reaction_priority=float(args.default_priority),
178
+ default_reaction_priority=float(args.default_reaction_priority),
178
179
  debug=args.debug,
179
180
  use_memoization=args.memoization,
180
181
  )
@@ -211,7 +212,7 @@ def _emit_results(
211
212
  """
212
213
  # If we're to print out the result, let's do so now, via `stdout` (with headers piped to `stderr`)
213
214
  if args.print:
214
- print("\t== Result ==\n", file=sys.stderr)
215
+ print(" == Result ==\n", file=sys.stderr)
215
216
  sys.stdout.write(json.dumps(compiled_content_bundle, indent=2, sort_keys=True))
216
217
  sys.stdout.write("\n\n")
217
218
  # If we're to list out the compiled actions, let's do so now (again via
@@ -223,7 +224,7 @@ def _emit_results(
223
224
  lines.append(action_name)
224
225
  if not action_names:
225
226
  lines.append("N/A")
226
- print(f"\t== Actions ({len(action_names)}) ==\n", file=sys.stderr)
227
+ print(f" == Actions ({len(action_names)}) ==\n", file=sys.stderr)
227
228
  print("\n".join(f"- {line}" for line in lines), file=sys.stderr)
228
229
  print("", file=sys.stderr)
229
230
  # If an output file path has been provided, write the output file to the specified path
@@ -0,0 +1,5 @@
1
+ from .core import *
2
+ from .includes import *
3
+ from .postprocessing import *
4
+ from .validation import *
5
+ from .visitor import *
@@ -23,10 +23,10 @@ import viv_compiler.types
23
23
  from typing import Any
24
24
  from pathlib import Path
25
25
  from importlib.resources import files
26
- from .importer import integrate_imported_files
26
+ from .includes import integrate_included_files
27
27
  from .visitor import Visitor
28
- from .postprocessor import postprocess_combined_ast
29
- from .validator import validate_content_bundle
28
+ from .postprocessing import postprocess_combined_ast
29
+ from .validation import validate_content_bundle
30
30
  # noinspection PyUnresolvedReferences
31
31
  from arpeggio.cleanpeg import ParserPEG
32
32
 
@@ -37,7 +37,7 @@ def compile_viv_source_code(
37
37
  default_associations: list[str],
38
38
  default_reaction_priority: float,
39
39
  use_memoization: bool,
40
- debug = False,
40
+ debug=False,
41
41
  ) -> viv_compiler.types.CompiledContentBundle:
42
42
  """Compile the given Viv source file to produce a JSON-serializable compiled content bundle.
43
43
 
@@ -71,7 +71,7 @@ def compile_viv_source_code(
71
71
  # construct an abstract syntax tree (AST).
72
72
  ast: viv_compiler.types.AST = _sanitize_ast(ast=arpeggio.visit_parse_tree(tree, Visitor()))
73
73
  # If there are any include declarations (i.e., import statements), honor those now
74
- combined_ast: viv_compiler.types.CombinedAST = integrate_imported_files(
74
+ combined_ast: viv_compiler.types.CombinedAST = integrate_included_files(
75
75
  viv_parser=viv_parser,
76
76
  ast=ast,
77
77
  entry_point_file_path=source_file_path
@@ -1,10 +1,10 @@
1
1
  """Module that handles importing between Viv files.
2
2
 
3
- The entrypoint function is `integrate_imported_files()`, and everything else is only meant to be
3
+ The entrypoint function is `integrate_included_files()`, and everything else is only meant to be
4
4
  invoked internally, i.e., within this module.
5
5
  """
6
6
 
7
- __all__ = ["integrate_imported_files"]
7
+ __all__ = ["integrate_included_files"]
8
8
 
9
9
  import arpeggio
10
10
  import viv_compiler.types
@@ -14,13 +14,13 @@ from .visitor import Visitor
14
14
  from arpeggio.cleanpeg import ParserPEG
15
15
 
16
16
 
17
- def integrate_imported_files(
17
+ def integrate_included_files(
18
18
  viv_parser: ParserPEG,
19
19
  ast: viv_compiler.types.AST,
20
20
  entry_point_file_path: Path,
21
21
  ) -> viv_compiler.types.CombinedAST:
22
- """Handle any include declarations in the given AST (including any recursive ones) and return a dictionary
23
- containing trope definitions and action definitions.
22
+ """Handle any `include` declarations in the given AST (including any recursive ones)
23
+ and return a dictionary containing trope definitions and action definitions.
24
24
 
25
25
  Args:
26
26
  viv_parser: A prepared Viv parser.