Speeding up Deploys with Caching
If your Python or Node Replit App follows a set of constraints, it’s possible to speed up the Deployment process by enabling package caching. This feature works by caching the language-specific dependencies of your Replit App for reuse across deploys.
Prerequisites
Python
- Your Replit App uses Python 3.10 or above
- You are using the
poetry
backend for upm. Currently,pip
is not supported for this feature. - All of your projects’ dependencies are tracked in your
pyproject.toml
, and you have a currentpoetry.lock
.
Node
- Your project uses npm version 7 or above
Enabling Package Caching
If your Replit App follows the prerequisites above, you can try enabling package caching to speed up deploys. To do this, you need to define an environment variable in the .replit
file. For Python Replit App, the variable is REPLIT_PYTHON_PACKAGE_LAYER
. For Node Replit App, it’s REPLIT_NODEJS_PACKAGE_LAYER
.
Set the correct environment variable in the [env]
section of the .replit
file.
After the initial Deployment with caching enabled, the build system will cache the dependencies for quicker future Deployments.
Troubleshooting
If your Deployment fails during the Bundle
or Promote
steps, you may need to disable package caching.
To do that, just remove the environment variable definitions from .replit
.
Was this page helpful?