fastai / ghapi

A delightful and complete interface to GitHub's amazing API
https://ghapi.fast.ai/
Apache License 2.0
618 stars 65 forks source link

Builtin documentation not working #49

Closed mkistler closed 3 years ago

mkistler commented 3 years ago

The README says:

Every part of the API includes documentation directly in the api object itself. For instance, here's how to explore the groups of functionality provided by the API by displaying the object:

api

But this doesn't work for me:

>python
Python 3.8.7 (default, Feb  3 2021, 06:31:03) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ghapi.all import GhApi
>>> api = GhApi()
>>> api
<ghapi.core.GhApi object at 0x107574460>
>>> 

What am I doing wrong?

cfriedline commented 3 years ago

@mkistler Seems like it's really notebook-centric (which works great) given it's nbdev. You've probably done this already, but I think this should give you some (relatively readable) text across the api from the REPL:

>>> from ghapi.all import GhApi
>>> api = GhApi()
>>> print(api._repr_markdown_())
- [actions](https://docs.github.com/en/free-pro-team@latest/rest/reference/actions)
- [activity](https://docs.github.com/en/free-pro-team@latest/rest/reference/activity)
- [apps](https://docs.github.com/en/free-pro-team@latest/rest/reference/apps)
- [billing](https://docs.github.com/en/free-pro-team@latest/rest/reference/billing)

...

>>> print(api.teams._repr_markdown_())
- [teams.list_idp_groups_for_org](https://docs.github.com/rest/reference/teams#list-idp-groups-for-an-organization)(org, per_page, page): *List IdP groups for an organization*
- [teams.list](https://docs.github.com/v3/teams/#list-teams)(org, per_page, page): *List teams*
- [teams.create](https://docs.github.com/v3/teams/#create-a-team)(org, name, description, maintainers, repo_names, privacy, permission, parent_team_id): *Create a team*
- [teams.get_by_name](https://docs.github.com/v3/teams/#get-a-team-by-name)(org, team_slug): *Get a team by name*
- [teams.update_in_org](https://docs.github.com/v3/teams/#update-a-team)(org, team_slug, name, description, privacy, permission, parent_team_id): *Update a team*
- [teams.delete_in_org](https://docs.github.com/v3/teams/#delete-a-team)(org, team_slug): *Delete a team*

This model also makes it hard to get good IDE support (PyCharm), too. 😞

hamelsmu commented 3 years ago

You can get completion in the CLI as well as long as you follow these instructions

You can also get tab completion in notebooks or in a iPython shell. But not a regular python shell. You need a coding environment that is able to introspect live objects, as the tab completion is dynamic :)

image