warn("hello")/tmp/ipykernel_1295329/502382720.py:1: UserWarning: hello
warn("hello")
To use this module you need to setup GitHub personal access token, which is a secret code used to access your account.
If you don’t have one, click here to create one. You’ll be asked to enter a name – choose anything you like, for instance “oztools”. In “scopes” choose “repo”, “gist”, “notifications”, and “workflow”. Then clock “Generate Token” and copy the token. Then add it for example to your .bashrc as export GITHUB_TOKEN="<your github token goes here>".
get_token_and_username ()
Type: module String form: <module 'oztools' from '/home/mu/nbdev/oztools/oztools/__init__.py'> File: ~/nbdev/oztools/oztools/__init__.py Docstring: <no docstring>
--------------------------------------------------------------------------- HTTP404NotFoundError Traceback (most recent call last) Cell In[16], line 1 ----> 1 api.repos.get_latest_pages_build('make_llm') File ~/python/venv/lib/python3.12/site-packages/ghapi/core.py:74, in _GhVerb.__call__(self, headers, *args, **kwargs) 71 for a,b in zip(args,flds): kwargs[b]=a 72 route_p,query_p,data_p = [{p:kwargs[p] for p in o if p in kwargs} 73 for o in (self.route_ps,self.params,d)] ---> 74 return self.client(self.path, self.verb, headers=headers, decode=self.decode, route=route_p, query=query_p, data=data_p) File ~/python/venv/lib/python3.12/site-packages/ghapi/core.py:133, in GhApi.__call__(self, path, verb, headers, route, query, data, timeout, decode) 131 return_json = ('json' in headers['Accept']) and (decode is True) 132 debug = self.debug if self.debug else print_summary if os.getenv('GHAPI_DEBUG') else None --> 133 res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, decode=decode, debug=debug, return_headers=True, 134 route=route or None, query=query or None, data=data or None, return_json=return_json, timeout=timeout) 135 if 'X-RateLimit-Remaining' in self.recv_hdrs: 136 newlim = self.recv_hdrs['X-RateLimit-Remaining'] File ~/python/venv/lib/python3.12/site-packages/fastcore/net.py:221, in urlsend(url, verb, headers, decode, route, query, data, json_data, return_json, return_headers, debug, timeout) 218 if route and route.get('archive_format', None): 219 return urlread(req, decode=False, return_json=False, return_headers=return_headers, timeout=timeout) --> 221 return urlread(req, decode=decode, return_json=return_json, return_headers=return_headers, timeout=timeout) File ~/python/venv/lib/python3.12/site-packages/fastcore/net.py:122, in urlread(url, data, headers, decode, return_json, return_headers, timeout, **kwargs) 120 with urlopen(url, data=data, headers=headers, timeout=timeout, **kwargs) as u: res,hdrs = u.read(),u.headers 121 except HTTPError as e: --> 122 if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp, msg=e.msg) from None 123 else: raise 125 if decode: res = res.decode() HTTP404NotFoundError: HTTP Error 404: Not Found ====Error Body==== { "message": "Not Found", "documentation_url": "https://docs.github.com/rest/pages/pages#get-latest-pages-build", "status": "404" }
gh_licenses ()
List GitHub license templates
TODO: It would be nice if @call_parse created not just a cli wrapper, but also a raw function
gh_new_repo_fn (name, description, license, private)
gh_new_repo (name:str, description:str, license:str='Apache-2.0', private:bool=False)
Create a new github repo and clone it
commit_and_push (repo:git.repo.base.Repo, msg:str)
| Type | Details | |
|---|---|---|
| repo | Repo | Repo to commit and push |
| msg | str | Commit message |
add_new_branch (repo:git.repo.base.Repo, branch_name:str)
Create new branch and push it to upstream
Note that we need to split setting up branch in two parts so that if we decide to commit something after setting up gh-pages branch, it won’t interrupt page deployment.
setup_pages_branch_location (local_repo:git.repo.base.Repo, repo_name:str)
setup_pages_branch (local_repo:git.repo.base.Repo, repo_name:str)