Skip to content
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

Update ABC-classroom to use pygithub rather than github3.py #72

Open
lwasser opened this issue Sep 24, 2019 · 6 comments
Open

Update ABC-classroom to use pygithub rather than github3.py #72

lwasser opened this issue Sep 24, 2019 · 6 comments
Labels
enhancement New feature or request priority

Comments

@lwasser
Copy link

lwasser commented Sep 24, 2019

pygithub is more active and has many more users. github3 hasn't been updated in over a year.

Let's consider moving to pygithub

Below is some quick code that creates a repo in the earth analytics edu org!
The one thing that i couldn't find examples for was authenticating and creating a token which does exist now via abc-init. but it seems like this should be doable via subprocess if need be altho i did see an authenticator in pygithub just no good examples of calling it.

from github import Github

# using username and password
g = Github(gh_username, password )
g = Github("token-string-here")
organization = g.get_organization("earth-analytics-edu")

# Get all repos and print them out for the earth analytics edu org
for repo in organization.get_repos():
    print(repo.name)

organization.create_repo(
        name="test-template",
        allow_rebase_merge=True,
        auto_init=False,
        description="yaas done from the API",
        has_issues=True,
        has_projects=False,
        has_wiki=False,
        private=True,
       )

This can then be used to

  1. authenticate
  2. create token with github
  3. create a new repo.

We can potentially use other parts of jed's scripts OR abc-classroom to create and initialize the local repo. there is an init function here in abc-classroom.

@lwasser lwasser added the enhancement New feature or request label Sep 24, 2019
@kcranston
Copy link
Collaborator

Just a note here that we are getting a warning about github3's import of collections (when running our tests) that will become an error with python 3.9. This is fixed on their master branch, but they haven't done a release since 2018. It does look like there has been some recent activity on the github3 project, so maybe it is getting going again?

/usr/local/miniconda3/envs/abc/lib/python3.8/site-packages/github3/structs.py:11
  /usr/local/miniconda3/envs/abc/lib/python3.8/site-packages/github3/structs.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    class GitHubIterator(models.GitHubCore, collections.Iterator):

@lwasser
Copy link
Author

lwasser commented Jan 15, 2020

oooh. could be worth opening an issue just to check that they plan to update accordingly??

@lwasser
Copy link
Author

lwasser commented Oct 21, 2021

@kcranston @nkorinek i just checked. A release for github3 was pushed to pypi and conda-forge in 2021. it fixes that error. I think we should decide whether we want to use it vs subprocess or pygithub before we really dig into tests as it will impact how we collect responses. in some cases the returned information could be formatted differently between packages for example.

karen, let me know what you think. the last commit to github3.py was 2 days ago. i just haven't taken the time to compare the two packages. we should make a decision and then close this issue and focus on tests!

@lwasser lwasser added this to the Tests for git operations milestone Oct 21, 2021
@lwasser
Copy link
Author

lwasser commented Oct 21, 2021

i'm adding this to the tests for git operations milestone

@kcranston
Copy link
Collaborator

Given the small number of API calls, I don't think we need a dependency on a github library at all. I suggest we get rid of github3 and simply call the APIs using requests.

@lwasser
Copy link
Author

lwasser commented Feb 10, 2022

@kcranston @nkorinek this can be closed when you submit the change we talked about today with updating dependencies. please reference this issue 72 when you submit so we can close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority
Projects
None yet
Development

No branches or pull requests

2 participants