Skip to content

Commit

Permalink
docs: document all public symbols (#13)
Browse files Browse the repository at this point in the history
* docs: initial docs

* docs: document all public symbols

* chore: silence ruff for docs copyright configuration

* chore: remove autogenerated source
  • Loading branch information
daniel-makerx authored Apr 3, 2023
1 parent 173fa6b commit 954b5e1
Show file tree
Hide file tree
Showing 14 changed files with 893 additions and 62 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,7 @@ cython_debug/
# macOS
.DS_Store

# we use this file for quickly editing run/debug args, it shouldn't be committed
/args.in

# Received approval test files
*.received.*

#Sphinx
.doctrees/
docs/cli/temp.md
# ignore auto-generated sources
/docs/source/apidocs
73 changes: 73 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from sphinx.domains.python import PythonDomain

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "algokit-utils"
copyright = "2023, Algorand Foundation" # noqa: A001
author = "Algorand Foundation"
release = "1.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.githubpages",
"sphinx.ext.intersphinx",
"myst_parser",
"autodoc2",
]
templates_path = ["_templates"]
exclude_patterns = []
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"algosdk": ("https://py-algorand-sdk.readthedocs.io/en/latest", None),
"pyteal": ("https://pyteal.readthedocs.io/en/stable/", None),
}
# allows type aliases to be used as type references
PythonDomain.object_types["data"].roles = ("data", "class", "obj")


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]


# -- Options for myst ---
myst_enable_extensions = [
"colon_fence",
"fieldlist",
]


# -- Options for autodoc2 ---
autodoc2_packages = [
{
"path": "../../src/algokit_utils",
# "auto_mode": False,
},
]
autodoc2_skip_module_regexes = [r"algokit_utils\..*"]
autodoc2_module_all_regexes = [
r"algokit_utils",
]
autodoc2_docstring_parser_regexes = [
# this will render all docstrings as Markdown
(r".*", "myst"),
]
autodoc2_hidden_objects = [
"undoc", # undocumented objects
"dunder", # double-underscore methods, e.g. __str__
"private", # single-underscore methods, e.g. _private
"inherited",
]
autodoc2_render_plugin = "myst"
autodoc2_sort_names = True
autodoc2_index_template = None
17 changes: 17 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Welcome to algokit-utils's documentation!

```{toctree}
---
maxdepth: 2
caption: Contents
---
usage
apidocs/algokit_utils/algokit_utils
```

# Indices and tables

* {ref}`genindex`
* {ref}`modindex`
* {ref}`search`
17 changes: 17 additions & 0 deletions docs/source/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Usage

## Installation

To use algokit-utils, first install it using pip:

```{code-block} console
(.venv) $ pip install algokit-utils
```

or alternatively add it to an existing poetry project

```{code-block} console
(.venv) $ poetry add algokit-utils
```
572 changes: 567 additions & 5 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ python-semantic-release = "*"
pytest-cov = "*"
pre-commit = "*"
python-dotenv = "^1.0.0"
sphinx = "^6.1.3"
myst-parser = "^1.0.0"
sphinx-copybutton = "^0.5.1"
sphinx-rtd-theme = "^1.2.0"
sphinx-autodoc2 = "^0.4.2"
poethepoet = "^0.19.0"

[build-system]
requires = ["poetry-core"]
Expand Down Expand Up @@ -67,6 +73,9 @@ suppress-none-returning = true
[tool.black]
line-length = 120

[tool.poe.tasks]
docs = "sphinx-build docs/source docs/build"

[tool.pytest.ini_options]
pythonpath = ["src", "tests"]

Expand Down
10 changes: 8 additions & 2 deletions src/algokit_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
get_sandbox_default_account,
)
from algokit_utils.application_client import (
ABIArgsDict,
ABICallArgs,
ABICallArgsDict,
ABICreateCallArgs,
ABICreateCallArgsDict,
ABIMethod,
ApplicationClient,
CommonCallParameters,
CommonCallParametersDict,
Expand All @@ -32,7 +34,6 @@
)
from algokit_utils.application_specification import (
ApplicationSpecification,
AppSpecStateDict,
CallConfig,
DefaultArgumentDict,
DefaultArgumentType,
Expand All @@ -53,6 +54,8 @@
OnSchemaBreak,
OnUpdate,
OperationPerformed,
TemplateValueDict,
TemplateValueMapping,
get_creator_apps,
replace_template_variables,
)
Expand Down Expand Up @@ -86,10 +89,12 @@
"AppLookup",
"get_creator_apps",
"replace_template_variables",
"ABIArgsDict",
"ABICallArgs",
"ABICallArgsDict",
"ABICreateCallArgs",
"ABICreateCallArgsDict",
"ABIMethod",
"CommonCallParameters",
"CommonCallParametersDict",
"CreateCallParameters",
Expand All @@ -101,13 +106,14 @@
"OnUpdate",
"OnSchemaBreak",
"OperationPerformed",
"TemplateValueDict",
"TemplateValueMapping",
"Program",
"execute_atc_with_logic_error",
"get_app_id_from_tx_id",
"get_next_version",
"num_extra_program_pages",
"ApplicationSpecification",
"AppSpecStateDict",
"CallConfig",
"DefaultArgumentDict",
"DefaultArgumentType",
Expand Down
4 changes: 4 additions & 0 deletions src/algokit_utils/_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

@dataclasses.dataclass(kw_only=True)
class TransferParameters:
"""Parameters for transferring µALGOs between accounts"""

from_account: Account | AccountTransactionSigner
"""The account (with private key) or signer that will send the µALGOs"""
to_address: str
Expand Down Expand Up @@ -50,6 +52,8 @@ def _check_fee(transaction: PaymentTxn, max_fee: int | None) -> None:


def transfer(client: AlgodClient, parameters: TransferParameters) -> PaymentTxn:
"""Transfer µALGOs between accounts"""

suggested_params = parameters.suggested_params or client.suggested_params()
from_account = parameters.from_account
sender = address_from_private_key(from_account.private_key) # type: ignore[no-untyped-call]
Expand Down
7 changes: 4 additions & 3 deletions src/algokit_utils/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

__all__ = [
"create_kmd_wallet_account",
"get_account",
"get_account_from_mnemonic",
"get_or_create_kmd_wallet_account",
"get_localnet_default_account",
"get_dispenser_account",
"get_kmd_wallet_account",
"get_account",
"get_localnet_default_account",
"get_or_create_kmd_wallet_account",
"get_sandbox_default_account",
]

logger = logging.getLogger(__name__)
Expand Down
Loading

1 comment on commit 954b5e1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_utils
   _transfer.py46296%47–48
   account.py871286%59–63, 92–95, 101, 114, 138, 141, 185
   application_client.py6328986%69, 211, 227, 269, 284, 289, 309, 326, 337–339, 351, 447, 452, 454, 456, 639, 648, 657, 707, 715, 724, 768, 776, 785, 829, 837, 846, 873, 899, 907, 916, 958, 966, 975, 1035, 1050, 1068–1071, 1075, 1087–1088, 1092, 1113, 1153, 1161, 1197, 1233–1239, 1243–1248, 1250, 1306, 1313, 1336, 1428, 1487–1494, 1510, 1515–1525, 1531, 1537, 1544–1547, 1571–1576, 1596–1599, 1613
   application_specification.py962574%83, 86–95, 108, 116, 124, 153, 169, 191–200, 204
   deploy.py2672093%152, 186, 190–191, 222, 298, 302, 308–316, 333–336, 354, 450, 494–496
   logic_error.py35197%29
   network_clients.py53591%58–59, 84, 87–88
TOTAL125015488% 

Tests Skipped Failures Errors Time
96 0 💤 0 ❌ 0 🔥 1m 9s ⏱️

Please sign in to comment.