Skip to main content

mountaineer-cloud

Shared cloud primitives for Python webservices, in particular ones built off of Mountaineer or FastAPI.

Most webapps themselves are cloud-agnostic and can be distributed within any Linux environment. This works pretty well when your whole application is stateless and just talks to a database, but falls down once you actually start needing infrastructure that spawns across your whole cluster. This package exists for the places where that abstraction breaks down and you still need a clean way to work with a real supplier:

  • Object storage
  • Email delivery

Installation

Install the package as usual. If you want additional dependencies to mock (some) providers locally, also install the mocks extra:

uv add "mountaineer-cloud"
uv add --dev "mountaineer-cloud[mocks]"

Storage Primitive

The core convention for our storage primitives is:

  1. A provider package establishes how to connect to the real supplier (S3, R2, etc).
  2. That provider exposes an authenticated *Core object.
  3. A primitive accepts that core object and uses it to perform work.

For storage, that means your field annotation carries the provider core type:

from fastapi import Depends
from iceaxe import Field, TableBase

from mountaineer_cloud import CloudMixin
from mountaineer_cloud.primitives import CloudFile, CloudFileField
from mountaineer_cloud.providers.aws import AWSCore, AWSDependencies


class Asset(CloudMixin, TableBase):
    id: int = Field(primary_key=True)
    file_url: CloudFile[AWSCore] | None = CloudFileField(
        bucket="my-bucket",
        prefix="assets",
    )


async def upload_asset(
    asset: Asset,
    aws: AWSCore = Depends(AWSDependencies.get_aws_core),
) -> bytes:
    await asset.file_url.put_content(aws, b"hello world")
    contents = await asset.file_url.get_content(aws)
    return contents


async def get_asset_contents(
    asset: Asset,
    aws: AWSCore = Depends(AWSDependencies.get_aws_core),
) -> bytes:
    return await asset.file_url.get_content(aws)


async def delete_asset(
    asset: Asset,
    aws: AWSCore = Depends(AWSDependencies.get_aws_core),
) -> None:
    # Removes the remote object and resets `asset.file_url` to an empty pointer
    await asset.file_url.delete(aws)

If you later move that same model or endpoint to another provider, the primitive API stays the same. Thanks to the magic of typehinting, we'll proactively flag errors if you're trying to use a backend provider that doesn't support the functionality you expect. The main thing that changes is the core type:

  • CloudFile[AWSCore]
  • CloudFile[CloudflareCore]
  • CloudFile[DigitalOceanCore]

CloudFile has support for writing, reading, and deleting in one fell-swoop, in addition to streaming reads that are more efficient for large files stored remotely.

Storage failures are raised as native Python exceptions where one fits, so remote files can be handled like local ones. Conditions without a native equivalent get their own types, which subclass botocore's ClientError so existing handlers still catch them. The original provider error is always available as __cause__.

Condition Raised
Object does not exist FileNotFoundError
Access denied PermissionError
Bucket does not exist StorageBucketNotFoundError
Request throttled StorageRateLimitError
try:
    contents = await asset.file_url.get_content(aws)
except FileNotFoundError:
    contents = None

Email Primitive

Email follows the same convention, except the primitive is a regular embedded Pydantic model instead of a string-backed pointer:

from fastapi import Depends
from iceaxe import Field, TableBase

from mountaineer_cloud import CloudMixin
from mountaineer_cloud.primitives import (
    CloudEmailField,
    EmailBody,
    EmailMessage,
    EmailRecipient,
)
from mountaineer_cloud.providers.resend import ResendCore, ResendDependencies


class Notification(CloudMixin, TableBase):
    id: int = Field(primary_key=True)
    email: EmailMessage[ResendCore] | None = CloudEmailField()


async def send_notification(
    notification: Notification,
    resend: ResendCore = Depends(ResendDependencies.get_resend_core),
):
    notification.email = EmailMessage[ResendCore](
        sender=EmailRecipient(
            email="noreply@example.com",
            display_name="Example App",
        ),
        recipient=EmailRecipient(email="user@example.com"),
        subject="Welcome",
        body=EmailBody(
            text="Welcome to Example App",
            html="<p>Welcome to Example App</p>",
        ),
    )

    return await notification.email.send(resend)

Providers

Each provider module establishes the concrete connection details for an underlying supplier.

Every provider package follows the same pattern:

  • *Config: the settings model you inherit into your downstream app config
  • *Core: the authenticated runtime object that combines provider config with an authenticated session
  • *Dependencies: dependency-injected helpers like get_*_core, useful when using the DI syntax of FastAPI and Mountaineer

This is the center of the convention.

Your endpoint should depend on the provider core, not on a raw client or session. Then your primitive should accept that core and perform the actual work. This keeps supplier-specific connection logic inside the provider package and keeps the primitive surface stable.

Provider Storage Email Config / Core / Dependencies
AWS Yes, via S3 Yes, via SES AWSConfig, AWSCore, AWSDependencies
Cloudflare Yes, via R2 No CloudflareConfig, CloudflareCore, CloudflareDependencies
DigitalOcean Yes, via Spaces No DigitalOceanConfig, DigitalOceanCore, DigitalOceanDependencies
Resend No Yes ResendConfig, ResendCore, ResendDependencies

Environment variables are intentionally omitted here because each provider's settings can evolve over time. The source of truth is the corresponding *Config model in the provider package.

The usage pattern stays the same across providers:

from fastapi import Depends

from mountaineer_cloud.providers.aws import AWSCore, AWSDependencies


async def endpoint(
    aws: AWSCore = Depends(AWSDependencies.get_aws_core),
) -> None:
    ...

Metadata

Release files for mountaineer-cloud 0.2.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 mountaineer-cloud 0.2.1
File Size Uploaded Provenance Actions
mountaineer_cloud-0.2.1.tar.gz 974.6 kB With provenance Details for mountaineer_cloud-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mountaineer-cloud 0.2.1
File Interpreter ABI Platform Actions
mountaineer_cloud-0.2.1-py3-none-any.whl Python 3 none any Details for mountaineer_cloud-0.2.1-py3-none-any.whl

Total release size: 1.0 MB

Release files / mountaineer_cloud-0.2.1.tar.gz

Download URL mountaineer_cloud-0.2.1.tar.gz
Size 974.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a37fd26c5a74f9c141dabc5e87a8e4405b8a0fb767761826745cfba17364a632
BLAKE2b-256 checksum
How to use checksums
ad08a01edf973b79d4484ad4530ef12a227188eafcc8e4f678128aeb46dfc84b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 12, 2026.

Transparency log

Release files / mountaineer_cloud-0.2.1-py3-none-any.whl

Download URL mountaineer_cloud-0.2.1-py3-none-any.whl
Size 51.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfb6826091e31cbcfe6c85f2e26deb00c231c91db24ef7ae4f5d8e3d63d295da
BLAKE2b-256 checksum
How to use checksums
3f8bc12278e958e7dc2f202a783bd8d2972e0b265281f94b7a0e167fad86cbe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 12, 2026.

Transparency log

Security for mountaineer-cloud 0.2.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 mountaineer_cloud-0.2.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 12, 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.

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