-
Notifications
You must be signed in to change notification settings - Fork 6
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
__all__
generation? (and other things)
#1
Comments
Hey @vltr, thanks for giving my tool a try! It's a huge motivator to see this kind of constructive feedback. Lets go point by point.
|
I'm glad to help, @Erotemic ! Just like
Anyway, one thing that came to mind now is that using |
I wasn't aware of
My earlier point was not about For the remaining point 1 and 2, I'm going to make new issues. I'll leave this issue open as a milestone until the all points are satisfied. |
Sorry for the delay! I was using autopep8 as well, but
I understood what you told about |
The newest While this doesn't implement pattern matching, you can use the
If you think pattern matching is absolutely necessary, it may be reasonable to allow glob-style strings as items in these lists. I think if that feature lands, then all 5 points will be checked off correct? Note, that the first feature can be handled by specifying an |
Hello @Erotemic ! Thanks a lot for the heads up, I had no time to add
Well, yes. I really don't mind (myself) about pattern matching, but I've seen countless Python source codes to know that this is in fact a requirement, but I think a glob matching would do almost all the job. Example glob matching patterns I have found in the wild (but I don't recall now where (exactly)):
Other cases would require a more complex pattern matching, like any stdlib import, some internal flags (like But, as always, good work on |
Hi! First of all, thanks for this nice tool! I think this tool is something rarely perceived but a very common task for Python programmers and it is super welcome!
Anyway, not that this is an issue, I assume that there are plans to implement this (for linter happiness), but I could also give some thoughts about the
__all__
variable because not every single variable from a certain module is needed in the__init__.py
file, like an import from another module. So, I can define what I want inside__all__
and that's what will shows up in the__init__.py
file for that module, right?Well, I want to share some situations ... I'm not here to say "hey, this tool is worthless because it doesn't check this or that", but rather give my use case so you can evolve it in the right direction 😉 I really appreciate your effort!
models.py
file), and I don't want to export anything but my model classes, so I'll do something like this:Unfortunately, this doesn't work with static
mkinit
generation ... Mostly because of the AST, I presume? Given the module root, the AST shouldn't be able to retrive the__all__
variable result? In this case, it's a plain module.__init__.py
we could define some filters to what should or shouldn't belong to the__init__.py
file? Example:__init__.py
file like this (see comments in code):mkinit
could (optionally) create the__all__
variable at the end of the file /AUTOGEN_INIT
block ... Assuming the above example:Well, those are all ideas and possible proposals that would significantly boost productivity, at least in my use case. Again, this issue is just to give an use case and opinion on how
mkinit
could be a really awesome tool (to me). I'm not here to give destructive thoughts, since I already think this is a great tool and can evolve to something really, really slick in the future! 😄My best regards and thanks for your work!!
Richard.
The text was updated successfully, but these errors were encountered: