Skip to content

Commit

Permalink
Merge pull request #269 from PodioSpaz/python38
Browse files Browse the repository at this point in the history
Add support for Python 3.8
  • Loading branch information
rickychau2780 authored Aug 11, 2020
2 parents bbe6a6c + ec77e11 commit 08df139
Show file tree
Hide file tree
Showing 9 changed files with 591 additions and 9 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include rdk/template/runtime/python2.7/*
include rdk/template/runtime/python3.6/*
include rdk/template/runtime/python3.6-lib/*
include rdk/template/runtime/python3.7/*
include rdk/template/runtime/python3.8/*
include rdk/template/runtime/dotnetcore1.0/*
include rdk/template/runtime/dotnetcore1.0/bin/*
include rdk/template/runtime/dotnetcore1.0/obj/*
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For complete documentation, including command reference, check out the `ReadTheD

Getting Started
===============
Uses python 2.7/3.6/3.7 and is installed via pip. Requires you to have an AWS account and sufficient permissions to manage the Config service, and to create S3 Buckets, Roles, and Lambda Functions. An AWS IAM Policy Document that describes the minimum necessary permissions can be found at policy/rdk-minimum-permissions.json.
Uses python 2.7/3.6/3.7/3.8 and is installed via pip. Requires you to have an AWS account and sufficient permissions to manage the Config service, and to create S3 Buckets, Roles, and Lambda Functions. An AWS IAM Policy Document that describes the minimum necessary permissions can be found at policy/rdk-minimum-permissions.json.

Under the hood, rdk uses boto3 to make API calls to AWS, so you can set your credentials any way that boto3 recognizes (options 3 through 8 here: http://boto3.readthedocs.io/en/latest/guide/configuration.html) or pass them in with the command-line parameters --profile, --region, --access-key-id, or --secret-access-key

Expand Down Expand Up @@ -61,7 +61,7 @@ In your working directory, use the ``create`` command to start creating a new cu

::

$ rdk create MyRule --runtime python3.7 --resource-types AWS::EC2::Instance --input-parameters '{"desiredInstanceType":"t2.micro"}'
$ rdk create MyRule --runtime python3.8 --resource-types AWS::EC2::Instance --input-parameters '{"desiredInstanceType":"t2.micro"}'
Running create!
Local Rule files created.

Expand Down Expand Up @@ -171,7 +171,7 @@ You can use the ``-n`` and ``-f`` command line flags just like the UNIX ``tail``
Running the tests
=================

The `testing` directory contains scripts and buildspec files that I use to run basic functionality tests across a variety of CLI environemnts (currently Ubuntu linux running python2.7, Ubuntu linux running python 3.6/3.7, and Windows Server running python2.7). If there is interest I can release a CloudFormation template that could be used to build the test environment, let me know if this is something you want!
The `testing` directory contains scripts and buildspec files that I use to run basic functionality tests across a variety of CLI environemnts (currently Ubuntu linux running python2.7, Ubuntu linux running python 3.6/3.7/3.8, and Windows Server running python2.7). If there is interest I can release a CloudFormation template that could be used to build the test environment, let me know if this is something you want!


Advanced Features
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ In your working directory, use the ``create`` command to start creating a new cu

::

$ rdk create MyRule --runtime python3.7 --resource-types AWS::EC2::Instance --input-parameters '{"desiredInstanceType":"t2.micro"}'
$ rdk create MyRule --runtime python3.8 --resource-types AWS::EC2::Instance --input-parameters '{"desiredInstanceType":"t2.micro"}'
Running create!
Local Rule files created.

Expand Down
2 changes: 1 addition & 1 deletion rdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

MY_VERSION = "0.7.10"
MY_VERSION = "0.7.11"

7 changes: 4 additions & 3 deletions rdk/rdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_rule_parser(is_required, command):
)
parser.add_argument('rulename', metavar='<rulename>', help='Rule name to create/modify')
runtime_group = parser.add_mutually_exclusive_group()
runtime_group.add_argument('-R','--runtime', required=False, help='Runtime for lambda function', choices=['nodejs4.3', 'java8', 'python2.7', 'python3.6', 'python3.6-lib', 'python3.7', 'dotnetcore1.0', 'dotnetcore2.0'])
runtime_group.add_argument('-R','--runtime', required=False, help='Runtime for lambda function', choices=['nodejs4.3', 'java8', 'python2.7', 'python3.6', 'python3.6-lib', 'python3.7', 'python3.8', 'dotnetcore1.0', 'dotnetcore2.0'])
runtime_group.add_argument('--source-identifier', required=False, help="[optional] Used only for creating Managed Rules.")
parser.set_defaults(runtime='python3.6-lib')
parser.add_argument('-r','--resource-types', required=False, help='[optional] Resource types that will trigger event-based Rule evaluation')
Expand Down Expand Up @@ -642,6 +642,7 @@ def create(self):
'python3.6-managed':'.py',
'python3.6-lib':'.py',
'python3.7': '.py',
'python3.8': '.py',
'nodejs4.3': '.js',
'dotnetcore1.0': 'cs',
'dotnetcore2.0': 'cs',
Expand Down Expand Up @@ -1481,7 +1482,7 @@ def test_local(self):

for rule_name in rule_names:
rule_params, rule_tags = self.__get_rule_parameters(rule_name)
if rule_params['SourceRuntime'] not in ('python2.7', 'python3.6', 'python3.6-lib', 'python3.7'):
if rule_params['SourceRuntime'] not in ('python2.7', 'python3.6', 'python3.6-lib', 'python3.7', 'python3.8'):
print ("Skipping " + rule_name + " - Runtime not supported for local testing.")
continue

Expand Down Expand Up @@ -2573,7 +2574,7 @@ def __wait_for_cfn_stack(self, cfn_client, stackname):
time.sleep(5)

def __get_handler(self, rule_name, params):
if params['SourceRuntime'] in ['python2.7', 'python3.6', 'python3.6-lib', 'python3.7', 'nodejs4.3', 'nodejs6.10', 'nodejs8.10']:
if params['SourceRuntime'] in ['python2.7', 'python3.6', 'python3.6-lib', 'python3.7', 'python3.8', 'nodejs4.3', 'nodejs6.10', 'nodejs8.10']:
return (rule_name+'.lambda_handler')
elif params['SourceRuntime'] in ['java8']:
return ('com.rdk.RuleUtil::handler')
Expand Down
Loading

0 comments on commit 08df139

Please sign in to comment.