Skip to content

Commit

Permalink
docs: few tweaks post release (#465)
Browse files Browse the repository at this point in the history
* update init tests
* add a bit more detail about client generator package resolution
  • Loading branch information
neilcampbell authored Mar 27, 2024
1 parent 55676be commit a4a5645
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 deletions.
2 changes: 2 additions & 0 deletions docs/features/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ If you want to ensure typed client output stability across different environment

To make use of this feature, pass `-v`, `--version`, for example `algokit generate client --version 1.2.3 path/to/application.json`.

Alternatively, you can achieve output stability by installing the underlying [Python](https://github.com/algorandfoundation/algokit-client-generator-py) or [TypeScript](https://github.com/algorandfoundation/algokit-client-generator-ts) client generator package either locally in your project (via `poetry` or `npm` respectively) or globally on your system (via `pipx` or `npm` respectively). AlgoKit will search for a matching installed version before dynamically resolving.

### Usage

Usage examples of using a generated client are below, typed clients allow your favourite IDE to provide better intellisense to provide better discoverability
Expand Down
20 changes: 2 additions & 18 deletions tests/compile/test_python.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import logging
import os
import subprocess
import sys
from pathlib import Path

import pytest
from algokit.core.utils import is_windows
from pytest_mock import MockerFixture

from tests.compile.conftest import (
Expand Down Expand Up @@ -116,27 +114,13 @@ def test_puyapy_is_installed_globally(dummy_contract_path: Path, mocker: MockerF
verify(result.output)


# TODO: NC - Temporarily disable this test on windows
@pytest.mark.skipif(sys.version_info < (3, 12) or is_windows(), reason="PuyaPy requires python3.12 or higher")
@pytest.mark.skipif(sys.version_info < (3, 12), reason="PuyaPy requires python3.12 or higher")
def test_valid_contract(cwd: Path, output_path: Path) -> None:
subprocess.run([sys.executable, "-m", "venv", ".venv"], check=True, cwd=cwd)
venv_path = cwd / ".venv"

puyapy_env = {
# Set NO_COLOR to 1 to avoid requirements for colorama on Windows
"NO_COLOR": "1",
"VIRTUAL_ENV": str(venv_path),
"PYTHONHOME": "",
"PATH": (f"{venv_path / 'Scripts'};" if is_windows() else f"{venv_path / 'bin'}:" f"{os.environ['PATH']}"),
}

subprocess.run(["pip", "install", "algorand-python"], check=True, cwd=cwd, env=dict(os.environ) | puyapy_env)

contract_path = cwd / "contract.py"
contract_path.write_text(VALID_ALGORAND_PYTHON_CONTRACT_FILE_CONTENT)

result = invoke(
f"compile python {_normalize_path(contract_path)} --out-dir {_normalize_path(output_path)}", env=puyapy_env
f"--no-color compile python {_normalize_path(contract_path)} --out-dir {_normalize_path(output_path)}"
)

# Only check for the exit code, don't check the results from PuyaPy
Expand Down
5 changes: 2 additions & 3 deletions tests/init/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,10 +945,9 @@ def test_init_wizard_v2_github_folder_with_workspace_partial(
# Assert
cwd /= "myapp"
assert result.exit_code == 0
assert (cwd / "projects/myapp/.github/workflows/cd.yaml").read_text() != ""
assert (cwd / ".github/workflows/cd.yaml").read_text() == ""
assert not (cwd / "projects/myapp/.github/workflows/production-beaker-cd.yaml").exists()
assert (cwd / ".github/workflows/myapp-cd.yaml").read_text() != ""
assert cwd.glob(".github/workflows/*.yaml")
assert len(list(cwd.glob("projects/myapp/.github/workflows/*.yaml"))) == 1


def test_init_wizard_v2_github_folder_no_workspace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ Executed `algokit bootstrap all` in {current_working_directory}/myapp/projects/m
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Your selected template comes from:
➡️ https://github.com/robdmoore/copier-helloworld
DEBUG: Appended project {current_working_directory}/myapp/projects/myapp to workspace {current_working_directory}/myapp/myapp.code-workspace.
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ Executed `algokit bootstrap all` in {current_working_directory}/myapp/projects/m
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Your selected template comes from:
➡️ https://github.com/robdmoore/copier-helloworld
DEBUG: Appended project {current_working_directory}/myapp/projects/myapp to workspace {current_working_directory}/myapp/myapp.code-workspace.
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ Executed `algokit bootstrap all` in {current_working_directory}/myapp/projects/m
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Your selected template comes from:
➡️ https://github.com/robdmoore/copier-helloworld
DEBUG: Appended project {current_working_directory}/myapp/projects/myapp to workspace {current_working_directory}/myapp/myapp.code-workspace.

1 comment on commit a4a5645

@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
   __init__.py15753%6–13, 17–24, 32–34
   __main__.py440%1–7
src/algokit/cli
   __init__.py47198%34
   completions.py108298%83, 98
   dispenser.py121199%77
   doctor.py49394%143–145
   explore.py501276%34–39, 41–46
   generate.py70396%76–77, 155
   goal.py44198%71
   init.py3092492%493–494, 499–500, 503, 524, 527–529, 540, 544, 602, 628, 657, 690, 699–701, 704–709, 722, 741, 753–754
   localnet.py1191587%74–78, 111, 123, 138–148, 161, 206, 227–228
   task.py34391%25–28
src/algokit/cli/common
   utils.py26292%120, 123
src/algokit/cli/project
   deploy.py992080%47, 49, 101, 124, 146–148, 227, 234, 248–256, 259–268
   link.py891682%60, 65–66, 101–105, 115–120, 148–149, 218–219, 223
   list.py33585%21–23, 51–56
   run.py46393%38, 71, 160
src/algokit/cli/tasks
   analyze.py81199%81
   assets.py821384%65–66, 72, 74–75, 105, 119, 125–126, 132, 134, 136–137
   ipfs.py51884%52, 80, 92, 94–95, 105–107
   mint.py66494%48, 70, 91, 250
   send_transaction.py651085%52–53, 57, 89, 158, 170–174
   sign_transaction.py59886%21, 28–30, 71–72, 109, 123
   transfer.py39392%26, 90, 117
   utils.py994555%26–34, 40–43, 75–76, 100–101, 125–133, 152–162, 209, 258–259, 279–290, 297–299
   vanity_address.py561082%41, 45–48, 112, 114, 121–123
   wallet.py79495%21, 66, 136, 162
src/algokit/core
   conf.py57984%12, 24, 28, 36, 38, 73–75, 80
   dispenser.py2022687%91, 123–124, 141–149, 191–192, 198–200, 218–219, 259–260, 318, 332–334, 345–346, 356, 369, 384
   doctor.py65789%67–69, 92–94, 134
   generate.py48394%44, 81, 99
   goal.py60395%30–31, 41
   init.py651085%51, 55–60, 68, 79, 86, 106–107
   log_handlers.py68790%50–51, 63, 112–116, 125
   proc.py45198%98
   sandbox.py2181892%62, 73–75, 96, 142–149, 160, 457, 473, 498, 506
   typed_client_generation.py1732387%62–64, 77, 82, 86, 106–111, 135, 138–141, 159, 162–165, 232, 235–238
   utils.py1584671%51–52, 56–77, 134–140, 164, 167, 173–186, 207–209, 238–241, 263
   version_prompt.py921485%37–38, 68, 87–90, 108, 118–125, 148
src/algokit/core/compilers
   python.py28582%19–20, 25, 49–50
src/algokit/core/project
   __init__.py53394%50, 86, 145
   bootstrap.py120893%47, 125–126, 148, 175, 206–208
   deploy.py54983%61–64, 73–75, 79, 84
   run.py1251588%83, 88, 97–98, 133–134, 138–139, 143, 147, 261–269, 284
src/algokit/core/tasks
   analyze.py93397%105–112, 187
   ipfs.py63789%58–64, 140, 144, 146, 152
   nfd.py491373%25, 31, 34–41, 70–72, 99–101
   vanity_address.py903462%49–50, 54, 59–75, 92–108, 128–131
   wallet.py71593%37, 129, 155–157
src/algokit/core/tasks/mint
   mint.py781087%123–133, 187
   models.py901188%50, 52, 57, 71–74, 85–88
TOTAL428751888% 

Tests Skipped Failures Errors Time
482 0 💤 0 ❌ 0 🔥 32.239s ⏱️

Please sign in to comment.