Skip to content

Commit

Permalink
chore: minor refinements in bootstrap command references (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev authored Mar 29, 2024
1 parent a4a5645 commit 4321487
Show file tree
Hide file tree
Showing 49 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AlgoKit development is done within the [AlgoKit Guiding Principles](./docs/algok
- If you're not using PyCharm, then run `poetry install` in the repository root directory (this should set up `.venv` and install all Python dependencies - PyCharm will do this for you on startup)
- Via AlgoKit CLI:

- [Install AlgoKit CLI](./README.md#install) and run `algokit bootstrap poetry` in the root directory
- [Install AlgoKit CLI](./README.md#install) and run `algokit project bootstrap poetry` in the root directory
- Install `tealer` - by running `pipx install tealer==0.1.2`. This is a prerequisite to running `pytest`, tealer is a third party tool for static analysis of TEAL code, algokit uses it in `task analyse` command. AlgoKit uses `pytest-xdist` to speed up the test suite execution by running tests in parallel, this requires `tealer` to be installed globally to avoid race conditions.

3. Install pre-commit hooks (optional but recommended):
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ for template specific questions to be used in template rendering.
Templates can be default templates shipped with AlgoKit, or custom
templates in public Git repositories.

Includes ability to initialise Git repository, run algokit bootstrap and
Includes ability to initialise Git repository, run algokit project bootstrap and
automatically open Visual Studio Code.

This should be run in the parent directory that you want the project folder
Expand Down Expand Up @@ -614,7 +614,7 @@ Automatically choose default answers without asking when creating this template.


### --bootstrap, --no-bootstrap
Whether to run algokit bootstrap to install and configure the new project's dependencies locally.
Whether to run algokit project bootstrap to install and configure the new project's dependencies locally.


### --ide, --no-ide
Expand Down
4 changes: 2 additions & 2 deletions src/algokit/cli/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ def doctor_command(*, copy_to_clipboard: bool) -> None:
["poetry", "--version"],
missing_help=[
"Poetry is required for some Python-based templates;",
"install via `algokit bootstrap` within project directory, or via:",
"install via `algokit project bootstrap` within project directory, or via:",
"https://python-poetry.org/docs/#installation",
],
),
"node": check_dependency(
["node", "--version"],
missing_help=[
"Node.js is required for some Node.js-based templates;",
"install via `algokit bootstrap` within project directory, or via:",
"install via `algokit project bootstrap` within project directory, or via:",
"https://nodejs.dev/en/learn/how-to-install-nodejs/",
],
),
Expand Down
8 changes: 4 additions & 4 deletions src/algokit/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _prevent_workspace_nesting(*, workspace_path: Path | None, project_path: Pat
"--bootstrap/--no-bootstrap",
is_flag=True,
default=None,
help="Whether to run `algokit bootstrap` to install and configure the new project's dependencies locally.",
help="Whether to run `algokit project bootstrap` to install and configure the new project's dependencies locally.",
)
@click.option(
"open_ide",
Expand Down Expand Up @@ -290,7 +290,7 @@ def init_command( # noqa: PLR0913, C901, PLR0915
Templates can be default templates shipped with AlgoKit, or custom
templates in public Git repositories.
Includes ability to initialise Git repository, run algokit bootstrap and
Includes ability to initialise Git repository, run algokit project bootstrap and
automatically open Visual Studio Code.
This should be run in the parent directory that you want the project folder
Expand Down Expand Up @@ -438,7 +438,7 @@ def _maybe_bootstrap(
if run_bootstrap is None:
# if user didn't specify a bootstrap option, then assume yes if using defaults, otherwise prompt
run_bootstrap = use_defaults or questionary_extensions.prompt_confirm(
"Do you want to run `algokit bootstrap` for this new project? "
"Do you want to run `algokit project bootstrap` for this new project? "
"This will install and configure dependencies allowing it to be run immediately.",
default=True,
)
Expand All @@ -455,7 +455,7 @@ def _maybe_bootstrap(
logger.error(f"Received an error while attempting bootstrap: {e}")
logger.exception(
"Bootstrap failed. Once any errors above are resolved, "
f"you can run `algokit bootstrap` in {project_path}",
f"you can run `algokit project bootstrap` in {project_path}",
exc_info=e,
)

Expand Down
14 changes: 7 additions & 7 deletions src/algokit/core/project/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def bootstrap_any(project_dir: Path, *, ci_mode: bool) -> None:
logger.debug(f"Checking {project_dir} for bootstrapping needs")

if next(project_dir.glob(ENV_TEMPLATE_PATTERN), None):
logger.debug("Running `algokit bootstrap env`")
logger.debug("Running `algokit project bootstrap env`")
bootstrap_env(project_dir, ci_mode=ci_mode)

if poetry_path.exists() or (pyproject_path.exists() and "[tool.poetry]" in pyproject_path.read_text("utf-8")):
logger.debug("Running `algokit bootstrap poetry`")
logger.debug("Running `algokit project bootstrap poetry`")
bootstrap_poetry(project_dir)

if package_json_path.exists():
logger.debug("Running `algokit bootstrap npm`")
logger.debug("Running `algokit project bootstrap npm`")
bootstrap_npm(project_dir)


Expand Down Expand Up @@ -147,18 +147,18 @@ def bootstrap_poetry(project_dir: Path) -> None:
):
raise click.ClickException(
"Unable to install poetry via pipx; please install poetry "
"manually via https://python-poetry.org/docs/ and try `algokit bootstrap poetry` again."
"manually via https://python-poetry.org/docs/ and try `algokit project bootstrap poetry` again."
)
pipx_command = find_valid_pipx_command(
"Unable to find pipx install so that poetry can be installed; "
"please install pipx via https://pypa.github.io/pipx/ "
"and then try `algokit bootstrap poetry` again."
"and then try `algokit project bootstrap poetry` again."
)
proc.run(
[*pipx_command, "install", "poetry"],
bad_return_code_error_message=(
"Unable to install poetry via pipx; please install poetry "
"manually via https://python-poetry.org/docs/ and try `algokit bootstrap poetry` again."
"manually via https://python-poetry.org/docs/ and try `algokit project bootstrap poetry` again."
),
)

Expand All @@ -170,7 +170,7 @@ def bootstrap_poetry(project_dir: Path) -> None:
raise click.ClickException(
"Unable to access Poetry on PATH after installing it via pipx; "
"check pipx installations are on your path by running `pipx ensurepath` "
"and try `algokit bootstrap poetry` again."
"and try `algokit project bootstrap poetry` again."
) from e
raise # unexpected error, we already ran without IOError before

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ pipx: Command not found!
install via https://pypa.github.io/pipx/
poetry: Command not found!
Poetry is required for some Python-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://python-poetry.org/docs/#installation
node: Command not found!
Node.js is required for some Node.js-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://nodejs.dev/en/learn/how-to-install-nodejs/
npm: Command not found!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pipx: Command not found!
install via https://pypa.github.io/pipx/
poetry: Command not found!
Poetry is required for some Python-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://python-poetry.org/docs/#installation
node: Command not found!
Node.js is required for some Node.js-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://nodejs.dev/en/learn/how-to-install-nodejs/
npm: Command not found!
brew: Command not found!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ pipx: Command not found!
install via https://pypa.github.io/pipx/
poetry: Command not found!
Poetry is required for some Python-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://python-poetry.org/docs/#installation
node: Command not found!
Node.js is required for some Node.js-based templates;
install via `algokit bootstrap` within project directory, or via:
install via `algokit project bootstrap` within project directory, or via:
https://nodejs.dev/en/learn/how-to-install-nodejs/
npm: Command not found!
chocolatey: Command not found!
Expand Down
2 changes: 1 addition & 1 deletion tests/init/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _set_blessed_templates(mocker: MockerFixture) -> None:
@pytest.fixture(autouse=True)
def _override_bootstrap(mocker: MockerFixture) -> None:
def bootstrap_mock(p: Path, *, ci_mode: bool, max_depth: int = 1) -> None: # noqa: ARG001
click.echo(f"Executed `algokit bootstrap all` in {p}")
click.echo(f"Executed `algokit project bootstrap all` in {p}")

mocker.patch("algokit.cli.init.bootstrap_any_including_subdirs").side_effect = bootstrap_mock

Expand Down
2 changes: 1 addition & 1 deletion tests/init/test_init.test_init_ask_about_git.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
DEBUG: Running 'git rev-parse --show-toplevel' in '{current_working_directory}/myapp'
DEBUG: git: fatal: not a git repository (or any of the parent directories): .git
Expand Down
2 changes: 1 addition & 1 deletion tests/init/test_init.test_init_bootstrap_no.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
? Do you want to run `algokit bootstrap` for this new project? This will install and configure dependencies allowing it to be run immediately. (Y/n)
? Do you want to run `algokit project bootstrap` for this new project? This will install and configure dependencies allowing it to be run immediately. (Y/n)
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
4 changes: 2 additions & 2 deletions tests/init/test_init.test_init_bootstrap_yes.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
? Do you want to run `algokit bootstrap` for this new project? This will install and configure dependencies allowing it to be run immediately. (Y/n)
? Do you want to run `algokit project bootstrap` for this new project? This will install and configure dependencies allowing it to be run immediately. (Y/n)
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
10 changes: 5 additions & 5 deletions tests/init/test_init.test_init_help.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Usage: algokit init [OPTIONS]
Templates can be default templates shipped with AlgoKit, or custom templates
in public Git repositories.

Includes ability to initialise Git repository, run algokit bootstrap and
automatically open Visual Studio Code.
Includes ability to initialise Git repository, run algokit project bootstrap
and automatically open Visual Studio Code.

This should be run in the parent directory that you want the project folder
created in.
Expand Down Expand Up @@ -40,9 +40,9 @@ Options:
creation.
--defaults Automatically choose default answers without
asking when creating this template.
--bootstrap / --no-bootstrap Whether to run `algokit bootstrap` to install
and configure the new project's dependencies
locally.
--bootstrap / --no-bootstrap Whether to run `algokit project bootstrap` to
install and configure the new project's
dependencies locally.
--ide / --no-ide Whether to open an IDE for you if the IDE and
IDE config are detected. Supported IDEs: VS
Code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
DEBUG: Running 'git rev-parse --show-toplevel' in '{current_working_directory}/myapp'
DEBUG: git: fatal: not a git repository (or any of the parent directories): .git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
VSCode configuration detected in project directory, and 'code' command is available on path, attempting to launch VSCode
DEBUG: Running '/bin/code {current_working_directory}/myapp' in '{current_working_directory}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/myapp
Executed `algokit project bootstrap all` in {current_working_directory}/myapp
🙌 Project initialized at `myapp`! For template specific next steps, consult the documentation of your selected template 🧐
VSCode configuration detected in project directory, and 'code' command is available on path, attempting to launch VSCode
DEBUG: Running '/bin/code {current_working_directory}/myapp {current_working_directory}/myapp/README.txt' in '{current_working_directory}'
Expand Down
2 changes: 1 addition & 1 deletion tests/init/test_init.test_init_project_name.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/FAKE_PROJECT
Executed `algokit project bootstrap all` in {current_working_directory}/FAKE_PROJECT
🙌 Project initialized at `FAKE_PROJECT`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/FAKE_PROJECT
Executed `algokit project bootstrap all` in {current_working_directory}/FAKE_PROJECT
🙌 Project initialized at `FAKE_PROJECT`! For template specific next steps, consult the documentation of your selected template 🧐
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ DEBUG: Attempting to load project config from {current_working_directory}/.algok
DEBUG: No .algokit.toml file found in the project directory.
DEBUG: Attempting to load project config from {current_working_directory}/.algokit.toml
DEBUG: No .algokit.toml file found in the project directory.
Executed `algokit bootstrap all` in {current_working_directory}/FAKE_PROJECT_2
Executed `algokit project bootstrap all` in {current_working_directory}/FAKE_PROJECT_2
🙌 Project initialized at `FAKE_PROJECT_2`! For template specific next steps, consult the documentation of your selected template 🧐
Loading

1 comment on commit 4321487

@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__.py47394%31–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
   bootstrap.py32197%33
   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
TOTAL428752188% 

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

Please sign in to comment.