From 4ad34a6392d70a945278073de531755a839d9faa Mon Sep 17 00:00:00 2001 From: Altynbek Orumbayev Date: Tue, 16 Jul 2024 18:28:16 +0200 Subject: [PATCH] remove h3 heading from initialization sections --- .../algokit_utils/algokit_utils.md.txt | 45 ++++-------- .../apidocs/algokit_utils/algokit_utils.html | 30 ++++---- .../apidocs/algokit_utils/algokit_utils.md | 30 ++++---- docs/source/conf.py | 71 +++++++++++++++++++ 4 files changed, 116 insertions(+), 60 deletions(-) diff --git a/docs/html/_sources/apidocs/algokit_utils/algokit_utils.md.txt b/docs/html/_sources/apidocs/algokit_utils/algokit_utils.md.txt index 3978f1b..75b6f35 100644 --- a/docs/html/_sources/apidocs/algokit_utils/algokit_utils.md.txt +++ b/docs/html/_sources/apidocs/algokit_utils/algokit_utils.md.txt @@ -151,8 +151,7 @@ Bases: {py:obj}`algokit_utils.deploy.DeployCallArgsDict`, {py:obj}`typing.TypedD :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.ABICallArgsDict.__init__ :parser: myst @@ -182,8 +181,7 @@ Bases: {py:obj}`algokit_utils.deploy.DeployCreateCallArgsDict`, {py:obj}`typing. :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.ABICreateCallArgsDict.__init__ :parser: myst @@ -401,8 +399,7 @@ Bases: {py:obj}`algokit_utils.deploy.AppReference`, {py:obj}`algokit_utils.deplo :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.application_client.ApplicationClient.__init__ :parser: myst @@ -655,8 +652,7 @@ Bases: {py:obj}`enum.IntFlag` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.application_specification.CallConfig.__init__ :parser: myst @@ -730,8 +726,7 @@ Bases: {py:obj}`typing.TypedDict`, {py:obj}`algokit_utils.models.OnCompleteCallP :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.models.CreateCallParametersDict.__init__ :parser: myst @@ -761,8 +756,7 @@ Bases: {py:obj}`typing.TypedDict` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.application_specification.DefaultArgumentDict.__init__ :parser: myst @@ -790,8 +784,7 @@ Bases: {py:obj}`typing.TypedDict` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.DeployCallArgsDict.__init__ :parser: myst @@ -821,8 +814,7 @@ Bases: {py:obj}`algokit_utils.deploy.DeployCallArgsDict`, {py:obj}`typing.TypedD :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.DeployCreateCallArgsDict.__init__ :parser: myst @@ -1000,8 +992,7 @@ Bases: {py:obj}`typing.TypedDict`, {py:obj}`algokit_utils.models.TransactionPara :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.models.OnCompleteCallParametersDict.__init__ :parser: myst @@ -1019,8 +1010,7 @@ Bases: {py:obj}`enum.Enum` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.OnSchemaBreak.__init__ :parser: myst @@ -1071,8 +1061,7 @@ Bases: {py:obj}`enum.Enum` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.OnUpdate.__init__ :parser: myst @@ -1134,8 +1123,7 @@ Bases: {py:obj}`enum.Enum` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.deploy.OperationPerformed.__init__ :parser: myst @@ -1195,8 +1183,7 @@ Bases: {py:obj}`enum.Enum` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.common.Program.__init__ :parser: myst @@ -1212,8 +1199,7 @@ Bases: {py:obj}`enum.Enum` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.dispenser_api.TestNetDispenserApiClient.__init__ :parser: myst @@ -1388,8 +1374,7 @@ Bases: {py:obj}`typing.TypedDict` :parser: myst ``` -```{rubric} Initialization -``` +Initialization ```{autodoc2-docstring} algokit_utils.models.TransactionParametersDict.__init__ :parser: myst diff --git a/docs/html/apidocs/algokit_utils/algokit_utils.html b/docs/html/apidocs/algokit_utils/algokit_utils.html index dbb26e7..865c604 100644 --- a/docs/html/apidocs/algokit_utils/algokit_utils.html +++ b/docs/html/apidocs/algokit_utils/algokit_utils.html @@ -363,7 +363,7 @@

Classesalgokit_utils.deploy.DeployCallArgsDict, typing.TypedDict

ABI Parameters used to update or delete an application when calling deploy()

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -379,7 +379,7 @@

Classesclass algokit_utils.ABICreateCallArgsDict

Bases: algokit_utils.deploy.DeployCreateCallArgsDict, typing.TypedDict

ABI Parameters used to create an application when calling deploy()

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -511,7 +511,7 @@

Classes class algokit_utils.ApplicationClient(algod_client: algosdk.v2client.algod.AlgodClient, app_spec: algokit_utils.application_specification.ApplicationSpecification | pathlib.Path, *, app_id: int = 0, creator: str | algokit_utils.models.Account | None = None, indexer_client: IndexerClient | None = None, existing_deployments: algokit_utils.deploy.AppLookup | None = None, signer: algosdk.atomic_transaction_composer.TransactionSigner | algokit_utils.models.Account | None = None, sender: str | None = None, suggested_params: algosdk.transaction.SuggestedParams | None = None, template_values: algokit_utils.deploy.TemplateValueMapping | None = None, app_name: str | None = None)

A class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app

-

Initialization

+

Initialization

ApplicationClient can be created with an app_id to interact with an existing application, alternatively it can be created with a creator and indexer_client specified to find existing applications by name and creator.

@@ -755,7 +755,7 @@

Classesclass algokit_utils.CallConfig

Bases: enum.IntFlag

Describes the type of calls a method can be used for based on algosdk.transaction.OnComplete type

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -801,7 +801,7 @@

Classestyping.TypedDict, algokit_utils.models.OnCompleteCallParametersDict

Additional parameters that can be included in a transaction when using the ApplicationClient.create/compose_create methods

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -818,7 +818,7 @@

Classestyping.TypedDict

DefaultArgument is a container for any arguments that may be resolved prior to calling some target method

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -835,7 +835,7 @@

Classestyping.TypedDict

Parameters used to update or delete an application when calling deploy()

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -851,7 +851,7 @@

Classesclass algokit_utils.DeployCreateCallArgsDict

Bases: algokit_utils.deploy.DeployCallArgsDict, typing.TypedDict

Parameters used to create an application when calling deploy()

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -961,7 +961,7 @@

Classestyping.TypedDict, algokit_utils.models.TransactionParametersDict

Additional parameters that can be included in a transaction when using the ApplicationClient.call/compose_call methods

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

@@ -970,7 +970,7 @@

Classesclass algokit_utils.OnSchemaBreak(*args, **kwds)

Bases: enum.Enum

Action to take if an Application’s schema has breaking changes

-

Initialization

+

Initialization

AppendApp
@@ -999,7 +999,7 @@

Classesclass algokit_utils.OnUpdate(*args, **kwds)

Bases: enum.Enum

Action to take if an Application has been updated

-

Initialization

+

Initialization

AppendApp
@@ -1035,7 +1035,7 @@

Classesclass algokit_utils.OperationPerformed(*args, **kwds)

Bases: enum.Enum

Describes the actions taken during deployment

-

Initialization

+

Initialization

Create
@@ -1070,7 +1070,7 @@

Classes class algokit_utils.Program(program: str, client: algosdk.v2client.algod.AlgodClient)

A compiled TEAL program

-

Initialization

+

Initialization

Fully compile the program source to binary and generate a source map for matching pc to line number

@@ -1084,7 +1084,7 @@

ClassesALGOKIT_DISPENSER_ACCESS_TOKEN, and it will be auto loaded. If both are set, the constructor argument takes precedence.

Default request timeout is 15 seconds. Modify by passing request_timeout to the constructor.

-

Initialization

+

Initialization

fund(address: str, amount: int, asset_id: int) algokit_utils.dispenser_api.DispenserFundResponse
@@ -1186,7 +1186,7 @@

Classesclass algokit_utils.TransactionParametersDict

Bases: typing.TypedDict

Additional parameters that can be included in a transaction

-

Initialization

+

Initialization

Initialize self. See help(type(self)) for accurate signature.

diff --git a/docs/markdown/apidocs/algokit_utils/algokit_utils.md b/docs/markdown/apidocs/algokit_utils/algokit_utils.md index f191bb7..c301f7f 100644 --- a/docs/markdown/apidocs/algokit_utils/algokit_utils.md +++ b/docs/markdown/apidocs/algokit_utils/algokit_utils.md @@ -72,7 +72,7 @@ Bases: [`algokit_utils.deploy.DeployCallArgsDict`](#algokit_utils.DeployCallArgs ABI Parameters used to update or delete an application when calling [`deploy()`](#algokit_utils.ApplicationClient.deploy) -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -88,7 +88,7 @@ Bases: [`algokit_utils.deploy.DeployCreateCallArgsDict`](#algokit_utils.DeployCr ABI Parameters used to create an application when calling [`deploy()`](#algokit_utils.ApplicationClient.deploy) -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -197,7 +197,7 @@ Information about an Algorand app A class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app -### Initialization +Initialization ApplicationClient can be created with an app_id to interact with an existing application, alternatively it can be created with a creator and indexer_client specified to find existing applications by name and creator. @@ -381,7 +381,7 @@ Bases: [`enum.IntFlag`](https://docs.python.org/3/library/enum.html#enum.IntFlag Describes the type of calls a method can be used for based on [`algosdk.transaction.OnComplete`](https://py-algorand-sdk.readthedocs.io/en/latest/algosdk/transaction.html#algosdk.transaction.OnComplete) type -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -423,7 +423,7 @@ Bases: [`typing.TypedDict`](https://docs.python.org/3/library/typing.html#typing Additional parameters that can be included in a transaction when using the ApplicationClient.create/compose_create methods -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -440,7 +440,7 @@ Bases: [`typing.TypedDict`](https://docs.python.org/3/library/typing.html#typing DefaultArgument is a container for any arguments that may be resolved prior to calling some target method -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -456,7 +456,7 @@ Bases: [`typing.TypedDict`](https://docs.python.org/3/library/typing.html#typing Parameters used to update or delete an application when calling [`deploy()`](#algokit_utils.ApplicationClient.deploy) -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -472,7 +472,7 @@ Bases: [`algokit_utils.deploy.DeployCallArgsDict`](#algokit_utils.DeployCallArgs Parameters used to create an application when calling [`deploy()`](#algokit_utils.ApplicationClient.deploy) -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -565,7 +565,7 @@ Bases: [`typing.TypedDict`](https://docs.python.org/3/library/typing.html#typing Additional parameters that can be included in a transaction when using the ApplicationClient.call/compose_call methods -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. @@ -575,7 +575,7 @@ Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum) Action to take if an Application’s schema has breaking changes -### Initialization +Initialization #### AppendApp @@ -601,7 +601,7 @@ Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum) Action to take if an Application has been updated -### Initialization +Initialization #### AppendApp @@ -633,7 +633,7 @@ Bases: [`enum.Enum`](https://docs.python.org/3/library/enum.html#enum.Enum) Describes the actions taken during deployment -### Initialization +Initialization #### Create @@ -663,7 +663,7 @@ An existing Application was found, but was out of date, updated to latest versio A compiled TEAL program -### Initialization +Initialization Fully compile the program source to binary and generate a source map for matching pc to line number @@ -678,7 +678,7 @@ and it will be auto loaded. If both are set, the constructor argument takes prec Default request timeout is 15 seconds. Modify by passing `request_timeout` to the constructor. -### Initialization +Initialization #### fund(address: [str](https://docs.python.org/3/library/stdtypes.html#str), amount: [int](https://docs.python.org/3/library/functions.html#int), asset_id: [int](https://docs.python.org/3/library/functions.html#int)) @@ -762,7 +762,7 @@ Bases: [`typing.TypedDict`](https://docs.python.org/3/library/typing.html#typing Additional parameters that can be included in a transaction -### Initialization +Initialization Initialize self. See help(type(self)) for accurate signature. diff --git a/docs/source/conf.py b/docs/source/conf.py index 35b6a76..427484c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,6 +16,77 @@ class AlgoKitRenderer(MystRenderer): """ + + @te.override + def render_class(self, item: ItemData) -> t.Iterable[str]: + """Create the content for a class.""" + short_name = item["full_name"].split(".")[-1] + constructor = self.get_item(f"{item['full_name']}.__init__") + sig = short_name + if constructor and "args" in constructor: + args = self.format_args( + constructor["args"], self.show_annotations(item), ignore_self="self" + ) + sig += f"({args})" + + # note, here we can cannot yield by line, + # because we need to look ahead to know the length of the backticks + + lines: list[str] = [f":canonical: {item['full_name']}"] + if self.no_index(item): + lines += [":noindex:"] + lines += [""] + + # TODO overloads + + if item.get("bases") and self.show_class_inheritance(item): + lines += [ + "Bases: " + + ", ".join( + [self._reformat_cls_base_myst(b) for b in item.get("bases", [])] + ), + "", + ] + + if self.show_docstring(item): + lines.append(f"```{{autodoc2-docstring}} {item['full_name']}") + if parser_name := self.get_doc_parser(item["full_name"]): + lines.append(f":parser: {parser_name}") + lines.append("```") + lines.append("") + + if self.config.class_docstring == "merge": + init_item = self.get_item(f"{item['full_name']}.__init__") + if init_item: + lines.extend( + [ + "Initialization", + "", + f"```{{autodoc2-docstring}} {init_item['full_name']}", + ] + ) + if parser_name := self.get_doc_parser(init_item["full_name"]): + lines.append(f":parser: {parser_name}") + lines.extend(["```", ""]) + + for child in self.get_children( + item, {"class", "property", "attribute", "method"} + ): + if ( + child["full_name"].endswith(".__init__") + and self.config.class_docstring == "merge" + ): + continue + for line in self.render_item(child["full_name"]): + lines.append(line) + + backticks = self.enclosing_backticks("\n".join(lines)) + yield f"{backticks}{{py:{item['type']}}} {sig}" + for line in lines: + yield line + yield backticks + yield "" + @te.override def render_package(self, item: ItemData) -> t.Iterable[str]: # noqa: C901 if self.standalone and self.is_hidden(item):