Skip to main content

Python 3.6 and 3.7 language support for the CloudFormation CLI

Project description

AWS CloudFormation Resource Provider Python Plugin

The CloudFormation CLI (cfn) allows you to author your own resource providers that can be used by CloudFormation.

This plugin library helps to provide Python runtime bindings for the execution of your providers by CloudFormation.

AWS CloudFormation Resource Provider Python Plugin

The CloudFormation Resource Provider Development Kit (RPDK) allows you to author your own resource providers that can be used by CloudFormation.

This plugin library helps to provide runtime bindings for the execution of your providers by CloudFormation.

Build Status

Community

Join us on Discord! Connect & interact with CloudFormation developers & experts, find channels to discuss and get help for our CLIs, cfn-lint, CloudFormation registry, StackSets, Guard and more:

Join our Discord

Installation

pip install cloudformation-cli-python-plugin

Howto

$ cfn init
Initializing new project
What's the name of your resource type?
(Organization::Service::Resource)
>> Foo::Bar::Baz
Select a language for code generation:
[1] java
[2] csharp
[3] python38
[4] python39
[5] python310
[6] python311
[7] python312
(enter an integer):
>> 4
Use docker for platform-independent packaging (Y/n)?
This is highly recommended unless you are experienced
with cross-platform Python packaging.
>> y
Initialized a new project in <>
$ cfn submit --dry-run
$ cat <<EOT > test.json
{
  "credentials": {
    "accessKeyId": "",
    "secretAccessKey": "",
    "sessionToken": ""
  },
  "action": "CREATE",
  "request": {
    "clientRequestToken": "ecba020e-b2e6-4742-a7d0-8a06ae7c4b2b",
    "desiredResourceState": {
      "Title": "This_Is_The_Title_For_My_Example",
      "TestCode": "NOT_STARTED"
    },
    "previousResourceState": null,
    "logicalResourceIdentifier": null
  },
  "callbackContext": null
}
EOT
$ sam local invoke TestEntrypoint --event test.json

Development

For changes to the plugin, a Python virtual environment is recommended. The development requirements can be sourced from the core repository:

python3 -m venv env
source env/bin/activate
pip install -e . -e src/ \
  -r https://raw.githubusercontent.com/aws-cloudformation/aws-cloudformation-rpdk/master/requirements.txt
pre-commit install

Linting and running unit tests is done via pre-commit, and so is performed automatically on commit. The continuous integration also runs these checks. Manual options are available so you don't have to commit):

# run all hooks on all files, mirrors what the CI runs
pre-commit run --all-files
# run unit tests only. can also be used for other hooks, e.g. black, flake8, pylint-local
pre-commit run pytest-local

License

This library is licensed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudformation-cli-python-plugin-2.1.10.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file cloudformation-cli-python-plugin-2.1.10.tar.gz.

File metadata

File hashes

Hashes for cloudformation-cli-python-plugin-2.1.10.tar.gz
Algorithm Hash digest
SHA256 3883751baaa1c6f9778e946e2758f129b7276b9192e21f921fc815b0765961d6
MD5 7bef030f270f1a88163ea052a0bb2095
BLAKE2b-256 aef1bd758290777dd9b87b2ffebd9b4271a95188aed0acb9f6bc44af940ccb31

See more details on using hashes here.

File details

Details for the file cloudformation_cli_python_plugin-2.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudformation_cli_python_plugin-2.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a2a297ed717fef221f6e1c663b80be30763507ca2f34734794e25f58d2f1c7e1
MD5 8e9c9bcdfb02846a9df13461254bea53
BLAKE2b-256 b64c8e6f5b6157db1ca8501f49e6ddcba831f94bdebe1c3774743284a250f5a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page