From 593814f93567c8063c5bea65d564eeac70083493 Mon Sep 17 00:00:00 2001 From: ezilber-akamai Date: Thu, 22 Jan 2026 10:56:07 -0500 Subject: [PATCH 1/2] Point to linode-api-openapi repo instead of linode-api-docs --- README.md | 2 +- linodecli/cli.py | 2 +- resolve_spec_url | 2 +- tests/unit/test_cli.py | 2 +- wiki/development/Development - Overview.md | 2 +- wiki/development/Development - Setup.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0db85368b..ef5e786c0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Visit the [Wiki](../../wiki/Installation) for more information. ## Contributing -This CLI is generated from the [OpenAPI specification for Linode's API](https://github.com/linode/linode-api-docs). As +This CLI is generated from the [OpenAPI specification for Linode's API](https://github.com/linode/linode-api-openapi). As such, many changes are made directly to the spec. Please follow the [Contributing Guidelines](https://github.com/linode/linode-cli/blob/main/CONTRIBUTING.md) when making a contribution. diff --git a/linodecli/cli.py b/linodecli/cli.py index 718b619a4..419b5e06e 100644 --- a/linodecli/cli.py +++ b/linodecli/cli.py @@ -286,7 +286,7 @@ def user_agent(self) -> str: """ return ( f"linode-cli/{self.version} " - f"linode-api-docs/{self.spec_version} " + f"linode-api-openapi/{self.spec_version} " f"python/{version_info[0]}.{version_info[1]}.{version_info[2]}" ) diff --git a/resolve_spec_url b/resolve_spec_url index 60ae216fb..7487e2ef3 100755 --- a/resolve_spec_url +++ b/resolve_spec_url @@ -7,7 +7,7 @@ import sys import requests -LINODE_DOCS_REPO = "linode/linode-api-docs" +LINODE_DOCS_REPO = "linode/linode-api-openapi" def get_latest_tag(): diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 3ce0f8788..961a62121 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -79,7 +79,7 @@ def test_find_operation( def test_user_agent(self, mock_cli: CLI): assert re.compile( - r"linode-cli/[0-9]+\.[0-9]+\.[0-9]+ linode-api-docs/[0-9]+\.[0-9]+\.[0-9]+ python/[0-9]+\.[0-9]+\.[0-9]+" + r"linode-cli/[0-9]+\.[0-9]+\.[0-9]+ linode-api-openapi/[0-9]+\.[0-9]+\.[0-9]+ python/[0-9]+\.[0-9]+\.[0-9]+" ).match(mock_cli.user_agent) def test_load_openapi_spec_json(self): diff --git a/wiki/development/Development - Overview.md b/wiki/development/Development - Overview.md index a354103f7..555b668aa 100644 --- a/wiki/development/Development - Overview.md +++ b/wiki/development/Development - Overview.md @@ -3,7 +3,7 @@ The following section outlines the core functions of the Linode CLI. ## OpenAPI Specification Parsing Most Linode CLI commands (excluding [plugin commands](https://github.com/linode/linode-cli/tree/dev/linodecli/plugins)) -are generated dynamically at build-time from the [Linode OpenAPI Specification](https://github.com/linode/linode-api-docs), +are generated dynamically at build-time from the [Linode OpenAPI Specification](https://github.com/linode/linode-api-openapi), which is also used to generate the [official Linode API documentation](https://www.linode.com/docs/api/). Each OpenAPI spec endpoint method is parsed into an `OpenAPIOperation` object. diff --git a/wiki/development/Development - Setup.md b/wiki/development/Development - Setup.md index bf667fcbe..7293620ce 100644 --- a/wiki/development/Development - Setup.md +++ b/wiki/development/Development - Setup.md @@ -73,7 +73,7 @@ This can be achieved using the `SPEC` Makefile argument, for example: ```bash # Download the OpenAPI spec -curl -o openapi.yaml https://raw.githubusercontent.com/linode/linode-api-docs/development/openapi.yaml +curl -o openapi.json https://raw.githubusercontent.com/linode/linode-api-openapi/main/openapi.json # Many arbitrary changes to the spec From 965e019b402b3257ce11c29cfbafabd455ae0486 Mon Sep 17 00:00:00 2001 From: ezilber-akamai Date: Fri, 23 Jan 2026 14:54:48 -0500 Subject: [PATCH 2/2] Fix lint --- linodecli/arg_helpers.py | 1 + linodecli/completion.py | 7 +++---- linodecli/configuration/auth.py | 12 ++++-------- linodecli/configuration/helpers.py | 6 ++---- linodecli/plugins/obj/__init__.py | 1 + tests/unit/test_api_request.py | 1 + tests/unit/test_configuration.py | 1 + 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/linodecli/arg_helpers.py b/linodecli/arg_helpers.py index 2f5f1b70c..2a6d7c9a0 100644 --- a/linodecli/arg_helpers.py +++ b/linodecli/arg_helpers.py @@ -4,6 +4,7 @@ This module defines argument parsing, plugin registration, and plugin removal functionalities for the Linode CLI. """ + import sys from argparse import ArgumentParser from configparser import ConfigParser diff --git a/linodecli/completion.py b/linodecli/completion.py index 6a402eecf..e95acd961 100644 --- a/linodecli/completion.py +++ b/linodecli/completion.py @@ -2,6 +2,7 @@ """ Contains any code relevant to generating/updating shell completions for linode-cli """ + from string import Template from openapi3 import OpenAPI @@ -93,12 +94,10 @@ def get_bash_completions(ops): complete -F _linode_cli lin""" ) - command_template = Template( - """$command) + command_template = Template("""$command) COMPREPLY=( $(compgen -W "$actions --help" -- ${cur}) ) return 0 - ;;""" - ) + ;;""") command_blocks = [ command_template.safe_substitute( diff --git a/linodecli/configuration/auth.py b/linodecli/configuration/auth.py index e10d785ce..1b633c7bb 100644 --- a/linodecli/configuration/auth.py +++ b/linodecli/configuration/auth.py @@ -214,13 +214,11 @@ def _get_token_terminal(base_url: str) -> Tuple[str, str]: :returns: A tuple containing the user's username and token. :rtype: Tuple[str, str] """ - print( - f""" + print(f""" First, we need a Personal Access Token. To get one, please visit {TOKEN_GENERATION_URL} and click "Create a Personal Access Token". The CLI needs access to everything -on your account to work correctly.""" - ) +on your account to work correctly.""") while True: token = input("Personal Access Token: ") @@ -329,15 +327,13 @@ def log_message(self, form, *args): # pylint: disable=arguments-differ # figure out the URL to direct the user to and print out the prompt # pylint: disable-next=line-too-long url = f"https://login.linode.com/oauth/authorize?client_id={OAUTH_CLIENT_ID}&response_type=token&scopes=*&redirect_uri=http://localhost:{serv.server_address[1]}" - print( - f"""A browser should open directing you to this URL to authenticate: + print(f"""A browser should open directing you to this URL to authenticate: {url} If you are not automatically directed there, please copy/paste the link into your browser to continue.. -""" - ) +""") webbrowser.open(url) diff --git a/linodecli/configuration/helpers.py b/linodecli/configuration/helpers.py index a0398e2b3..35be04047 100644 --- a/linodecli/configuration/helpers.py +++ b/linodecli/configuration/helpers.py @@ -97,11 +97,9 @@ def _check_browsers() -> bool: # pylint: disable-next=protected-access if not KNOWN_GOOD_BROWSERS.intersection(webbrowser._tryorder): - print( - """ + print(""" This tool defaults to web-based authentication, -however no known-working browsers were found.""" - ) +however no known-working browsers were found.""") while True: r = input("Try it anyway? [y/N]: ") if r.lower() in "yn ": diff --git a/linodecli/plugins/obj/__init__.py b/linodecli/plugins/obj/__init__.py index 2d5761340..6952487f9 100644 --- a/linodecli/plugins/obj/__init__.py +++ b/linodecli/plugins/obj/__init__.py @@ -2,6 +2,7 @@ """ CLI Plugin for handling OBJ """ + import getpass import os import re diff --git a/tests/unit/test_api_request.py b/tests/unit/test_api_request.py index a222d60db..1afa699ce 100644 --- a/tests/unit/test_api_request.py +++ b/tests/unit/test_api_request.py @@ -2,6 +2,7 @@ """ Unit tests for linodecli.api_request """ + import contextlib import io import json diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py index 14b704d0c..409250330 100644 --- a/tests/unit/test_configuration.py +++ b/tests/unit/test_configuration.py @@ -2,6 +2,7 @@ """ Unit tests for linodecli.configuration """ + import argparse import contextlib import io