Skip to content

Commit

Permalink
Upgrade documentation for migration to aiida-core 2.6
Browse files Browse the repository at this point in the history
Remove usage of `load_documentation_profile` in docs. With
aiida-core/pull/6226 the usage of load_documentation_profile is not
anymore required as the Django backend is not anymore supported and can
therefore be removed.

graphql.utils has been moved to graphql.utilities and usage of
`print_schema` has been adapted.
  • Loading branch information
agoscinski committed Nov 21, 2024
1 parent 366f036 commit c0cd9dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion aiida_restapi/graphql/orm_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@

def get_pydantic_type_name(annotation: Any) -> Any:
"""
In pydantic v1, one could do field.type_,
In pydantic v1, one could do `field.type_`,
but in v2, one has to go though field.annotation
"""

args = typing.get_args(annotation)
if args:
return args[0]
Expand Down
4 changes: 2 additions & 2 deletions aiida_restapi/graphql/sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# pylint: disable=import-outside-toplevel
from typing import TYPE_CHECKING, List

from graphql.utils.schema_printer import print_schema
from graphql.utilities import print_schema

from .main import SCHEMA

Expand All @@ -21,7 +21,7 @@ class SchemaDirective(SphinxDirective):

def run(self) -> List[Element]:
"""Run the directive."""
text = print_schema(SCHEMA)
text = print_schema(SCHEMA.graphql_schema)
# TODO for lexing tried: https://gitlab.com/marcogiusti/pygments-graphql/-/blob/master/src/pygments_graphql.py
# but it failed
code_node = literal_block(text, text) # , language="graphql")
Expand Down
8 changes: 0 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@
import sys
import time

from aiida.manage.configuration import load_documentation_profile

import aiida_restapi

# -- AiiDA-related setup --------------------------------------------------

# Load the dummy profile even if we are running locally, this way the documentation will succeed even if the current
# default profile of the AiiDA installation does not use a Django backend.
load_documentation_profile()

extensions = [
'myst_parser',
'sphinx_external_toc',
Expand Down

0 comments on commit c0cd9dc

Please sign in to comment.