Skip to main content

Build Status Join our community Slack

This repository contains different utilities and tools which help with the StackStorm integration pack development.

Installation

From PyPi (latest stable version):

pip install st2sdk

From git (latest in development version):

pip install -e git+https://github.com/StackStorm/st2sdk.git@master#egg=st2sdk

Tools

Pack Bootstrap / Scaffolding tool

Pack bootstrap tool makes it easier to get started with the StackStorm pack development.

Currently, the tool creates the correct pack directory structure.

Usage

Run tool in the non-interactive mode:

st2sdk bootstrap <pack name>

This will create a pack directory named <pack name> in the current working directory. This directory will contain all the directories and files which are needed by pack.

Run tool in the interactive mode:

st2sdk bootstrap -i [pack name]

In the interactive mode, the tool will ask you a couple of questions and the answers will be used to populate pack metadata and other files.

Check and Lint scripts

This repository also contains various “check” and “lint” scripts which can be ran standalone or hooked up to your continuous integration system. Those scripts validate metadata file syntax, verify that pack contains pack.yaml file, etc.

Some of those scripts require access to the database and network (e.g. PyPi to download pack dependencies, etc.) and they also manipulate the file system. You should make sure that you provide a clean environment on every invocation of those scripts. This can be achieved by using a fresh VM, docker container or similar for each run.

All of those scripts are also hooked up to our Travis CI system and run on every push to our st2contrib repository.

For some examples on how to utilize this scripts, please refer to the Makefile in st2contrib repository - https://github.com/StackStorm/st2contrib/blob/master/Makefile

As you may notice in the Makefile, we have some scripts and optimizations in place, so by default for Pull Request we only run scripts on changed files and / or pack. This is an important optimization because if we ran scripts for all the files and packs (even the ones which haven’t been touched) this would substantially slow down the CI run time for a particular Pull Request and delay the time it takes for user to get feedback about their PR.

In case you have a lot of custom packs in your repository, you might want to utilize similar approach.

st2-check-validate-yaml-file

This script verifies that a provided YAML file contains a valid syntax. It’s usually used with action metadata files and other YAML files.

Usage:

st2-check-validate-yaml-file <path to YAML file>

Keep in mind that this script just performs syntax and no semantic checks. If you want to confirm that your action or other metadata file is correct, you should also run st2-check-register-pack-resources script which tries to register all the resources in a pack and errors out of registration

st2-check-validate-json-file

This script verified that a provided JSON file contains a valid syntax. It’s usually used with action metadata files and other YAML files.

Usage:

st2-check-validate-json-file <path to JSON file>

Keep in mind that this script just performs syntax and no semantic checks. If you want to confirm that your action or other metadata file is correct, you should also run st2-check-register-pack-resources script which tries to register all the resources in a pack and errors out of registration of a particular resource fails.

st2-check-validate-pack-metadata-exists

This script verifies that a pack contains pack.yaml metadata file.

Usage:

st2-check-validate-pack-metadata-exists <path to the pack root directory>

st2-check-register-pack-resources

This script tries to register all the resources in a particular pack and fails if registering a particular resource fails.

Usage:

st2-check-register-pack-resources <path to the pack root directory>

This script requires access to a fresh database (MongoDB) on each run. In addition to that, it requires all the StackStorm components (st2actions, st2common, etc.) to be in PYTHONPATH. You can achieve that by cloning st2 repository in a particular directly (e.g. /tmp/st2) and then setting ST2_REPO_PATH environment variable to point to that directory when invoking the script.

st2-check-pylint-pack

This script runs pylint on all the Python files inside a particular pack.

Usage:

st2-check-pylint-pack <path to the pack root directory>

This script installs packs regular and test requirements so it needs to run inside a virtual environment which is created for purpose of this script.

Similar to st2-check-register-pack-resources this script also requires access to StackStorm code-base and st2 components. You can achieve that by cloning st2 repository in a particular directly (e.g. /tmp/st2) and then setting ST2_REPO_PATH environment variable to point to that directory when invoking the script.

st2-check-print-pack-tests-coverage

This script prints a test coverage for a particular pack. It prints all the actions which contains tests and the ones which are missing it.

Keep in mind that this script is for informational purposes only - right now it doesn’t fail if some action is missing tests.

Usage:

st2-check-print-pack-tests-coverage <path to the pack root directory>

Metadata

Release files for st2sdk 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for st2sdk 0.5.2
File Interpreter ABI Platform
st2sdk-0.5.2-py3-none-any.whl Python 3 none any Details

Release files / st2sdk-0.5.2-py3-none-any.whl

Download URL st2sdk-0.5.2-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e53cc2903f32684375d0f13481a130fe50ceed4489e2bd78b7fa5bb1bb22bb0
BLAKE2b-256 checksum
How to use checksums
bc908fb0cd630a1967877cafb2b9c5c7d79c647e134f6949ae4e93c17573fb10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.5.2 This release

1 release file

0.5.1

2 release files

0.5.0

2 release files

0.4.1

1 release file

0.4.0

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.1

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page