|
1 | | -## Feature Request - CDM Python Generator Integration |
| 1 | +# Feature Request - CDM Python Generator Integration |
| 2 | + |
| 3 | +## Description of Problem |
2 | 4 |
|
3 | | -### Description of Problem: |
4 | 5 | With the Python generator now a standalone component, its integration with the CDM build needs to be updated. This presents two main challenges: |
5 | 6 |
|
6 | | -1. **Consistency with CDM's Rosetta Bundle Version:** |
7 | | -To keep CDM in sync with all elements of the Rune DSL infrastructure (rosetta-common, rosetta-testing, rosetta-code-generators, rosetta-ingest), the CDM build specifies which version to use. Previously, the Python generator was kept in sync as part of the rosetta-code-generators repository, with updates whenever there was an update to the version in that repository. While the generated Python code does not directly depend on the Rune bundle, coordinating updates across all elements of the Rune infrastructure helps prevent inconsistencies in enterprise production enviroments — especially if a bundle update addresses a defect or changes behavior in a way that impacts the generators. |
| 7 | +1. **Consistency with CDM's Rosetta Bundle Version:** |
| 8 | +To keep CDM in sync with all elements of the Rune DSL infrastructure (rosetta-common, rosetta-testing, rosetta-code-generators, rosetta-ingest), the CDM build specifies which version to use. Previously, the Python generator was kept in sync as part of the rosetta-code-generators repository, with updates whenever there was an update to the version in that repository. While the generated Python code does not directly depend on it, coordinating updates across all elements of the Rune infrastructure helps prevent inconsistencies in enterprise production enviroments — especially if a dsl update addresses a defect or changes behavior in a way that impacts the generators. |
8 | 9 |
|
9 | 10 | 2. **Invocation of the standalone Python generator**: |
10 | 11 | The CDM build now needs to explicitly invoke the unbundled Python generator. |
11 | 12 |
|
12 | 13 | --- |
13 | | -### Potential Solutions: |
| 14 | + |
| 15 | +## Potential Solutions |
14 | 16 |
|
15 | 17 | Below are both a target state and interim steps to enable integration before the target state is fully realized. |
16 | 18 |
|
17 | | -### Target state: |
| 19 | +### Target state |
| 20 | + |
| 21 | +#### Assumptions |
18 | 22 |
|
19 | | -#### Assumptions: |
20 | 23 | - The generator includes an executable Main class that accepts a Rune source and a target folder for the generated Python. |
21 | 24 | - The Rune Python Runtime is available via PyPI. |
22 | 25 |
|
23 | | -#### Process: |
24 | | -1. An update to the Rosetta Bundle Version triggers a rebuild of the generator. If successful, a release tagged with the bundle version is generated. |
25 | | -- Question: What is a viable source for the trigger? Rosetta-Common? |
26 | | -- Question: Is the generator uploaded to a central Maven repository or is it solely an artifact of the generator repository. |
27 | | -2. The CDM build sources a generator version that matches its Rosetta Bundle Version. The sequence is: |
| 26 | +#### Process |
| 27 | + |
| 28 | +1. An update to the Rosetta DSL Version triggers a rebuild of the generator. If successful, a release tagged with the DSL version is generated. |
| 29 | + |
| 30 | +2. The CDM build sources a generator version that matches its Rosetta DSL Version. The sequence is: |
28 | 31 |
|
29 | 32 | 1. Source the generator |
30 | 33 | 2. If found: |
31 | 34 | 1. Generate Python by invoking the new Main class using the source CDM Rune files. |
32 | 35 | 2. Package the resultung Python. |
33 | 36 | 3. Upload the package to PyPI. |
34 | | - |
35 | | - Question: Should the package also be made available as a Maven artifact? |
36 | 37 | 3. If not found: fail gracefully generating notice of the error. |
37 | 38 |
|
38 | | -### Interim state: |
| 39 | +### Interim state |
| 40 | + |
| 41 | +#### Assumptions |
39 | 42 |
|
40 | | -#### Assumptions: |
41 | 43 | - The generator is invoked using the current mechanism. |
42 | 44 | - Python artifacts are distributed via the CDM Maven Repository. |
43 | 45 |
|
44 | 46 | 1. A scheduled action rebuilds the generator if the Rosetta Bundle Version used in CDM does not match any of tagged versions. If successful, a release tagged with the bundle version is generated and stored as a repo artifact. |
45 | 47 |
|
46 | 48 | _Note: The downside of this approach is that there will be CDM builds that will not find a matching generator._ |
47 | | - |
48 | 49 | 2. The CDM build sources a generator that matches its Rosetta Bundle Version by querying the generator repo. The sequence is: |
49 | 50 | 1. Source the generator |
50 | 51 | 2. If found: |
51 | | - 1. Generate Python by executing: |
| 52 | + 1. Generate Python by executing |
| 53 | + |
52 | 54 | ```sh |
53 | 55 | mvn clean install -DskipTests -P python |
54 | | - ``` |
| 56 | + ``` |
| 57 | + |
55 | 58 | 2. Package the Python. |
56 | 59 | 3. Upload the package to the Maven repository. |
57 | | - 3. If not found: fail gracefully generating notice of the error. |
| 60 | + 3. If not found: fail gracefully generating notice of the error |
| 61 | + |
| 62 | +## Questions |
| 63 | + |
| 64 | +- Should the package also be made available as a Maven artifact? |
0 commit comments