Registry / database / replit

replit

JSON →
library4.1.2pypypi✓ verified 86d ago

A library for interacting with Replit features such as the Replit Database (key-value store), Identity (auth tokens), Audio (deprecated), and other platform utilities. Current version 4.1.2 requires Python >=3.10, <4.0. Release cadence is irregular.

pip install replit
INSTALL
IMPORT
SIG · REPLIT
R
replit
databasepythonv4.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Database
from replit import Database
from replit.database import Database
Database was moved to `replit` directly; submodule import may sometimes work but is not guaranteed.
Audio
from replit import Audio
from replit.audio import Audio
Audio v3 API removed in v4.0.0. Use the new pattern or avoid entirely. Submodule import will fail.
Identity
from replit import Identity
Identity is available at `replit.Identity` since v3.4.0.

Basic usage of Replit Database (key-value store). Requires the REPLIT_DB_URL environment variable, which is automatically set in Replit environments.

import os from replit import Database # Get database URL from environment variable (set automatically in Replit) db_url = os.environ.get('REPLIT_DB_URL', '') if not db_url: print('REPLIT_DB_URL not set. Running outside Replit?') else: db = Database(db_url) db['key'] = 'Hello from replit-py' print(db['key'])
Debug
Known issues
breakingIn v4.0.0, the Audio module was removed entirely. Code using `from replit import Audio` or `from replit.audio import Audio` will break. There is no replacement provided.
fix
Remove any Audio usage. If you need audio playback, use a third-party library like `playsound`.
affects: >=4.0.0
breakingIn v3.6.1, Database keys with leading slashes were forbidden. The v3.6.3 release reverted this change, but if you upgraded to 3.6.1 or 3.6.2 and saved keys with slashes, they may have been stripped. Check your keys.
fix
If you used those versions and stored keys with leading slashes, you may need to re-add the slashes manually using a newer version.
affects: 3.6.1, 3.6.2
deprecatedThe `web` module (Flask/SocketIO integration) is considered deprecated in favor of standalone Flask or Starlette apps. It may be removed in a future major version.
fix
Avoid using `replit.web`. Use Flask or Starlette directly.
affects: >=4.0.0
gotchaWhen using `Database` outside of Replit environment, you must manually set `REPLIT_DB_URL`. The library does not provide a fallback.
fix
Set the environment variable `REPLIT_DB_URL` to a database endpoint URL (e.g., a local test server or the real Replit DB URL).
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'replit.audio'
Audio module was removed in v4.0.0.
fix
Replace `from replit.audio import Audio` with something else or update your code to not use Audio.
AttributeError: module 'replit' has no attribute 'Database'
You might be using an older version (<3.0) where Database was in a submodule.
fix
Upgrade to latest version: `pip install --upgrade replit` and use `from replit import Database`.
replit_python_flask_import_error: Flask not installed
The `replit.web` module depends on Flask, which is an optional dependency.
fix
Install Flask: `pip install flask`, or avoid using `replit.web`.
Upgrade
Version history
4.1.2latest on PyPI · released Jun 11, 2025
Audit
Dependencies
flaskoptionalRequired for the `replit.web` module (Flask integration). Optional if not using web features.
flask-socketiooptionalUsed for WebSocket support in the `replit.web` module.
requestsrequiredUsed internally for HTTP calls (Replit DB, Identity, etc.).
starletteoptionalUsed for ASGI support in `replit.web` and the Audio module (deprecated).
Agent activity
8 hits · last 30 days
node
6
Meta
1
Resources
replit — pip install replit · libregistry