-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
[Modelina] Add support for Python 3.x #975
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
@avineshwar have you checked out the If you have, do you mind clarifying how the current python output is insufficient to your liking? |
I guess it's about Implicit-related imports which will not work with Python 3.3+: |
That should be manageable, we also have different import ways for TypeScript. |
Could you please suggest a proper way to implement an import differently? const models = await generator.generateCompleteModels(spec, {});
const libraryDependencies = new Set(models.flatMap(m => m.dependencies));
for (const model of models) {
await writeFile(`${outputDirectory}/${model.modelName}.py`,
model.result
.split('\n')
.map(s => {
if (libraryDependencies.has(s)) {
return s;
}
if (s.startsWith('from ')) {
return s.replace('from ', 'from .');
}
return s;
})
.map(s => `${s}\n`)
.filter(s => s !== '\n'));
}
|
If the Do you have a suggestion for an option you can provide with the function? That we can use inside the python renderer to render appropriate dependencies? |
@jonaslagoni please check the attached PR. Hope that it would do the trick #981 |
I am gonna close this issue for now as a fix is in place. Feel free to reopen @avineshwar if you don't find it solved it. |
Reason/Context
Please try answering few of those questions
Description
Please try answering few of those questions
The text was updated successfully, but these errors were encountered: