Skip to main content

easy_sm

Train, run and deploy on AWS SageMaker. Every command works locally in Docker first (--local), then the same command runs in the cloud.

You need Docker, uv, AWS credentials (as for the AWS CLI) and a SageMaker execution role:

uv tool install easy_sm
export SAGEMAKER_ROLE=arn:aws:iam::123456789012:role/my-sagemaker-role

Version 2 is a rewrite and does not read 1.x projects. Inside a project, uv run easy_sm ... uses the version locked in its uv.lock; upgrade it with uv lock --upgrade-package easy_sm.

AWS setup

The SageMaker execution role (SAGEMAKER_ROLE, or [aws] role in easy_sm.toml) is the identity your jobs and endpoints run as. It needs:

  • a trust policy that lets sagemaker.amazonaws.com assume it (easy_sm never assumes it itself, so it doesn't need to trust your user)
  • ECR: pull the project image (ecr:GetAuthorizationToken, ecr:BatchGetImage, ecr:GetDownloadUrlForLayer)
  • S3: read training and run inputs, write models and run outputs, read model.tar.gz for endpoints (s3:GetObject, s3:PutObject, s3:ListBucket)
  • CloudWatch Logs: write job and endpoint logs (logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents)
  • anything your own code calls (other buckets, secrets, databases)

A minimal role for easy_sm's defaults: replace REGION, ACCOUNT and APP (your app_name).

Trust policy:

{
  "Version": "2012-10-17",
  "Statement": [
    { "Effect": "Allow", "Principal": { "Service": "sagemaker.amazonaws.com" }, "Action": "sts:AssumeRole" }
  ]
}

Permissions policy:

{
  "Version": "2012-10-17",
  "Statement": [
    { "Sid": "EcrLogin", "Effect": "Allow", "Action": "ecr:GetAuthorizationToken", "Resource": "*" },
    {
      "Sid": "PullProjectImage", "Effect": "Allow",
      "Action": ["ecr:BatchGetImage", "ecr:GetDownloadUrlForLayer", "ecr:BatchCheckLayerAvailability"],
      "Resource": "arn:aws:ecr:REGION:ACCOUNT:repository/APP"
    },
    { "Sid": "ListBucket", "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::sagemaker-REGION-ACCOUNT" },
    {
      "Sid": "ReadWriteProjectData", "Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject"],
      "Resource": "arn:aws:s3:::sagemaker-REGION-ACCOUNT/APP/*"
    },
    {
      "Sid": "Logs", "Effect": "Allow",
      "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DescribeLogStreams"],
      "Resource": "arn:aws:logs:REGION:ACCOUNT:log-group:/aws/sagemaker/*"
    },
    { "Sid": "Metrics", "Effect": "Allow", "Action": "cloudwatch:PutMetricData", "Resource": "*" }
  ]
}

If train.input, train.output, run.input or run.output point at other buckets, add them to the two S3 statements; KMS-encrypted buckets also need kms:Decrypt and kms:GenerateDataKey on their key. The managed policy AmazonSageMakerFullAccess is a broader alternative that also covers buckets with sagemaker in their name.

You (or CI) running easy_sm need:

  • sts:GetCallerIdentity
  • iam:PassRole on the execution role, to hand it to SageMaker
  • ECR: ecr:GetAuthorizationToken, DescribeRepositories, CreateRepository, DescribeImages and push (BatchCheckLayerAvailability, InitiateLayerUpload, UploadLayerPart, CompleteLayerUpload, PutImage)
  • S3: s3:ListBucket, s3:PutObject, and s3:CreateBucket if the default bucket doesn't exist yet
  • SageMaker: create, describe, list and stop training and processing jobs; create and describe models and endpoint configs; create, update, describe, list, invoke and delete endpoints; delete endpoint configs (only with --delete-config)
  • CloudWatch Logs: logs:DescribeLogStreams, logs:GetLogEvents (to show job logs)

Good to know:

  • Credentials come from your environment exactly as for the AWS CLI; they never go in easy_sm.toml. Run easy_sm env to see which account and credential source are in use before cloud work.
  • The role, the ECR repository, the S3 data and the jobs must be in the same region (AWS_REGION, [aws] region, or your AWS CLI default).
  • easy_sm creates two things on first use: an ECR repository named after the app (tags are immutable), and the bucket sagemaker-<region>-<account> when no S3 paths are configured.
  • New accounts often have a quota of 0 for some instance types; a job then fails with ResourceLimitExceeded until a quota increase is approved.
  • Endpoints cost money for every hour they are InService, used or not; serverless endpoints only when called. easy_sm never deletes models, endpoint configs, images or S3 data; clean up with endpoints delete and the AWS console.
  • Images are built for linux/amd64, the machines SageMaker runs. On an Apple Silicon Mac that works through emulation, so the first build is slower.

Example 1: train and deploy a model

easy_sm init churn && cd churn       # creates src/train.py, src/predict.py, data/train.csv
easy_sm train --local                # train in Docker on data/
easy_sm data upload                  # copy data/ to S3
easy_sm train                        # train on SageMaker; prints the job name
easy_sm endpoints deploy --latest    # serve that job's model; prints the endpoint name
easy_sm endpoints invoke -d '{"inputs": [[1.0], [2.0]]}'
easy_sm endpoints delete churn       # stop paying for the endpoint

Your code is two functions:

# src/train.py
def train(input_dir: str, model_dir: str) -> None:
    ...  # read data from input_dir, save the model into model_dir

# src/predict.py
class Handler:
    def __init__(self, model_dir: str): ...   # load the model once
    def __call__(self, data): ...             # one request in, JSON-able result out

Example 2: run a script

# put your script in src/process.py
easy_sm run --local process.py --date 2026-11-01   # in Docker
easy_sm run process.py --date 2026-11-01           # as a SageMaker processing job

Arguments after the script name go to the script. Any command works: Python tools added with uv add (e.g. dbt) are in the image already. For system tools like make or git, run easy_sm dockerfile > Dockerfile and add an apt-get install line after FROM; easy_sm then builds with it.

Commands

Command What it does
easy_sm init NAME Create a project
easy_sm env Show settings, the image tag and the AWS account in use
easy_sm train [--local] Train with src/train.py
easy_sm run [--local] COMMAND Run a script or command from src/
easy_sm data upload Upload data/ to S3
easy_sm endpoints deploy --latest Deploy the newest trained model
easy_sm endpoints invoke -d DATA Send one prediction request
easy_sm endpoints serve --local Serve the local model on 127.0.0.1
easy_sm endpoints ls / describe / delete NAME List, show, delete endpoints
easy_sm jobs ls / inspect / logs / cancel / artifacts List and manage jobs
easy_sm build / push Build the image / push it to ECR (other commands do this when needed)
easy_sm dockerfile Print the generated Dockerfile (> Dockerfile to customise it)
easy_sm skill Write a guide for coding agents to .claude/skills/easy_sm/SKILL.md

Add --dry-run to train, run, push or endpoints deploy to see what would be sent without changing anything, and --format json to env, jobs and endpoints listings for scripts. Settings such as instance types live in easy_sm.toml; a flag overrides them for one run. AWS credentials never go in that file.

Credits

The design of easy_sm 2 borrows heavily from the Hugging Face Hub CLI (hf): commands grouped by resource then action, the main object as a positional argument, run taking the command directly like hf jobs run, user inference code as a small handler class like Inference Endpoints' handler.py, deploying from a training job the way hf deploys from a repo, and a skill file for coding agents like hf skills add. Thanks to the Hugging Face team for a CLI worth learning from.

Metadata

Release files for easy-sm 2.0.1

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

Source distribution (sdist)

Source distribution for easy-sm 2.0.1
File Size Uploaded Provenance Actions
easy_sm-2.0.1.tar.gz 256.9 kB With provenance Details for easy_sm-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easy-sm 2.0.1
File Interpreter ABI Platform Actions
easy_sm-2.0.1-py3-none-any.whl Python 3 none any Details for easy_sm-2.0.1-py3-none-any.whl

Total release size: 296.2 kB

Release files / easy_sm-2.0.1.tar.gz

Download URL easy_sm-2.0.1.tar.gz
Size 256.9 kB
Tags Source
SHA-256 checksum
How to use checksums
23f55b70903b92d4a25a2650f8bbcfef4a19209fc68185f0ef37d036c4d4cd8d
BLAKE2b-256 checksum
How to use checksums
7f854839131081d3a51d1e1a16823e066a5098649ee38e64a715a853fbf756b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / easy_sm-2.0.1-py3-none-any.whl

Download URL easy_sm-2.0.1-py3-none-any.whl
Size 39.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72825d1c3d443f522f21f4029a77be50a98190ce941fd72b15a56c8808c750d0
BLAKE2b-256 checksum
How to use checksums
8c499aab0bc537860cc3288581f549f2a07851a1e06dffc35558e724bb53592f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for easy-sm 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for easy_sm-2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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