-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Should astroid adhere to ast
's module API ?
#1361
Comments
I was the one who argued against merging #1218. Although we should try to keep roughly the same structure as the I would be interested to know why you wanted to replace As it stands now, I would suggest against it. |
Hello,
I understand that. Some nodes are not present in ast module, and that's OK. I just want to help out and provide a more ast-like inferface and helper functions. Just so the move
Thanks for your intersest, happy to provide additionnal informations. I'm building a parser to extract complete project structure in order to generate API documentation or other things. You can check the repository here: https://github.com/tristanlatr/pydocspec . With this project, I aim to replace pydoctor's AST builder to fix some issues and provide additionnal information thanks to inference. I hope astroid will be help to solve the following issues: twisted/pydoctor#10 (MRO issue), twisted/pydoctor#208 (introspection issues, building AST from live module is a great feature), twisted/pydoctor#364 and twisted/pydoctor#348 semantic analysis). To be more precise, Overall these utility function are very useful and I think astroid should offer the alternatives for functions that are present in the standard library. Converting code from Two weeks ago, the documentation said that the astroid nodes extends standard library nodes, so I had this idea of compatibility? ^^ If the features are well tested and not very complex, I don't see why not accepting such improvments. Talk to you later, |
Thanks for taking the time to explain it!
I would to disagree. In contrast to So why not add it regardless? Someone still needs to maintain it which does increase the overall workload. Even if it's tested who is to say that sometime in the future a Python change won't break it or worse, in the case of In summary, I do think that your use case is interesting. However, since it's not entirely what astroid is designed for, I don't think we should add these helpers for the time being. |
I don’t see why you say that I’m using astroid for a purpose that it wasn’t designed for. All I’m doing to switch from Can you elaborate on why the copy location usage seems wrong to you (the lineno information is going to be correct) ? All I’m saying is that it’s much more difficult that I thought to switch to So I’m a bit disappointed here, I realize that I’ll have to keep all my code that replicate de standard library, but with talk to you later, |
The way I see it, astroid is there to provide ast helper with inference for pylint. It may be used differently, but in that case you would be on your own. I.e. no guarantees that astroid will officially support it.
In your cases it isn't. That doesn't mean though that plugins should use it.
Again, |
Context: @tristanlatr opened issues lately after trying to replace
ast
byastroid
in their project. And we're not experienced enough with astroid to decide if we should add astroid's version of ast's api functionWe decided recentely that we were an "interface above ast" and rejected a merge request fixing consistency lately. I don't have strong opinion about past decisions, there's probably arguments for both side of the issue.
Pro:
Con:
@hippo91 @shlomme @brycepg @AWhetter what's your opinion on the matter ? Should astroid implement ast's API so we can switch astroid's objects with ast's objects and so astroid has ast's adapted functions too ? I suppose @thejcannon and @cdce8p would be interested in the discussion too :)
Also @tristanlatr as you see there's positions open for astroid maintenance. From the issues you opened you seem to know what you're talking about :)
The text was updated successfully, but these errors were encountered: