Skip to content

Commit

Permalink
refactor: Expose parser enuemration and parser functions in top-level…
Browse files Browse the repository at this point in the history
… module
  • Loading branch information
pawamoy committed Oct 26, 2023
1 parent 8929409 commit 785baa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
18 changes: 5 additions & 13 deletions scripts/gen_griffe_json.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
"""Generate the credits page."""

import json

import mkdocs_gen_files

from griffe.docstrings.parsers import Parser
from griffe.encoders import JSONEncoder
from griffe.loader import GriffeLoader
import griffe

griffe = GriffeLoader().load_module("griffe")
serialized = json.dumps(
griffe,
cls=JSONEncoder,
indent=0,
full=True,
docstring_parser=Parser.google,
data = griffe.load(
"griffe",
docstring_parser=griffe.Parser.google,
docstring_options={"ignore_init_summary": True},
)
with mkdocs_gen_files.open("griffe.json", "w") as fd:
fd.write(serialized)
fd.write(data.as_json(full=True, indent=0))
5 changes: 5 additions & 0 deletions src/griffe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from griffe.agents.nodes import ObjectNode
from griffe.dataclasses import Attribute, Class, Docstring, Function, Module, Object
from griffe.diff import find_breaking_changes
from griffe.docstrings.parsers import Parser, parse_google, parse_numpy, parse_sphinx
from griffe.extensions import Extension, load_extensions
from griffe.git import load_git
from griffe.importer import dynamic_import
Expand All @@ -31,4 +32,8 @@
"Module",
"Object",
"ObjectNode",
"Parser",
"parse_google",
"parse_numpy",
"parse_sphinx",
]

0 comments on commit 785baa0

Please # to comment.