Loading...
Unleash's Python SDK is straightforward — `is_enabled()` returns a boolean. But in real codebases, that call gets wrapped in decorators, cached in request objects, and threaded through dependency injection. FlagShark follows it all.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
from UnleashClient import UnleashClient
client = UnleashClient(url="https://unleash.example.com/api", app_name="myapp")
client.initialize_client()
@app.get("/search")
async def search(query: str, user: User = Depends(get_current_user)):
if client.is_enabled("advanced-search", {"userId": user.id}):
return await advanced_search(query)
return await basic_search(query)@app.get("/search")
async def search(query: str, user: User = Depends(get_current_user)):
return await advanced_search(query)FlagShark uses Python AST module for static analysis of SDK imports and calls to find every call to isEnabled(), getVariant(), getAllToggles()across your Django, FastAPI, Flask codebase.
Each detected flag key is matched against your Unleash project to check rollout status, last evaluation date, and whether the flag is archived or still active.
For each stale flag, FlagShark creates a pull request that removes the SDK call, eliminates the dead code branch, and preserves the winning path. Every PR includes a before/after diff you can review.
The Unleash Python client runs a background polling thread — removing the last toggle usage means you should also remove the client initialization and `destroy()` call, otherwise you have an idle thread polling Unleash for nothing.
Grep misses flags behind abstractions. AST-level scanning catches SDK calls that regex can't.
Every cleanup goes through code review. No surprises, no broken builds.
Only flags at 100% rollout for your configured threshold are suggested for removal.
New stale flags are detected automatically. Your codebase stays clean without manual audits.
isEnabled()getVariant()getAllToggles()Plus custom patterns you define in .flagshark.yaml
FlagShark parses your Python files with the `ast` module, identifies `UnleashClient` imports and initialization, then traces every `is_enabled()` and `get_variant()` call. It resolves toggle names from string literals and constants.
Yes. FlagShark understands FastAPI's `Depends()` system and detects Unleash checks inside dependency functions. It generates diffs that simplify the dependency chain when flag checks are removed.
FlagShark detects context dictionaries passed to `is_enabled()` and warns when removing a toggle would also orphan context-building helper functions.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
Find and remove stale Unleash feature toggles from React, Next.js, and Node.js TypeScript projects.
Systematically identify and remove stale Unleash toggles from Go services and CLI applications.
Find and remove dead Unleash toggles from Spring Boot applications and Java microservices.
Detect and safely remove stale Unleash feature toggles from Rails applications and Ruby services.
Use Rust's type system and FlagShark to find and remove dead Unleash toggles from Actix and Axum services.
Step-by-step process for identifying and removing dead LaunchDarkly flags in Django, FastAPI, and Flask applications.
Find and clean up stale Split.io feature flag treatments in Django, FastAPI, and Flask projects.
Find and remove dead PostHog flags from Django and FastAPI Python backends.
Identify and remove stale Flagsmith flags from Django and Flask Python applications.
Find and remove stale ConfigCat flags from Django, FastAPI, and Flask Python applications.