diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index fa09cf58..11032cc1 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -19,11 +19,11 @@ jobs: - name: Build Documentation run: pipenv run python3 -m sphinx -M html docs/source docs/output - - name: Deploy gh-pages - if: github.repository == 'rapyuta-robotics/rapyuta-io-cli' && github.event_name == 'push' - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/output/html - cname: cli.rapyuta.io - force_orphan: true +# - name: Deploy gh-pages +# if: github.repository == 'rapyuta-robotics/rapyuta-io-cli' && github.event_name == 'push' +# uses: peaceiris/actions-gh-pages@v3 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# publish_dir: ./docs/output/html +# cname: cli.rapyuta.io +# force_orphan: true diff --git a/Pipfile b/Pipfile index c21919a5..1e50c823 100644 --- a/Pipfile +++ b/Pipfile @@ -5,9 +5,9 @@ verify_ssl = true [dev-packages] pipenv-setup = "==3.1.1" -sphinx = "==4.2.0" -sphinx-click = "==3.0.1" -furo = "==2021.10.9" +sphinx = ">=5.0.0" +sphinx-click = ">=3.0.1" +furo = ">=2021.10.9" [packages] riocli = {path = "."} diff --git a/Pipfile.lock b/Pipfile.lock index 6705af90..f348a6d7 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "429f20b9b776c129d185c893a81bd0caacc33878c5fd832b53989a24cb6100cf" + "sha256": "22a23a368d4d7e17e8aaa7759ec4ef427086027fd1f5a0e4f644a19c0b01b789" }, "pipfile-spec": 6, "requires": { @@ -133,7 +133,7 @@ "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519", "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561" ], - "markers": "python_version >= '3.7'", + "markers": "python_full_version >= '3.7.0'", "version": "==3.3.2" }, "click": { @@ -224,11 +224,11 @@ }, "graphlib-backport": { "hashes": [ - "sha256:24246967b9e7e6a91550bc770e6169585d35aa32790258579a8a3899a8c18fde", - "sha256:7bb8fc7757b8ae4e6d8000a26cd49e9232aaa9a3aa57edb478474b8424bfaae2" + "sha256:00a7888b21e5393064a133209cb5d3b3ef0a2096cf023914c9d778dff5644125", + "sha256:eccacf9f2126cdf89ce32a6018c88e1ecd3e4898a07568add6e1907a439055ba" ], "index": "pypi", - "version": "==1.0.3" + "version": "==1.1.0" }, "idna": { "hashes": [ @@ -341,7 +341,7 @@ "sha256:3527b7af26106cbc65a040bcc84839a3566ec1b051bb0bfe953631e704b0ff7d", "sha256:a11a29cb3bf0a28a387fe5122cdb649816a957cd9261dcedf8c9f1fef33eacf6" ], - "markers": "python_version >= '3.7'", + "markers": "python_full_version >= '3.7.0'", "version": "==3.0.43" }, "pyrfc3339": { @@ -392,11 +392,11 @@ }, "python-dateutil": { "hashes": [ - "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", - "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", + "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.2" + "version": "==2.9.0.post0" }, "pytz": { "hashes": [ @@ -472,7 +472,7 @@ }, "rapyuta-io-cli": { "path": ".", - "version": "==0.6.0" + "version": "==7.2.1" }, "requests": { "hashes": [ @@ -482,9 +482,6 @@ "markers": "python_version >= '3.7'", "version": "==2.31.0" }, - "riocli": { - "path": "." - }, "semver": { "hashes": [ "sha256:6253adb39c70f6e51afed2fa7152bcd414c411286088fb4b9effb133885ab4cc", @@ -495,11 +492,11 @@ }, "setuptools": { "hashes": [ - "sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56", - "sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8" + "sha256:0ff4183f8f42cd8fa3acea16c45205521a4ef28f73c6391d8a25e92893134f2e", + "sha256:c21c49fb1042386df081cb5d86759792ab89efca84cf114889191cd09aacc80c" ], "markers": "python_version >= '3.8'", - "version": "==69.1.1" + "version": "==69.2.0" }, "shellingham": { "hashes": [ @@ -601,7 +598,7 @@ "sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051", "sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==4.12.3" }, "black": { @@ -727,7 +724,7 @@ "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519", "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561" ], - "markers": "python_version >= '3.7'", + "markers": "python_full_version >= '3.7.0'", "version": "==3.3.2" }, "click": { @@ -755,19 +752,19 @@ }, "docutils": { "hashes": [ - "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125", - "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61" + "sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6", + "sha256:5e1de4d849fee02c63b040a4a3fd567f4ab104defd8a5511fbbc24a8a017efbc" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==0.17.1" + "markers": "python_version >= '3.7'", + "version": "==0.19" }, "furo": { "hashes": [ - "sha256:2baa42a22ede3e6e95c6182ab364bac2ec15b79bc7f9ca7fb09fd9aec4b3540c", - "sha256:8da4448836e72db59033cd8d70dbdae96b0523c4424d806216febd38253870e8" + "sha256:4ab2be254a2d5e52792d0ca793a12c35582dd09897228a6dd47885dabd5c9521", + "sha256:b99e7867a5cc833b2b34d7230631dd6558c7a29f93071fdbb5709634bb33c5a5" ], "index": "pypi", - "version": "==2021.10.9" + "version": "==2023.3.27" }, "idna": { "hashes": [ @@ -957,11 +954,11 @@ }, "python-dateutil": { "hashes": [ - "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", - "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", + "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.2" + "version": "==2.9.0.post0" }, "regex": { "hashes": [ @@ -1080,11 +1077,11 @@ }, "setuptools": { "hashes": [ - "sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56", - "sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8" + "sha256:0ff4183f8f42cd8fa3acea16c45205521a4ef28f73c6391d8a25e92893134f2e", + "sha256:c21c49fb1042386df081cb5d86759792ab89efca84cf114889191cd09aacc80c" ], "markers": "python_version >= '3.8'", - "version": "==69.1.1" + "version": "==69.2.0" }, "six": { "hashes": [ @@ -1111,19 +1108,27 @@ }, "sphinx": { "hashes": [ - "sha256:94078db9184491e15bce0a56d9186e0aec95f16ac20b12d00e06d4e36f1058a6", - "sha256:98a535c62a4fcfcc362528592f69b26f7caec587d32cd55688db580be0287ae0" + "sha256:309a8da80cb6da9f4713438e5b55861877d5d7976b69d87e336733637ea12693", + "sha256:ba3224a4e206e1fbdecf98a4fae4992ef9b24b85ebf7b584bb340156eaf08d89" ], "index": "pypi", - "version": "==4.2.0" + "version": "==5.1.1" + }, + "sphinx-basic-ng": { + "hashes": [ + "sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9", + "sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b" + ], + "markers": "python_version >= '3.7'", + "version": "==1.0.0b2" }, "sphinx-click": { "hashes": [ - "sha256:9b24c46f3b8f25fc639f47c97ac0361d9f80d48c2ed6b3917de2865bbdbe1785", - "sha256:e9ee2237e5a6b6620e9996b8214934afdf8f7f9f9fc082482c77be0e4379038e" + "sha256:6812c2db62d3fae71a4addbe5a8a0a16c97eb491f3cd63fe34b4ed7e07236f33", + "sha256:ae97557a4e9ec646045089326c3b90e026c58a45e083b8f35f17d5d6558d08a0" ], "index": "pypi", - "version": "==3.0.1" + "version": "==5.1.0" }, "sphinxcontrib-applehelp": { "hashes": [ @@ -1262,11 +1267,11 @@ }, "wheel": { "hashes": [ - "sha256:177f9c9b0d45c47873b619f5b650346d632cdc35fb5e4d25058e09c9e581433d", - "sha256:c45be39f7882c9d34243236f2d63cbd58039e360f85d0913425fbd7ceea617a8" + "sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85", + "sha256:55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81" ], - "markers": "python_version >= '3.7'", - "version": "==0.42.0" + "markers": "python_version >= '3.8'", + "version": "==0.43.0" } } } diff --git a/docs/source/conf.py b/docs/source/conf.py index af5710f7..c8017ad8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ autosummary_generate = True # Turn on sphinx.ext.autosummary source_suffix = '.rst' master_doc = 'index' -language = None +language = 'en' exclude_patterns = [] todo_include_todos = False diff --git a/riocli/auth/login.py b/riocli/auth/login.py index dac8a7a5..8a671e95 100644 --- a/riocli/auth/login.py +++ b/riocli/auth/login.py @@ -1,4 +1,4 @@ -# Copyright 2023 Rapyuta Robotics +# Copyright 2024 Rapyuta Robotics # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ get_token, select_organization, select_project, - validate_token, + validate_and_set_token, ) from riocli.constants import Colors, Symbols from riocli.utils.context import get_root_context @@ -66,9 +66,8 @@ def login( ctx = get_root_context(ctx) if auth_token: - if not validate_token(auth_token): + if not validate_and_set_token(ctx, auth_token): raise SystemExit(1) - ctx.obj.data['auth_token'] = auth_token else: if interactive: email = email or click.prompt('Email') diff --git a/riocli/auth/util.py b/riocli/auth/util.py index 95f56f8e..23fd9c39 100644 --- a/riocli/auth/util.py +++ b/riocli/auth/util.py @@ -1,4 +1,4 @@ -# Copyright 2023 Rapyuta Robotics +# Copyright 2024 Rapyuta Robotics # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -143,11 +143,10 @@ def get_token( @with_spinner(text='Validating token...') -def validate_token(token: str, spinner=None) -> bool: +def validate_and_set_token(ctx: click.Context, token: str, spinner=None) -> bool: """Validates an auth token.""" - config = Configuration() - if 'environment' in config.data: - os.environ['RIO_CONFIG'] = config.filepath + if 'environment' in ctx.obj.data: + os.environ['RIO_CONFIG'] = ctx.obj.filepath client = Client(auth_token=token) @@ -156,6 +155,9 @@ def validate_token(token: str, spinner=None) -> bool: spinner.text = click.style( 'Token belongs to user {}'.format(user.email_id), fg=Colors.CYAN) + # Save the token and user email_id in the context + ctx.obj.data['auth_token'] = token + ctx.obj.data['email_id'] = user.email_id spinner.ok(Symbols.INFO) return True except UnauthorizedError: diff --git a/riocli/project/util.py b/riocli/project/util.py index b1af94d2..7f565fcb 100644 --- a/riocli/project/util.py +++ b/riocli/project/util.py @@ -18,7 +18,7 @@ from rapyuta_io import Client from riocli.config import new_client, new_v2_client -from riocli.constants import Colors +from riocli.constants import Colors, Symbols from riocli.exceptions import LoggedOut from riocli.utils.selector import show_selection from riocli.v2client import Client as v2Client @@ -49,9 +49,10 @@ def decorated(**kwargs: typing.Any): if guid is None: try: - guid = find_project_guid(client, name) + organization = ctx.obj.data.get('organization_id') + guid = find_project_guid(client, name, organization) except Exception as e: - click.secho(str(e), fg=Colors.RED) + click.secho('{} {}'.format(Symbols.ERROR, e), fg=Colors.RED) raise SystemExit(1) kwargs['project_name'] = name