From 8adc08a209d9af6dcb3143d4d3f9d0f2808c4b68 Mon Sep 17 00:00:00 2001 From: Juan David Buitrago <93566377+JuanDavidBuitrago@users.noreply.github.com> Date: Tue, 25 Oct 2022 11:20:40 -0500 Subject: [PATCH] fix(DS-291): create a project with a version that is not install (#58) * fix: create a project with a version that is not install * docs: add pr template * docs: remove steps where is necessary to install a previous version --- .github/pull_request_template.md | 43 ++++++++++++ docs/source/tvm_quickstart.rst | 51 ++++++--------- .../tvm_topic_guides/environment_manager.rst | 5 +- .../tvm_tutorials/creating_two_dev_env.rst | 65 ++++++++----------- tvm/cli.py | 5 ++ 5 files changed, 96 insertions(+), 73 deletions(-) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..f1d3191 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,43 @@ + + +## Description + +Describe what this pull request changes, and why. Include implications for people using this change. + +Useful information to include: +- Which user roles will this change impact? Common user roles are "Learner", "Course Author", +"Developer", and "Operator". +- Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable). +- Provide links to the description of corresponding configuration changes. Remember to correctly annotate these +changes. + +## Testing instructions + +Please provide detailed step-by-step instructions for testing this change. + +## Additional information + +Include anything else that will help reviewers and consumers understand the change. +- Does this change depend on other changes elsewhere? +- Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility. +- Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions. + +## Checklist for Merge + +- [ ] Updated documentation +- [ ] Rebased master/main +- [ ] Squashed commits + + diff --git a/docs/source/tvm_quickstart.rst b/docs/source/tvm_quickstart.rst index 92a6081..6bd31e2 100644 --- a/docs/source/tvm_quickstart.rst +++ b/docs/source/tvm_quickstart.rst @@ -29,55 +29,44 @@ For more information, see the `Tutor requirements -.. code-block:: bash + # For example: + # tvm project init tvm-test v14.0.0 - tvm install +#. Open the project folder. - # For example: - # tvm install v14.0.0 + .. code-block:: bash -4. Create a new project with TVM. + cd -.. code-block:: bash +#. Activate the project environment. - tvm project init + .. code-block:: bash - # For example: - # tvm project init tvm-test v14.0.0 + source .tvm/bin/activate -5. Open the project folder. +#. Run your project. -.. code-block:: bash + .. code-block:: bash - cd - -6. Activate the project environment. - -.. code-block:: bash - - source .tvm/bin/activate - -7. Run your project. - -.. code-block:: bash - - tutor local quickstart + tutor local quickstart Next Steps diff --git a/docs/source/tvm_topic_guides/environment_manager.rst b/docs/source/tvm_topic_guides/environment_manager.rst index b527caa..dedaf93 100644 --- a/docs/source/tvm_topic_guides/environment_manager.rst +++ b/docs/source/tvm_topic_guides/environment_manager.rst @@ -23,10 +23,7 @@ Create a Project # tvm project init tvm-test v14.0.0 -.. note:: The `` parameter is optional. If you don't specify the version, the project will create the project with the version you set previously with `tvm use ` or the latest version. - - -.. warning:: If you are going to specify the `` , you must have that version in your TVM. If you don't have it, install it with `tvm install `. +.. note:: The parameter is optional. However, if you don't specify the version, the project will be created with the version you set previously with tvm use or the latest version. If you specify the version, and the version isn't installed, it will be installed. Activate a Project Environment diff --git a/docs/source/tvm_tutorials/creating_two_dev_env.rst b/docs/source/tvm_tutorials/creating_two_dev_env.rst index 5bec171..afd6baf 100644 --- a/docs/source/tvm_tutorials/creating_two_dev_env.rst +++ b/docs/source/tvm_tutorials/creating_two_dev_env.rst @@ -6,69 +6,58 @@ At the end of this Tutorial, you will have two different TVM Projects to have tw Step by Step ------------- -1. Install the latest stable release of TVM. +#. Install the latest stable release of TVM. + .. code-block:: bash -.. code-block:: bash + pip install git+https://github.com/eduNEXT/tvm.git - pip install git+https://github.com/eduNEXT/tvm.git +#. Verify the installation. + .. code-block:: bash -2. Verify the installation. + tvm --version -.. code-block:: bash +#. Create a new project with TVM. - tvm --version + .. code-block:: bash -3. Install the version of Tutor you want to use. + tvm project init -.. code-block:: bash + # For example: + # tvm project init tvm-test v14.0.0 - tvm install +#. Open the project folder. - # For example: - # tvm install v14.0.0 + .. code-block:: bash -4. Create a new project with TVM. + cd -.. code-block:: bash +#. Activate the project environment. - tvm project init + .. code-block:: bash - # For example: - # tvm project init tvm-test v14.0.0 + source .tvm/bin/activate -5. Open the project folder. +#. Run your project. -.. code-block:: bash + .. code-block:: bash - cd + tutor dev quickstart -6. Activate the project environment. +#. Stop your project. -.. code-block:: bash + .. code-block:: bash - source .tvm/bin/activate + tutor dev stop -7. Run your project. +#. Deactivate the project environment. -.. code-block:: bash + .. code-block:: bash - tutor dev quickstart + tvmoff -8. Stop your project. - -.. code-block:: bash - - tutor dev stop - -9. Deactivate the project environment. - -.. code-block:: bash - - tvmoff - -10. Repeat steps 3 to 8 using the project-name and tutor-version you want. +#. Repeat steps 3 to 8 using the project-name and tutor-version you want. .. note:: You can have as many projects as you want, but you can't have two projects with the same name and tutor version. diff --git a/tvm/cli.py b/tvm/cli.py index 6b97a27..9ff9274 100644 --- a/tvm/cli.py +++ b/tvm/cli.py @@ -372,6 +372,7 @@ def projects() -> None: def init(name: str = None, version: str = None): """Configure a new tvm project in the current path.""" current_version = version_manager.current_version(f"{TVM_PATH}") + local_versions = get_local_versions() if not version: version = current_version @@ -384,6 +385,10 @@ def init(name: str = None, version: str = None): install_tutor_version(version=version) use_version(version=version) + if version not in local_versions: + install_tutor_version(version=version) + use_version(version=version) + if name: tvm_project_folder = pathlib.Path().resolve() / name else: