Review Blender ID addon #48024
Labels
No Label
legacy project
Infrastructure: blender.org
legacy project
Infrastructure: Websites
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status::Confirmed
Status
Duplicate
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/blender-id#48024
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey Campbell,
Can you review the Blender ID addon for inclusion in master? The README.md should contain everything needed to build, install and use the addon. I figured that to include the addon in master, we'd build it with
python setup.py bdist
and then unzip the resulting zip file into Blender's addon dir.This addon is used by the Blender Cloud addon, which we'll offer for review soon too.
Thanks!
Changed status to: 'Open'
Added subscriber: @dr.sybren
Added subscriber: @brita
Initial review:
imports should be moved inline (especially heavy modules like requests), so its not slowing down startup:
files shouldn't be created when loading the module, better do this on register instead.
profiles_path = bpy.utils.user_resource('CONFIG', "blender_id", create=True)
Suggest to use
__all__
to all py files to show whats meant for use outside the modules own code.Probably you prefer to keep this as-is, but did you consider using a single operator for
BlenderIdLogin
,BlenderIdValidate
,BlenderIdLogout
?... if there are 2+ more similar operators likely to be added which also do a single operation. They could be split into regular functions (so code remains separated). Then a single operator can call any of them based on a single enum property.Would be nice to have a template addon that uses this, some hello-world single file example.
I've moved requests and modules that are only used in one or two spots to inline. Commonly used modules (os, sys, json, bpy) have been kept at module level. I've also added support for reloading the addon. infrastructure/blender-id-addon@7721c3ff
Done in infrastructure/blender-id-addon@fc139e5bc3
Done in infrastructure/blender-id-addon@806f0c76
We feel that the current approach (3 operators) is clearer for the user, as login/logout/validate are different actions, and not three variations of the same action.
We can add that to the README.md.
We're no longer using RNA to store authentication info; see infrastructure/blender-id-addon@4b43b5d53d
Great, some other points...
Regarding having 3x operations, its OK, just wanting to avoid having every single transaction with the server adding a new operator (in the case more are needed).
The point isn't so much that there is some fixed limit to the number of operators you should define, more that operators are intended for users, not so much for defining lower level API's.
Looking into this, the blender-cloud add-on isn't even calling the operators.
So perhaps these could be removed and kept as API's the Python module exposes.
There are also some minor changes I'd suggest, made a small patch. P345
Summary
One other thing is this mixes single double quotes. Our existing convention is to use single for API identifiers/enums (what would be defines or enums in C/C++), and double-quotes for text content. No big deal but prefer this over mixing them randomly.
eg:
I don't really understand what you mean with "these could be removed and kept". The operators are needed for the GUI login/logout/verify buttons.
Good.
Sure.
This one is a bit annoying. All over the existing code PEP8 is declared at the top, which states "Hanging indents should add a level", and not two levels. PyCharm, the editor both Francesco and I use, has functionality for automatically formatting a file according to PEP8, which we use a lot. What is the reason that for RNA properties PEP8 is not followed?
I'm not a fan of adding semantics to the different quote styles. I do agree that consistency is nice, so I'll change them to single quotes, unless a single quote is part of the quoted string. This is also the behaviour of Python itself when printing repr(string), and consistent with PEP8.
Quick reply to some of these issues...
Grepped Py source for blender-cloud for
"\.logout"
&_OT_logout
and didn't see any results. if they're needed, fine to keep of course.Regarding
"Hanging indents should add a level"
, this is indeed annoying. Note that when the code was written none of the error checkers reported on this (pep8/flake8/pyflakes/pylint ~ one of these is newer and wasn't around at the time but cant recall which :)).The warnings were made more strict later (and quieting them would cause a lot of minor changes all over).
Having said that, checked the changes in my patch and they aren't causing these warnings for flake8.
So fine to leave as-is, just noting on my own preference/conventions, which in this case afaics don't conflict with pep8.
Added subscriber: @fsiddi
Hi there @ideasman42!
We would like to proceed with the inclusion of the add-on as "official" in the upcoming Blender release. As originally requested, there is now a very clear use-case for it.
Let us know if there is anything else we can do.
Changed status from 'Open' to: 'Resolved'
Add-on has been merged!