-
Notifications
You must be signed in to change notification settings - Fork 670
refactor(v4): split objects and managers per API resource #1288
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
Conversation
That's a nice MR 👍 Will indeed take some time to review 😄 |
Understandable 😄 I found that with So it'd show it's mostly just cut/paste :) I couldn't really find a good GUI difftool that does it well for moves across files but I'm sure there's some out there, if it makes it a bit clearer. |
Thanks for all the refactoring done here 👍 |
@nejch very nice work! @max-wittig a heavy review 😄 |
@nejch Any plans on doing something similar for gitlab/init.py ? |
I wasn't currently working on anything, but maybe it would make sense to take the class out into something like a |
Thanks. I'll try to do a PR and move most of what is in |
This one is huge, so sorry 🙈 It does what #997 was for (splitting the 6000 line monster), but with less restructuring (only splitting the resources into modules). I'm not sure if all the importing is the best approach, but it's quite explicit.
I can imagine this is too much for review so I can try to split it, but the managers were quite intertwined so I was fixing things along the way. Here is the new import chain (mostly due to Project and Group including many other managers) - output of
pydeps --rmprefix='gitlab.v4.objects.' --only='gitlab.v4.objects' gitlab/v4/objects/__init__.py
:Each module only imports the managers it needs, while
__init__.py
does a star import of all of them for backwards compatibility. Each module exports only its own classes for the star import explicitly via__all__
.In the end this needed to happen in my opinion as well, to keep sane file sizes. But not sure what's more painful, reviewing this big PR or doing it in stages. I'm sure there are better ways to do this so if anyone has ideas, while keeping backwards compatibility, I'd be open too! :)
If this gets merged I can rebase other people's PR's touching
objects
so it's not too demotivating for them.This would now roughly imitate the structure of the GitLab API docs and gitlab's own
lib/api
directory: