$npx skillfedfor your agent

snapshot-restore-py

Runtime Hooks for AWS Lambda SnapStart - Python

With conditionsPyPI Software DevelopmentReleased Nov 20242.7M downloads / moApache License 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — snapshot_restore_py-1.0.0-py3-none-any.whl
v1.0.0 · released 2024-11-13 · Python >=3.9

Yes, if you are using AWS Lambda SnapStart with Python. The library is already pre-installed in Lambda runtimes, so you only need to add it to local development dependencies for testing. It has no external dependencies, a permissive license, and solves a specific optimization problem. Maintenance is dormant but the API is stable and the scope is narrow, so active updates are not critical.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9+.
  • Hooks registered in files not imported at the top level of your Lambda handler will be ignored; ensure all hook imports occur before lambda_handler execution.
  • Low friction: pure Python wheel with no runtime dependencies.

License · maintenance · safety

Apache License 2.0 (permissive) — Apache License 2.0 (permissive) allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.

last release 2024-11-13 (639 days) · last repo commit 2024-11-18 · 11 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,681,307 downloads/mo, #2,943 on PyPI

Verify before relying

from snapshot_restore_py import register_before_snapshot, register_after_restore

@register_before_snapshot
def setup():
    # initialization code
    pass

@register_after_restore
def restore():
    # post-restore code
    pass
  • Whether the pre-installed version in Lambda runtime matches the PyPI release version and how version mismatches are handled.
  • Performance impact of hook registration and execution order on Lambda cold-start times.
  • Compatibility with Lambda extensions or other SnapStart-related tooling.
Same gist for agents: .md · .json

What it is and what it does

Snapshot Restore for Python is a lightweight library that lets you hook into AWS Lambda's SnapStart lifecycle by registering code to run before a snapshot is captured and after it is restored. It provides two decorators (`@register_before_snapshot` and `@register_after_restore`) and corresponding function-based registration methods to control initialization and cleanup around snapshot boundaries. The library has no runtime dependencies and is already bundled in Lambda runtime environments, making it a zero-friction addition to SnapStart-enabled functions.

The main use case is optimizing Lambda cold starts by deferring expensive initialization (database connections, external API calls, resource setup) until after a snapshot is restored, rather than on every invocation. BeforeSnapshot hooks run in reverse registration order; AfterRestore hooks run in registration order. Hooks must be registered at module level to be recognized; registering them inside the handler or in unimported files will be silently ignored.

Use it for

  • Initialize database connections or connection pools after snapshot restore to avoid stale connections.
  • Warm up external API clients or SDKs after restore to ensure fresh authentication and state.
  • Clean up temporary resources or close file handles before snapshot to prevent state corruption.
  • Establish logging or monitoring context after restore for accurate request tracing.
  • Reload configuration or environment-specific settings after restore in multi-environment deployments.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you are using AWS Lambda SnapStart with Python.

The library is already pre-installed in Lambda runtimes, so you only need to add it to local development dependencies for testing. It has no external dependencies, a permissive license, and solves a specific optimization problem. Maintenance is dormant but the API is stable and the scope is narrow, so active updates are not critical.

Install

snapshot-restore-py on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Dormant maintenance status (last commit 2024-11-18, no updates since initial release 2024-11-13), but the library is pre-installed in AWS Lambda runtime environments, so local installation is primarily for development and testing.

Requires Python 3.9+. Hooks registered in files not imported at the top level of your Lambda handler will be ignored; ensure all hook imports occur before lambda_handler execution.

License in practice

Apache License 2.0 (permissive) allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.

Quickstart

from snapshot_restore_py import register_before_snapshot, register_after_restore

@register_before_snapshot
def setup():
    # initialization code
    pass

@register_after_restore
def restore():
    # post-restore code
    pass

Verify before relying

  • Whether the pre-installed version in Lambda runtime matches the PyPI release version and how version mismatches are handled.
  • Performance impact of hook registration and execution order on Lambda cold-start times.
  • Compatibility with Lambda extensions or other SnapStart-related tooling.

Package facts

LicenseApache License 2.0 permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceDormant 639 days since the last release
Last repo commit
First released
Downloads2,681,307 / month, #2,943 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Evidence: snapshot_restore_py-1.0.0-py3-none-any.whl

Tags

Capabilities
aws lambda snapstart hookslambda snapshot restore pythonruntime hooks lambdabefore snapshot after restorelambda snapstart decoratoraws lambda initialization hookslambda cold start optimization
Topics
aws-lambdasnapstartserverless
PyPI keywords
serverlessawslambdapythonsnapstartruntimehooks

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “aws lambda snapstart hooks”

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also django-lifecycle · snapshottest · pytest-insta · threaded · google-python-cloud-debugger · pytest-snapshot · botoinator · redo · inline-snapshot · undecorated