New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XML schemas to generate API #6

Open
tudortimi opened this Issue Jun 18, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@tudortimi
Contributor

tudortimi commented Jun 18, 2016

Instead of hand-writing the yaml file, wouldn't it be better to generate the class API from the XML schemas?

I've started looking into generateDS and pyxb as options for doing this.

@olofk

This comment has been minimized.

Show comment
Hide comment
@olofk

olofk Jun 18, 2016

Owner

Cool! Yes, it has been my plan to do this eventually, but haven't had time to start working on it, so the yaml solution at least gave me something to start with. I'm happy to know more and help out if you start working on this. The IP-XACT schemas are quite well-defined so it should be possible to do it that way. That would also help with changes between versions. I've been a bit lazy so far and just defined all tags as valid for all IP-XACT versions

Owner

olofk commented Jun 18, 2016

Cool! Yes, it has been my plan to do this eventually, but haven't had time to start working on it, so the yaml solution at least gave me something to start with. I'm happy to know more and help out if you start working on this. The IP-XACT schemas are quite well-defined so it should be possible to do it that way. That would also help with changes between versions. I've been a bit lazy so far and just defined all tags as valid for all IP-XACT versions

@tudortimi

This comment has been minimized.

Show comment
Hide comment
@tudortimi

tudortimi Jun 19, 2016

Contributor

I've tried PyXB, but I didn't really like its philosophy. It generates code that depends on the PyXB packages, which means users have to additionally install this one as well. I also didn't work out of the box (I tried reading in a simple XML for an APB bus from the Accellera website and it didn't work).

Contributor

tudortimi commented Jun 19, 2016

I've tried PyXB, but I didn't really like its philosophy. It generates code that depends on the PyXB packages, which means users have to additionally install this one as well. I also didn't work out of the box (I tried reading in a simple XML for an APB bus from the Accellera website and it didn't work).

@tudortimi

This comment has been minimized.

Show comment
Hide comment
@tudortimi

tudortimi Jun 19, 2016

Contributor

I also tried generateDS and had better success with it. I managed to read the APB bus inside it. It has some issues with the schemas, though.

Per default, it generates one big module for everything. I gave it index.xsd and let it go wild. The same name, portType is used in multiple XSD files. Because of this, it generates a class called portType and another one called portType37 (or something), to keep the names unique within the module.

It also has an option to generate one module per XSD file, but this didn't work. It got confused because generator.xsd uses the name apiType for both an element and a type. I see this option as the most viable (one module per XSD), but it'll need some work on our part to get generateDS working and maybe some manual editing of the generated code as well.

Contributor

tudortimi commented Jun 19, 2016

I also tried generateDS and had better success with it. I managed to read the APB bus inside it. It has some issues with the schemas, though.

Per default, it generates one big module for everything. I gave it index.xsd and let it go wild. The same name, portType is used in multiple XSD files. Because of this, it generates a class called portType and another one called portType37 (or something), to keep the names unique within the module.

It also has an option to generate one module per XSD file, but this didn't work. It got confused because generator.xsd uses the name apiType for both an element and a type. I see this option as the most viable (one module per XSD), but it'll need some work on our part to get generateDS working and maybe some manual editing of the generated code as well.

@tudortimi

This comment has been minimized.

Show comment
Hide comment
@tudortimi

tudortimi Jun 19, 2016

Contributor

I also thought about the option of generating C++ and importing that into Python. The rationale behind it was that the C++ ecosystem is more mature. The only free tools I found were under GPL and I'd rather stay away from that as I find it too limiting. In case some small startup somewhere ever wants to use ipyxact, they wouldn't be able to, because they'd need to open-source everything they make...

Contributor

tudortimi commented Jun 19, 2016

I also thought about the option of generating C++ and importing that into Python. The rationale behind it was that the C++ ecosystem is more mature. The only free tools I found were under GPL and I'd rather stay away from that as I find it too limiting. In case some small startup somewhere ever wants to use ipyxact, they wouldn't be able to, because they'd need to open-source everything they make...

@olofk

This comment has been minimized.

Show comment
Hide comment
@olofk

olofk Jun 29, 2016

Owner

Just wanted to let you know that I haven't had time to investigate this further myself. GenerateDS sounds like the best option so far, but if it's tricky to adopt, I'm leaning towards a homebrewn solution for this particular problem. This might also give us better opportunity to make some manual changes and overrides

Owner

olofk commented Jun 29, 2016

Just wanted to let you know that I haven't had time to investigate this further myself. GenerateDS sounds like the best option so far, but if it's tricky to adopt, I'm leaning towards a homebrewn solution for this particular problem. This might also give us better opportunity to make some manual changes and overrides

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment