Skip to content

Commit

Permalink
Support Py 3.9, 3.10 and 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
pm3310 committed Dec 28, 2023
1 parent 833f1e4 commit a094cb9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For detailed reference to Sagify commands please go to: [Read the Docs](https://

sagify requires the following:

1. Python (3.7, 3.8)
1. Python (3.7, 3.8, 3.9, 3.10, 3.11)
2. [Docker](https://www.docker.com/) installed and running
3. Configured [awscli](https://pypi.python.org/pypi/awscli)

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This is probably the most classic one! You need to run a batch prediction pipeli

sagify requires the following:

1. Python (3.7, 3.8)
1. Python (3.7, 3.8, 3.9, 3.10, 3.11)
2. [Docker](https://www.docker.com/) installed and running
3. Configured [awscli](https://pypi.python.org/pypi/awscli)

Expand Down
4 changes: 2 additions & 2 deletions sagify/api/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def init(sagify_app_name, aws_profile, aws_region, python_version, root_dir, req
:param root_dir: [str], root source directory.
:param root_dir: [str], Path to requirements.txt.
"""
if python_version not in {'3.7', '3.8'}:
raise ValueError("Invalid Python version. Valid options: 3.7 or 3.8")
if python_version not in {'3.7', '3.8', '3.9', '3.10', '3.11'}:
raise ValueError("Invalid Python version. Valid options: 3.7, 3.8, 3.9, 3.10, 3.11")

_template_creation(
app_name=sagify_app_name,
Expand Down
18 changes: 13 additions & 5 deletions sagify/commands/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,31 @@ def ask_for_root_dir():

def ask_for_python_version():
logger.info("Select Python interpreter:")
logger.info('{}'.format('\n'.join(['1 - Python37', '2 - Python38'])))
logger.info('{}'.format('\n'.join(['1 - Python37', '2 - Python38', '3 - Python39', '4 - Python310', '5 - Python311'])))

def _validate_python_option(input_value):
if int(input_value) not in {1, 2}:
if int(input_value) not in {1, 2, 3, 4, 5}:
raise BadParameter(
message="invalid choice: {}. (choose from 1, 2)".format(str(input_value))
message="invalid choice: {}. (choose from 1, 2, 3, 4, 5)".format(str(input_value))
)

return int(input_value)

chosen_python_index = click.prompt(
text="Choose from 1, 2",
text="Choose from 1, 2, 3, 4, 5",
default=1,
value_proc=lambda x: _validate_python_option(x)
)

return '3.7' if chosen_python_index == 1 else '3.8'
_index_to_version = {
1: '3.7',
2: '3.8',
3: '3.9',
4: '3.10',
5: '3.11'
}

return _index_to_version[chosen_python_index]


def ask_for_aws_details():
Expand Down

0 comments on commit a094cb9

Please sign in to comment.