Open rcmdnk opened 9 months ago
Currently sso login command of aws cli is used https://github.com/rcmdnk/boto3-session/blob/3af50cb3899a2f5248a7d96eeef07286a6fbdf63/src/boto3_session/session.py#L64-L67
sso login
aws-cli (v2) is python made and it is possible to use the command directly in the python tool.
But currently, only v1 is published in PyPI: awscli · PyPI (1.32.8).
To use v2 as a library, we can install directly from GitHub:
$ pip install git+https://github.com/aws/aws-cli.git@2.15.4
Then, sso login command can be executed by using awscli library:
from awscli.customizations.sso import LoginCommand from types import SimpleNamespace import botocore.session session = botocore.session.Session() args = SimpleNamespace(no_browser=False, sso_session=None) sso_login = LoginCommand(session) sso_login._run_main(args, None)
But awscli v2 does not support python 3.12, yet: V2 support for Python 3.12 · Issue #8342 · aws/aws-cli
Maybe v2 is published in PyPI when 3.12 supports finished (?).
Once awscli v2 becomes available in PyPI, then replace subprocess command to library base command.
3.12 is supported from v2.17.52: https://github.com/aws/aws-cli/issues/8342#issuecomment-2357052158
I seems v2 will not be published to pypi...: https://github.com/aws/aws-cli/issues/4947
Currently
sso login
command of aws cli is used https://github.com/rcmdnk/boto3-session/blob/3af50cb3899a2f5248a7d96eeef07286a6fbdf63/src/boto3_session/session.py#L64-L67aws-cli (v2) is python made and it is possible to use the command directly in the python tool.
But currently, only v1 is published in PyPI: awscli · PyPI (1.32.8).
To use v2 as a library, we can install directly from GitHub:
Then, sso login command can be executed by using awscli library:
But awscli v2 does not support python 3.12, yet: V2 support for Python 3.12 · Issue #8342 · aws/aws-cli
Maybe v2 is published in PyPI when 3.12 supports finished (?).
Once awscli v2 becomes available in PyPI, then replace subprocess command to library base command.