-
Notifications
You must be signed in to change notification settings - Fork 824
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
expose livehtml autobuild in Makefile + Add API autodoc #971
expose livehtml autobuild in Makefile + Add API autodoc #971
Conversation
I've been building a list of issues and suggestions for the docs over the last little while, and in a few PRs, you've managed to address most of them, at least as a very solid foundation. Kudos! One of the biggest was the lack of an fundamental Here's hoping that bit, at the very least, is adopted ASAP. |
@changeling thanks! please contribute some suggestions for documentation in this issue: #925 I'm hoping that with a good base document we can soon prioritize things into small chunks that more folks can contribute and polish it up nicely. |
@dvndrsn, will do. I've been away for a week(-ish) in real life, so lemme go through my notes to catch back up. I've begun basic FAQs in the I'd like to be more involved in the docs development going forward, and will look at my notes to see what, if anything, you've not already addressed in your PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! I've added some (quite nitpicky) comments but overall this is so great.
Thanks for the feedback @jkimbo! I accepted your suggestions and replied to your comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though mebbe run black on the docstings code snippets.
graphene/types/argument.py
Outdated
|
||
.. code:: python | ||
|
||
age = graphene.String( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to run black on code snippets in docstrings here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
age = graphene.String(
# Boolean implicitly mounted as Argument
dog_years=graphene.Boolean(description="convert to dog years"),
# Boolean explicitly mounted as Argument
decades=graphene.Argument(graphene.Boolean, default_value=False),
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I omit graphene.<Whatever>
like you did in your PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote yes on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes from me too
Co-Authored-By: Jonathan Kim <[email protected]>
Co-Authored-By: Jonathan Kim <[email protected]>
Co-Authored-By: Jonathan Kim <[email protected]>
Co-Authored-By: Jonathan Kim <[email protected]>
947c00c
to
67f6976
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more suggestions (dropping the graphene
in places) just for you to easily accept them. Happy to see this merged whenever you want though.
graphene/types/enum.py
Outdated
|
||
.. code:: python | ||
|
||
class NameFormat(graphene.Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class NameFormat(graphene.Enum): | |
class NameFormat(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to keep graphene to show exactly which Enum
we mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be worth a larger conversation. Naming collisions with python modules like enum.Enum, for example. Perhaps a naming protocol going forward?
As @ProjectCheshire pointed out in https://graphenetools.slack.com/archives/CGR4VCHUL/p1559524808014100, core-next has these types available as, for example:
from graphql import (
GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString)
See https://graphql-core-next.readthedocs.io/en/latest/intro.html#getting-started
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep the import close in all examples to avoid confusion.
Agree with @phalt that the clash for name Enum
is a little confusing. I do prefer the shorter names in code as these objects are used very often in the schema. GraphQL
as a prefix seems like overkill in most cases (especially given the namespace graphql
and graphene
for the module).
graphene/types/inputobjecttype.py
Outdated
|
||
.. code:: python | ||
|
||
class Person(graphene.InputObjectType): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class Person(graphene.InputObjectType): | |
class Person(InputObjectType): |
graphene/types/interface.py
Outdated
|
||
.. code:: python | ||
|
||
class HasAddress(graphene.Interface): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class HasAddress(graphene.Interface): | |
class HasAddress(Interface): |
graphene/types/mutation.py
Outdated
|
||
.. code:: python | ||
|
||
class CreatePerson(graphene.Mutation): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class CreatePerson(graphene.Mutation): | |
class CreatePerson(Mutation): |
graphene/types/union.py
Outdated
|
||
.. code:: python | ||
|
||
class SearchResult(graphene.Union): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class SearchResult(graphene.Union): | |
class SearchResult(Union): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an awesome effort well done! Few minor points and please pin the version in requirements.
docs/requirements.txt
Outdated
@@ -1,4 +1,5 @@ | |||
# Required library | |||
Sphinx==1.5.3 | |||
sphinx-autobuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please pin this to a specific version
graphene/types/enum.py
Outdated
|
||
.. code:: python | ||
|
||
class NameFormat(graphene.Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to keep graphene to show exactly which Enum
we mean.
I'm going to try to get to these comments by the weekend so this can be merged. Lil crazy this week. |
graphene/types/enum.py
Outdated
@@ -67,6 +67,28 @@ def from_enum(cls, enum, description=None, deprecation_reason=None): # noqa: N8 | |||
|
|||
|
|||
class Enum(six.with_metaclass(EnumMeta, UnmountedType, BaseType)): | |||
""" | |||
Enum type defintion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum type defintion | |
Enum type definition |
dog_years=graphene.Boolean(description='convert to dog years'), | ||
# Boolean explicitly mounted as Argument | ||
decades=graphene.Argument(graphene.Boolean, default_value=False) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
age = String( | |
# Boolean implicitly mounted as Argument | |
dog_years=Boolean(description="convert to dog years"), | |
# Boolean explicitly mounted as Argument | |
decades=Argument(Boolean, default_value=False), | |
) |
Addressed comments in docs and pinning dependencies.
@jkimbo @ekampf @ProjectCheshire - this is ready to merge now. |
Autobuild was previously set up in Makefile, but did not have its requirements frozen in
requirements.txt
and the command was not documented well. Added API level documentation for parameters and arguments for the core graphene objects.make docs-live
target to the root project Makefile. This starts a live http server which refreshes with docs changes.sphinx-autobuild
to documentation requirements.autodoc
configuration to generate documentation from classes automatically.datetime.now()
by setting static values for times in tests.