Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>TripWire - Environment Variable ManagementNew to Visual Studio Code? Get it now.
TripWire - Environment Variable Management

TripWire - Environment Variable Management

Daily-Nerd

|
3 installs
| (0) | Free
Smart autocomplete, validation, and navigation for TripWire environment variables
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TripWire - Smart Environment Variable Management for VS Code

License

Stop environment variable errors before they crash your Python applications. TripWire brings intelligent autocomplete, real-time validation, and seamless navigation to your environment variables workflow.

Features

🎯 Smart Autocomplete

Get intelligent suggestions as you type env.require() or env.optional() in your Python code:

  • Auto-suggests variable names from .tripwire.toml or .env.example
  • Shows type information and validation rules inline
  • Prioritizes required variables
  • Visual indicators for secrets

💡 Rich Hover Tooltips

Hover over any environment variable to see:

  • Variable type and format validators
  • Required/optional status
  • Default values
  • Validation rules (min/max values, length, patterns, choices)
  • Security warnings for secrets
  • Source file location

🔍 Real-Time Validation

Instant feedback as you edit .env files:

  • Errors for missing required variables
  • Warnings for invalid formats (email, URL, PostgreSQL, UUID, IPv4)
  • Hints for undefined variables not in schema
  • Type checking for int, float, bool, list, dict

🧭 Go-to-Definition

Jump seamlessly between files:

  • From Python code → .env file
  • From .env file → .tripwire.toml schema
  • Bidirectional navigation support

🎨 Syntax Highlighting

Beautiful syntax highlighting for .env files:

  • Variable names, values, and comments
  • String interpolation with ${VAR} syntax
  • Quoted strings (single and double)

Installation

  1. Install from VS Code Marketplace:

    • Open VS Code
    • Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
    • Search for "TripWire"
    • Click "Install"
  2. Install TripWire Python Library:

    pip install tripwire-py
    
  3. Create a schema file (optional but recommended):

    cd your-project
    tripwire schema from-code  # Generate from Python code
    # OR
    tripwire schema from-example  # Generate from .env.example
    

Requirements

  • VS Code 1.85.0 or higher
  • Python 3.11+ with TripWire installed (for full validation)
  • A .tripwire.toml schema or .env.example file in your workspace

Quick Start

  1. Create a .tripwire.toml schema in your project root:
[variables.DATABASE_URL]
type = "string"
required = true
format = "postgresql"
description = "PostgreSQL database connection string"
secret = true

[variables.PORT]
type = "int"
required = false
default = "8000"
min_val = 1
max_val = 65535
description = "Application server port"

[variables.DEBUG]
type = "bool"
required = false
default = "false"
description = "Enable debug mode"
  1. Use in your Python code:
from tripwire import env

# Autocomplete kicks in as you type! ✨
DATABASE_URL: str = env.require("DATABASE_URL")  # Hover for details
PORT: int = env.optional("PORT", default=8000)
DEBUG: bool = env.optional("DEBUG", default=False)
  1. Edit your .env file:
# TripWire validates in real-time! 🔍
DATABASE_URL=postgresql://localhost/mydb  # ✅ Valid
PORT=8080  # ✅ Valid
# DEBUG=maybe  # ❌ Error: invalid boolean

Extension Commands

Access from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):

  • TripWire: Validate Configuration - Manually validate all .env files
  • TripWire: Show Variable Information - Browse all environment variables

Extension Settings

Configure TripWire in your VS Code settings:

{
  "tripwire.schemaPath": ".tripwire.toml",
  "tripwire.enableDiagnostics": true,
  "tripwire.enableAutoComplete": true,
  "tripwire.pythonPath": "python"
}

How It Works

Schema-Based Validation

TripWire uses your .tripwire.toml schema as the source of truth:

[variables.API_KEY]
type = "string"
required = true
secret = true
min_length = 32
max_length = 128
pattern = "^sk-[a-zA-Z0-9]+$"

The extension parses this schema and provides:

  • Autocomplete suggestions
  • Hover documentation
  • Real-time validation errors
  • Go-to-definition navigation

Fallback to .env.example

If no .tripwire.toml exists, TripWire falls back to .env.example:

# API key for external service
API_KEY=your-key-here

The extension infers:

  • Variable names
  • Basic type detection
  • Comments as descriptions

Performance

  • Caching: Schema parsed once and cached (1-minute TTL)
  • Incremental: Only re-validates changed files
  • Non-blocking: All operations run asynchronously
  • Efficient: <100ms response time for autocomplete

Supported Validators

TripWire validates the following formats:

Basic Types

  • string, int, float, bool
  • list (comma-separated or JSON array)
  • dict (JSON object)

Format Validators

  • email - Valid email address
  • url - Valid HTTP/HTTPS URL
  • postgresql - PostgreSQL connection string
  • uuid - UUID v4 format
  • ipv4 - IPv4 address

Range Validators

  • min_val / max_val - Numeric ranges
  • min_length / max_length - String length
  • pattern - Regular expression matching
  • choices - Enum/allowed values

Troubleshooting

Autocomplete not working?

  1. Check your schema file exists (.tripwire.toml or .env.example)
  2. Verify schema syntax: tripwire schema check
  3. Reload VS Code window: Cmd+Shift+P → "Reload Window"

Diagnostics showing false errors?

  1. Update schema: tripwire schema from-code
  2. Check file encoding (must be UTF-8)
  3. Disable diagnostics: "tripwire.enableDiagnostics": false

Go-to-definition not jumping?

  1. Ensure variable exists in both files
  2. Check file paths are correct
  3. Verify workspace folder is open

Use Cases

FastAPI Projects

from tripwire import env
from fastapi import FastAPI

# TripWire validates at startup! 🚀
DATABASE_URL: str = env.require("DATABASE_URL", format="postgresql")
API_KEY: str = env.require("API_KEY", min_length=32)
DEBUG: bool = env.optional("DEBUG", default=False)

app = FastAPI(debug=DEBUG)

Django Settings

from tripwire import env

# Fail fast if config is invalid
SECRET_KEY: str = env.require("SECRET_KEY", min_length=50)
ALLOWED_HOSTS: list[str] = env.require("ALLOWED_HOSTS", type=list)
DATABASE_URL: str = env.require("DATABASE_URL", format="postgresql")

Data Science Workflows

from tripwire import env

# Validate API keys for cloud services
AWS_ACCESS_KEY_ID: str = env.require("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY: str = env.require("AWS_SECRET_ACCESS_KEY")
S3_BUCKET: str = env.require("S3_BUCKET", pattern="^[a-z0-9-]+$")

Comparison with Other Extensions

Feature TripWire DotEnv Env File
Python-native validation ✅ ❌ ❌
Schema-based autocomplete ✅ ❌ ❌
Real-time type checking ✅ ❌ ❌
Hover tooltips with metadata ✅ ❌ ❌
Go-to-definition ✅ ❌ ✅
Syntax highlighting ✅ ✅ ✅
Secret detection warnings ✅ ❌ ❌

Contributing

TripWire is open source! Contributions welcome:

  • Report bugs: GitHub Issues
  • Feature requests: GitHub Discussions
  • Code contributions: Pull Requests

Links

  • GitHub: Daily-Nerd/TripWire
  • Documentation: TripWire Docs
  • Python Package: PyPI
  • Changelog: CHANGELOG.md

License

MIT License - see LICENSE for details.

Support

  • Discord: Join our community (coming soon)

Made with ❤️ by the TripWire team. Catch config errors before they explode! 💥

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft