sogno-platform / cimgen

Code generation from CIM data model for several programming languages
Apache License 2.0
13 stars 6 forks source link

Relationship support #20

Open chicco785 opened 8 months ago

chicco785 commented 8 months ago

This pr takes the journey to bring relationships to modernpython generator based on work covered in https://github.com/zaphiro-technologies/cimgen/pull/5. The code is build on top of PR#16, which is required for build reproducibility (using modern library versioning for python).

Tentative plan:

  1. Treat classes as Enum.
  2. Remove classes for base types (e.g. in Python is nonsense to have a class for Boolean and Float), especially with zero attributes.
  3. Generate relationships, instead of using strings with IDs to define them. Supporting also Associations (@guillaume-alliander is there any reason why you commented them in current code generator?)
sonarcloud[bot] commented 8 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 14 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

m-mirz commented 7 months ago

@chicco785 @guillaume-alliander I've merged #16 . Could you rebase this PR and let me know when it is ready to be reviewed and merged? I would also appreciate an initial review by guillaume as it is indicated in the Reviewers section.

Besides, let me know if you would like to play a leading / maintainer role in this project or cimpy. We have implemented an initial version of cimpy for CGMES 3 (based on your cimgen PR) but could use more hands to boost development speed ;-) See this PR: https://github.com/sogno-platform/cimpy/pull/22

chicco785 commented 7 months ago

@chicco785 @guillaume-alliander I've merged #16 . Could you rebase this PR and let me know when it is ready to be reviewed and merged? I would also appreciate an initial review by guillaume as it is indicated in the Reviewers section.

@m-mirz i will rebase pr once @guillaume-alliander one is merged. I have already talked with guillame and i will test some additional changes.

Besides, let me know if you would like to play a leading / maintainer role in this project or cimpy. We have implemented an initial version of cimpy for CGMES 3 (based on your cimgen PR) but could use more hands to boost development speed ;-) See this PR: sogno-platform/cimpy#22

Happy to help, with @MarcoPignati (our CTO) we already discussed this. Being a company the work we put may be limited to our needs, but hopefully this is good enough for you :)

For cimpy we need to understand your plans, in my understanding currently it's not based on the "modern python" and we won't make much use of it in that case :(

Maybe a good idea is to have a call also with @guillaume-alliander and share ideas. My timeline currently is quite bad. What about early January?

m-mirz commented 7 months ago

@chicco785 Ok, for the rebase. I will take care of merging.

Regarding the roadmap and maintainer role, I am going to talk to Jonas at alliander next week and let you know about the next steps. Thanks for your availability even if it is only limited :-)

For cimpy, the one thing that we missed most dearly in python was types. So, we would also support the switch to a modern python version even if that means larger / breaking changes in cimpy.

m-mirz commented 7 months ago

@guillaume-alliander Could you please review this PR as well?

I have made you maintainer of the project. In case you need more permissions, just let me know.

chicco785 commented 7 months ago

I saw this PR as ready for review, so I had a look.

A few comments, but the main thing is that right now, no resources files are written when I tried and ran it :)

Also, in PR #21 I split Base.py in a few files, after the comments on pycgmes. There will be rebase needed at some point.

@guillaume-alliander

rebase completed, not sure about the issue you have that nothing is generated... i am passing these args in vscode:

"--outdir", "./build/CGMES_3.0_modernpython", "--schemadir", "./cgmes_schema/CGMES_3.0.0", "--langdir", "modernpython", "--cgmes_version", "cgmes_v3_0_0"
sonarcloud[bot] commented 7 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarcloud[bot] commented 7 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarcloud[bot] commented 6 months ago

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

11 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud