Skip to content

Commit 35979d6

Browse files
Merge pull request #1 from dschwartznyc/develop
Develop
2 parents d22157e + 52dc200 commit 35979d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+846
-2623
lines changed

.github/renovate.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base"],
4+
"prConcurrentLimit": 10,
5+
"prHourlyLimit": 20,
6+
"packageRules": [
7+
{
8+
"description": "Update the Maven property rosetta.dsl.version when com.regnosys.rosetta releases a new version",
9+
"matchManagers": ["maven"],
10+
"matchPackageNames": [
11+
"com.regnosys.rosetta:com.regnosys.rosetta",
12+
"rosetta.dsl.version"
13+
],
14+
"enabled": true
15+
},
16+
{
17+
"description": "Disable all that are not maven AND not those names",
18+
"matchManagers": ["maven"],
19+
"excludePackageNames": [
20+
"com.regnosys.rosetta:com.regnosys.rosetta",
21+
"rosetta.dsl.version"
22+
],
23+
"enabled": false
24+
}
25+
]
26+
}
Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
9-
name: Build and Test JAR
1+
name: Build and Test JAR on Main Branch
102

113
on:
124
push:
@@ -16,26 +8,4 @@ on:
168

179
jobs:
1810
build_and_test:
19-
20-
runs-on: ubuntu-latest
21-
22-
steps:
23-
- uses: actions/checkout@v4
24-
- name: Set up JDK 21
25-
uses: actions/setup-java@v4
26-
with:
27-
java-version: '21'
28-
distribution: 'temurin'
29-
cache: maven
30-
- name: Set up Python 3.11
31-
uses: actions/setup-python@v4
32-
with:
33-
python-version: '3.11'
34-
- name: Build with Maven
35-
run: mvn -B package --file pom.xml
36-
- name: Run Python Unit Tests
37-
run: |
38-
chmod +x build/setup_python_env.sh
39-
chmod +x test/python_unit_tests/setup_unit_test_env.sh
40-
chmod +x test/python_unit_tests/run_python_unit_tests.sh
41-
test/python_unit_tests/run_python_unit_tests.sh
11+
uses: ./.github/workflows/build-and-test.yml
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build and Test (Reusable)
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build_and_test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up JDK 21
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: '21'
15+
distribution: 'temurin'
16+
cache: maven
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
- name: Build with Maven
22+
run: mvn -B package -Psign-artifacts --file pom.xml
23+
- name: Run Python Unit Tests
24+
run: |
25+
chmod +x test/python_setup/setup_python_env.sh
26+
chmod +x test/python_setup/cleanup_python_env.sh
27+
chmod +x test/python_unit_tests/setup_unit_test_env.sh
28+
chmod +x test/python_unit_tests/run_python_unit_tests.sh
29+
test/python_unit_tests/run_python_unit_tests.sh

.github/workflows/create-tagged-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Build JAR on Tag
1+
name: Create Tagged Release
2+
# Build JAR and create tagged release
23

34
on:
45
push:
@@ -36,7 +37,7 @@ jobs:
3637
TAG_NAME=${GITHUB_REF#refs/tags/}
3738
echo "Updating POM version to $TAG_NAME"
3839
mvn -B versions:set -DnewVersion=$TAG_NAME
39-
mvn -B package
40+
mvn -B package -Psign-artifacts
4041
4142
- name: Revert POM changes
4243
run: git checkout -- pom.xml

.github/workflows/renovate.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow runs Renovate Bot on a schedule or on demand.
2+
# It uses the configuration file located at .github/renovate.json
3+
4+
name: Renovate
5+
on:
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
# Runs the workflow on a schedule (e.g., every day at 2 AM)
9+
schedule:
10+
- cron: '0 2 * * *'
11+
12+
jobs:
13+
renovate:
14+
runs-on: ubuntu-latest
15+
# Grants the GITHUB_TOKEN the necessary permissions for Renovate to read repository content and create pull requests.
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
# Checks out the repository under $GITHUB_WORKSPACE, so your job can access it
21+
- uses: actions/checkout@v4
22+
# Runs the Renovate GitHub Action
23+
- name: Renovate
24+
# Using a slightly newer version of the action
25+
uses: renovatebot/[email protected]
26+
with:
27+
# The token is required to create pull requests.
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
# Specifies the path to your Renovate configuration file.
30+
configurationFile: .github/renovate.json
31+
env:
32+
RENOVATE_REPOSITORIES: ${{ github.repository }} # This tells Renovate to scan the current repo
33+
# Add a build and test job that depends on renovate
34+
build_and_test:
35+
needs: renovate
36+
uses: ./.github/workflows/build-and-test.yml

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@ __pycache__
5555
**/rune.runtime-*.*.*-py3-none-any.whl
5656
**/test_helper-0.0.0-py3-none-any.whl
5757
**/test/serialization_tests/rune-common
58-
**/build/common-domain-model
59-
**/build/resources/serialization
58+
**/test/cdm_tests/common-domain-model/
59+
src/generated/
60+
*.todo

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Before making a contribution, please take the following steps:
88
1. Check whether there's already an open issue related to your proposed contribution. If there is, join the discussion and propose your contribution there.
99
2. If there isn't already a relevant issue, create one, describing your contribution and the problem you're trying to solve.
1010
3. Respond to any questions or suggestions raised in the issue by other developers.
11-
4. Fork the project repository and prepare your proposed contribution.
11+
4. Fork the project repository and prepare your proposed contribution. The contribution must include unit tests to confirm that it behaves as expected.
1212
5. Submit a pull request.
1313

1414
NOTE: All contributors must have a contributor license agreement (CLA) on file with FINOS before their pull requests will be merged. Please review the FINOS [contribution requirements](https://community.finos.org/docs/governance/Software-Projects/contribution-compliance-requirements) and submit (or have your employer submit) the required CLA before submitting a pull request.

NOTICE

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
Rune Python Generator - FINOS
2-
Copyright 2023-2025 CLOUDRISK Limited ([email protected]) and FT Advisory LLC ([email protected])
3-
4-
This product includes software developed at the Fintech Open Source Foundation (https://www.finos.org/).
1+
# Rune Python Generator - FINOS
52

3+
Copyright 2023-2025 CLOUDRISK Limited (<[email protected]>) and FT Advisory LLC (<[email protected]>)
64

5+
This product includes software developed at the Fintech Open Source Foundation (<https://www.finos.org/>).

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[![FINOS - Incubating](https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-incubating.svg)](https://community.finos.org/docs/governance/Software-Projects/stages/incubating)[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10725/badge)](https://www.bestpractices.dev/projects/10725)[![Maven CI](https://github.com/finos/rune-python-generator/actions/workflows/cve-scanning.yml/badge.svg)](https://github.com/finos/rune-python-generator/actions/workflows/cve-scanning.yml)
22

3-
4-
<img align="right" width="15%" src="https://www.finos.org/hubfs/FINOS/finos-logo/FINOS_Icon_Wordmark_Name_RGB_horizontal.png">
3+
<img align="right" width="15%" alt="FINOS" src="https://www.finos.org/hubfs/FINOS/finos-logo/FINOS_Icon_Wordmark_Name_RGB_horizontal.png">
54

65
# Rune Python Generator
76

@@ -10,6 +9,7 @@
109
The generated Python relies upon the [RunePythonRuntime](https://github.com/finos/rune-python-runtime) library and requires Python version 3.11+.
1110

1211
## Release Notes
12+
1313
The features of the current version can be found in the [release notes](./RELEASE.md)
1414

1515
## Repository Organization
@@ -26,41 +26,59 @@ The features of the current version can be found in the [release notes](./RELEAS
2626
## Development setup
2727

2828
### Setup for developers
29+
2930
This guide is meant for everyone who wants to contribute to the Rune Python Generator and needs to get things up and running.
3031

3132
Detailed build and testing instructions can be found in [BUILDANDTEST.md](./BUILDANDTEST.md)
3233

3334
If this guide does not work for you, be sure to raise an issue. This way we can help you figure out what the problem is and update this guide to prevent the same problem for future users.
3435

3536
### 1. Building with Maven
37+
3638
Start by cloning the project: `git clone https://github.com/finos/rune-python-generator`
3739

3840
Our project runs with Java 21. Make sure that your Maven also uses this version of Java by running `mvn -v`.
3941

40-
To build the project, run `mvn clean install`.
42+
To build the project, run `mvn clean package`.
4143

4244
#### UNIT Testing
45+
4346
Building the project using Maven will run JUNIT-based unit tests. All tests should pass. To run the Python unit tests follow the instructions in [BUILDANDTEST.md](./BUILDANDTEST.md)
4447

4548
### 2. Setting things up in Eclipse
49+
4650
#### Install Eclipse IDE for Java and DSL Developers
51+
4752
Install version `2025-06` of the "Eclipse IDE for Java and DSL Developers" using the [Eclipse Installer](https://www.eclipse.org/downloads/packages/installer). You might have to enable "Advanced Mode" in the settings of the Eclipse Installer to install a specific version.
4853

4954
#### Configure Eclipse with the right version of Java
55+
5056
Xtend files cannot be built with any Java version later than 21. In Eclipse, go to Settings... > Java > Installed JREs and make sure the checked JRE points to a Java version of 21.
5157

5258
#### Install the Checkstyle plugin
59+
5360
We use [Checkstyle](https://checkstyle.sourceforge.io/) for enforcing good coding practices. The Eclipse plugin for Checkstyle can be found here: [https://checkstyle.org/eclipse-cs/#!/](https://checkstyle.org/eclipse-cs/#!/).
5461

5562
#### Open the project in Eclipse
63+
5664
Go to Import... > Existing Maven Project, select the right folder, click Finish.
5765

66+
### Standalone CLI
67+
68+
The generator includes a standalone CLI which can be invoked to generate Python from a single file or from directory. To invoke the CLI, first build the project and then:
69+
70+
```sh
71+
java -cp target/python-0.0.0.main-SNAPSHOT.jar com.regnosys.rosetta.generator.python.PythonCodeGeneratorCLI
72+
```
73+
5874
### To Generate CDM from Rune
5975

6076
Use this script to generated the Python version of CDM
77+
6178
```sh
62-
build/build_cdm.sh
79+
test/cdm_tests/cdm_setup/build_cdm.sh
6380
```
81+
6482
The script will use the CDM from the branch specified in the file (E.G. master) of the [FINOS Repo](https://github.com/finos/common-domain-model) and generate a wheel in the project directory `target/python-cdm`
6583

6684
To use a different version of CDM, update CDM_VERSION in the script.
@@ -69,21 +87,33 @@ To use a different version of CDM, update CDM_VERSION in the script.
6987

7088
The Roadmap will be aligned to the [Rune-DSL](https://github.com/finos/rune-dsl/) and [CDM](https://github.com/finos/common-domain-model/blob/master/ROADMAP.md) roadmaps.
7189

90+
### Rune-DSL Updates
91+
92+
Renovate will generate a PR when the version of the DSL has been updated at com.regnosys.rosetta:com.regnosys.rosetta. The PR will clarify whether the change succsessfully builds and passes JUNIT and Python unit testing.
93+
94+
Any maintainer can merge changes that successfully build and pass the tests. To make the revised generator available to CDM, post merge a new release tagged with the version # of the updated DSL will be required.
95+
96+
Build or testing failures should be escalated to [@plamen-neykov](https://github.com/plamen-neykov) or [@dschwartznyc](https://github.com/dschwartznyc) for remediation.
97+
7298
## Contributing
99+
73100
For any questions, bugs or feature requests please open an [issue](https://github.com/finos/rune-python-generator/issues)
74101
For anything else please send an email to {project mailing list}.
75102

76103
To submit a contribution:
104+
77105
1. Fork it (<https://github.com/finos/rune-python-generator/fork>)
78106
2. Create your feature branch (`git checkout -b feature/fooBar`)
79107
3. Read our [contribution guidelines](.github/CONTRIBUTING.md) and [Community Code of Conduct](https://www.finos.org/code-of-conduct)
80108
4. Commit your changes (`git commit -am 'Add some fooBar'`)
81109
5. Push to the branch (`git push origin feature/fooBar`)
82110
6. Create a new Pull Request
83111

84-
_NOTE:_ Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged and blocked by the FINOS Clabot tool (or EasyCLA). Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
112+
*_NOTE:* Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR
113+
who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged
114+
and blocked by the FINOS Clabot tool (or EasyCLA). Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
85115

86-
Unsure if you are covered under an existing CCLA? Email [email protected]*
116+
If you are unsure if you are covered under an existing CCLA send an email to <[email protected]>
87117

88118
## Get in touch with the Rune Python Generator Team
89119

@@ -93,7 +123,7 @@ Unsure if you are covered under an existing CCLA? Email [email protected]*
93123

94124
## Governance
95125

96-
This project implements https://community.finos.org/docs/governance/#open-source-software-projects
126+
This project implements <https://community.finos.org/docs/governance/#open-source-software-projects>
97127

98128
## License
99129

@@ -105,8 +135,8 @@ SPDX-License-Identifier: [Apache-2.0](https://spdx.org/licenses/Apache-2.0)
105135

106136
## Contributors
107137

108-
- [CLOUDRISK Limited](https://www.cloudrisk.uk), email: [email protected]
109-
- [FT Advisory LLC](https://www.ftadvisory.co), email: [email protected]
110-
- [TradeHeader SL](https://www.tradeheader.com), email: [email protected]
138+
- [CLOUDRISK Limited](https://www.cloudrisk.uk), email: <[email protected]>
139+
- [FT Advisory LLC](https://www.ftadvisory.co), email: <[email protected]>
140+
- [TradeHeader SL](https://www.tradeheader.com), email: <[email protected]>
111141

112142
SPDX-License-Identifier: [Apache-2.0](https://spdx.org/licenses/Apache-2.0)

RELEASE.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,27 @@
22

33
_What is being released?_
44

5-
This release adds support for meta data and for serialization / deserialization consistent with the [serialization specifications in CDM issue #3236](https://github.com/finos/common-domain-model/issues/3236)
5+
This release adds support for metadata and for serialization / deserialization consistent with the [serialization specifications in CDM issue #3236](https://github.com/finos/common-domain-model/issues/3236)
66

7-
Also included is support for circular dependencies and increased testing of operators.
7+
Also included is support for:
88

9-
# Reading From and Writing To a String
9+
- circular Type definitions
10+
- increased testing of operators
11+
- generating Python across multiple namespaces
12+
- Command line (CLI) generation of Python from a Rune source file or directory. To execute the CLI (assuming
13+
the default process wherein the JAR is built in the target directory):
14+
15+
```bash
16+
java -cp target/python-0.0.0.main-SNAPSHOT.jar com.regnosys.rosetta.generator.python.PythonCodeGeneratorCLI -s [rune source files] -t [target directory for generated Python]
17+
```
18+
19+
## Reading From and Writing To a String
1020

1121
The generated Python code can deserialize and serialize an object.
1222

13-
## Deserializing from a string
23+
### Deserializing from a string
1424

15-
To deserialize from a string and create a object of the model specified in the string invoke the function:
25+
To deserialize from a string and create an object of the model specified in the string invoke the function:
1626

1727
`BaseDataClass.rune_deserialize` with the following parameters
1828

@@ -27,9 +37,11 @@ To deserialize from a string and create a object of the model specified in the s
2737
Returns:
2838
BaseModel: The Rune model.
2939

30-
To serialize from an object ("[obj]") of a generated class, invoke the function:
40+
### Serialize to a string
41+
42+
To serialize from a Rune object ("obj"), invoke the function:
3143

32-
`[obj].rune_serialize` with the following parameters:
44+
`obj.rune_serialize` with the following parameters:
3345

3446
validate_model (bool, optional): Validate that the model passes all Rune defined constraings prior to serialization. Setting to False allows serialization of an invalid Model. Defaults to True.
3547

@@ -59,7 +71,5 @@ To serialize from an object ("[obj]") of a generated class, invoke the function:
5971

6072
exclude_none (bool, optional): Determines whether to exclude fields that have a value of `None`. If True, fields set to None will be included. Defaults to False.
6173

62-
6374
Returns:
6475
A string.
65-

0 commit comments

Comments
 (0)