-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Circular imports? #469
Comments
With the "-ns" option, I was able to avoid many, but still required manual labor to strip things. Some hints are appreciated to get it working out of the box. I needed to remove a significant number of SIRI imports. |
Unfortunately python is vulnerable to xsd circular imports, the Thankfully It's not a common practice, I was thinking at some point creating a mode that would write all classes into a single file... we could try that again 🤔 I am open to any other suggestions, or solutions you have seen in any other library/language. |
@tefra thanks for your reply. While I am very content with JAXB, I have also experienced that it is the only package actually capable of providing an out of the box experience. PyXB is able to generate a binding (fast), but cannot handle the polymorphism, generateDS fails in different ways, both provided huge python bindings (77MB+ source code). Xsdata at this moment already feels like magic, it works after cutting some dependencies. At least you have a case now to test the code for... |
How did you manage to generate the netex model? I saw in the new sample repo has single model too instead separated item model
|
Take a peak at the commit message, "--structure-style" is introduced as new option. |
Hi @reidsneo This feature is not released yet, you will need to install xsdata from the repo, judging from your traceback you are using the config from the sample repo that includes new options. Other that, If you are using a config <Config xmlns="http://pypi.org/project/xsdata" version="21.4">
<Output maxLineLength="79">
<Package>netex.models.generated</Package>
<Format>dataclasses</Format>
<Structure>single-package</Structure> <!-- set the structure to single package --> Otherwise from the cli |
Thank you it seem I use older tool instead the latest through the version is same 21.4 |
I am trying to make this XSD https://github.com/NeTEx-CEN/NeTEx/blob/master/xsd/NeTEx_publication.xsd working with xsdata. Code generation looks good, without errors. When trying to import, I end up with:
"ImportError: cannot import name 'CommonFrame' from partially initialized module 'netex.netex_framework.netex_frames.netex_common_frame_version' (most likely due to a circular import) (/tmp/netex/netex/netex_framework/netex_frames/netex_common_frame_version.py)"
The text was updated successfully, but these errors were encountered: