Skip to main content

hatch-aws-publisher

PyPI - Version PyPI - Python Version Hatch project code style - black types - mypy imports - isort

AWS publisher plugin for Hatch 🥚🐍. Hatch is modern, extensible Python project manager.


Table of Contents

How to enable

Plugin must be installed in the same environment as Hatch itself.

python -m venv .venv
.venv/bin/pip install hatch-aws-publisher

How to use it

The publisher plugin name is called aws.

  1. Build you app with SAM. You can use my Hatch plugin hatch-aws.

  2. Put your SAM config to pyproject.toml (stack name is by default name of your project):

    [project]
    name = "my-app"
    
    [tool.hatch.publish.aws.sam]
    region = "us-west-1"
    confirm_changeset = false
    fail_on_empty_changeset = false
    force_upload = true
    capabilities = "CAPABILITY_IAM"
    s3_bucket = "my-bucket"
    parameter_overrides = ["stage=dev"]
    
    [tool.hatch.publish.aws.sam.tags]
    job = "batman"
    name = "bruce"
    
  3. Publish (deploy) your app.

    hatch publish -p aws
    

Options

section tool.hatch.publish.aws

This section allows to modify behavior of the plugin. Available options:

[tool.hatch.publish.aws]
stack_name_append_env = true
stack_name_prefix = "super-"
stack_name_suffix = "-man"
deploy = true

All above options can be overwritten using a CLI parameter

.venv/hatch/bin/hatch publish -p aws -o stack_name_prefix="bat-"
  • stack_name_prefix: adds a prefix to a stack name -> bat-my-app
  • stack_name_suffix: adds a suffix to a stack name -> bat-my-app-man
  • stack_name_append_env: adds a selected environment to a stack name -> bat-my-app-man-dev
  • deploy: if it's false, only sam config will be generated, but sam deploy will not be executed

section tool.hatch.publish.aws.sam

Default values for SAM. You can use any key:value pair available in SAM config.

Only difference is format of tags (they use separate section):

[tool.hatch.publish.aws.sam.tags]
job = "batman"
name = "bruce"

section tool.hatch.publish.aws.sam.env.<env-name>

You can define specific deployment environments. They inherit values from tool.hatch.publish.aws.sam.

Environment settings in pyproject.toml:

[tool.hatch.publish.aws.sam]
region = "us-west-1"
confirm_changeset = false
fail_on_empty_changeset = false
force_upload = true
capabilities = "CAPABILITY_IAM"

[tool.hatch.publish.aws.sam.env.dev]
region = "us-west-2"
s3_bucket = "dev-bucket"
parameter_overrides = ["stage=dev"]

[tool.hatch.publish.aws.sam.env.prd]
s3_bucket = "prd-bucket"
parameter_overrides = ["stage=prd"]
fail_on_empty_changeset = true

You need to specify an environment using a CLI parameter:

hatch publish -p aws -o env=dev

License

Plugin hatch-aws-publisher is distributed under the terms of the MIT license.

Release files for hatch-aws-publisher 0.3.0

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

Source distribution (sdist)

Source distribution for hatch-aws-publisher 0.3.0
File Size Uploaded
hatch_aws_publisher-0.3.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-aws-publisher 0.3.0
File Interpreter ABI Platform
hatch_aws_publisher-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / hatch_aws_publisher-0.3.0.tar.gz

Download URL hatch_aws_publisher-0.3.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9f7c0bb2f90d15a2fcfe27847f792de6e050170132baf57a30ee059f2a8912a5
BLAKE2b-256 checksum
How to use checksums
1edf64eee8df0265638d067a664859a900fb9117ddaebed1ea9118e08663f47a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.0

Release files / hatch_aws_publisher-0.3.0-py3-none-any.whl

Download URL hatch_aws_publisher-0.3.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4911e5cb7b2026cc0a103be9ffe3c405087b4d0eee72083d9511f6d7e2d839b3
BLAKE2b-256 checksum
How to use checksums
7c61266039987faed0d49c9af4a44c0731b383fdc581d938a8b1086b86a217e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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