Skip to main content

A Python library with convenience helpers for working with the AWS Serverless Application Repository.

Project description

AWS Serverless Application Repository - Python

A Python library with convenience helpers for working with the AWS Serverless Application Repository.

Installation

Simply use pip to install the library:

pip install serverlessrepo

Basic Usage

The serverlessrepo module provides a simple interface for publishing applications and managing application permissions. To get started, import the serverlessrepo module:

import serverlessrepo

Publish Applications

publish_application(template)

Given an AWS Serverless Application Model (SAM) template, it publishes a new application using the specified metadata in AWS Serverless Application Repository. If the application already exists, it publishes a new application version.

update_application_metadata(template, application_id)

Parses the application metadata from the SAM template and updates the application.

Examples

Publish an application using local file template.yaml:

from serverlessrepo import publish_application

with open('template.yaml', 'r') as f:
    template = f.read()
    publish_application(template)

Or updates the application's metadata using template.yaml:

from serverlessrepo import update_application_metadata

with open('template.yaml', 'r') as f:
    template = f.read()
    application_id = 'arn:aws:serverlessrepo:us-east-1:123456789012:applications/test-app'
    update_application_metadata(template, application_id)

Manage Application Permissions

make_application_public(application_id)

Makes an application public so that it's visible to everyone.

make_application_private(application_id)

Makes an application private so that it's only visible to the owner.

share_application_with_accounts(application_id, account_ids)

Shares the application with specified AWS accounts.

Examples

from serverlessrepo import (
    make_application_public,
    make_application_private,
    share_application_with_accounts
)

application_id = 'arn:aws:serverlessrepo:us-east-1:123456789012:applications/test-app'

# Share an application publicly
make_application_public(application_id)

# Make an application private
make_application_private(application_id)

# Share an application with other AWS accounts
share_application_with_accounts(application_id, ['123456789013', '123456789014'])

Development

  • Clone the project to your local:
    • git clone https://github.com/awslabs/aws-serverlessrepo-python.git
  • Set up the environment: make init
    • It installs Pipenv to manage package dependencies. Then it creates a virtualenv and installs dependencies from Pipfile (including dev).
  • Install new packages: pipenv install [package names]
    • Pipenv will automatically update Pipfile and Pipfile.lock for you.
    • Add new dependencies to setup.py install_requires if they are needed for consumers of this library.
  • Verify that everything works: make build
    • You can run make tests separately to verify that tests pass.
    • Check code style with make flake and make lint.
  • Make code changes, run all verifications again before sending a Pull Request: make pr

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

serverlessrepo-0.1.1.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

serverlessrepo-0.1.1-py2.py3-none-any.whl (20.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file serverlessrepo-0.1.1.tar.gz.

File metadata

  • Download URL: serverlessrepo-0.1.1.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for serverlessrepo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cf74f668850b1d23cb75e24e42c141a7e8a7fdd38c5c9f74827296c28eb78764
MD5 f9d81369f4474e011de41a5227e57b51
BLAKE2b-256 83a6117cf93fc315cecc770b18551e685586f5a24247d8ee27482b5de5f17b88

See more details on using hashes here.

File details

Details for the file serverlessrepo-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: serverlessrepo-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for serverlessrepo-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b702ff0803b100f63cf4dd92a90c6aabdd171ae0dc42e6604c89b21672960ad
MD5 cfde50f8de41c4d803e002480f71bda0
BLAKE2b-256 85024fbe064cffa0489543bcd499b5f56450dd281fd3b478a8c382fda561e7cd

See more details on using hashes here.

Supported by

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