Roadmap for 1.0 #122
Roadmap for 1.0 #122
Comments
I'd like to entertain the idea of using the "Null Object Pattern" in github3.py following a discussion a while back with @doismellburning on Twitter. We could either use this quick implementation I whipped up: class NullObject(object):
def __init__(self, initializer=None):
self.__dict__['initializer'] = initializer
def __repr__(self):
return '<NullObject({0})>'.format(
repr(self.__getattribute__('initializer'))
)
def __getitem__(self, index):
return self
def __setitem__(self, index, value):
pass
def __getattr__(self, attr):
return self
def __setattr__(self, attr, value):
pass
def __call__(self, *args, **kwargs):
return self
def __contains__(self, other):
return False Or a different library that perhaps provides a more complete implementation since I'm sure I'm missing important magic methods. The above, however, represent only what we will need from a Null object. The instances this would be used are in the methods that currently either return an object (e.g., Repository, User, Team, Organization, etc.) or Returning import github3
u = github3.user('sigmavirus23') In this case if u:
# Do something with u And this becomes a pattern/anti-pattern. What if you could do: import github3
u = github3.user('sigmavirus23')
for follower in u.iter_followers():
follower.follow() You would have no exceptions and no need to check for I'd like feedback from heavy users like @douglarek and @seveas too since they're the first ones that come to mind. Of course feedback here, or via email from other users who I'm not so familiar with is also very sincerely appreciated. |
@sigmavirus24 This is a good idea, and it reduces the need for conditional statements |
I'm impatient so I'm starting work on 1.0 on a branch on here but NO ONE SHOULD USE IT. It will be incredibly unstable for a while. |
The |
Is this up to date? Been watching the recent aactivity --- looking forward to 1.0! |
I'm working on 1.0 right now on the 1.0-alpha branch. It's slow work but if people would like to carve out some chunks for themselves that would be awesome. Right now I'm working on renaming all of the |
FWIW, I think all the |
I saw you've pushed Do you recommend porting applications to it yet, or is it better waiting for you to push the final |
I think I will push a beta release soon which will be the best thing for applications to use to start porting. |
Strictly for 1.0
iter_*
methods to*
, e.g.,iter_pulls
->pulls
.to_json
toas_json
. (thanks @esacteksab)requests.Session
object to allow for completion of #79_api
attribute tourl
(orapi_url
) attribute to publicly expose it.NullObject
Can be introduced before 1.0
Possibly not necessary
#119The text was updated successfully, but these errors were encountered: