Loading...
Python's dynamic nature makes it easy to scatter flag checks across decorators, middleware, and views. FlagShark's Python AST analysis pinpoints every `variation()` call and maps it back to your LaunchDarkly project so you can retire flags confidently.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
import ldclient
def get_dashboard(request):
user = ldclient.Context.builder(request.user.id).build()
show_new_dash = ldclient.get().variation("new-dashboard", user, False)
if show_new_dash:
return render(request, "dashboard_v2.html")
return render(request, "dashboard.html")def get_dashboard(request):
return render(request, "dashboard_v2.html")FlagShark uses Python AST module for static analysis of SDK imports and calls to find every call to variation(), variationDetail(), boolVariation(), stringVariation()across your Django, FastAPI, Flask codebase.
Each detected flag key is matched against your LaunchDarkly 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.
Python decorators that wrap flag evaluation (e.g. `@feature_flag("new-dashboard")`) hide the SDK call from simple grep-based tools — you need full AST traversal to find them reliably.
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.
variation()variationDetail()boolVariation()stringVariation()Plus custom patterns you define in .flagshark.yaml
FlagShark parses your Python source files with the built-in `ast` module, tracing imports of `ldclient` and every downstream call to `variation()`, `variation_detail()`, and related methods. It resolves flag key strings across function arguments and module-level constants.
FlagShark understands Django-specific patterns including middleware classes, view decorators, and template context processors. It shows you the exact diff and flags any middleware changes for manual review when the flag influences request routing.
When flag keys are defined as string literals — even in dictionaries or YAML config files — FlagShark can match them. For truly dynamic keys built at runtime, it surfaces those as "unresolvable" so you can audit them manually.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
A hands-on guide to finding and safely removing stale LaunchDarkly feature flags from TypeScript and React codebases.
How to find, evaluate, and remove unused LaunchDarkly feature flags from Go microservices and CLI tools.
Practical guide to removing stale LaunchDarkly flags from Spring Boot and Micronaut applications.
Find and safely remove LaunchDarkly feature flags buried in Rails controllers, views, and background jobs.
Leverage Rust's type system and FlagShark's syn-based analysis to remove stale LaunchDarkly flags from Actix and Axum services.
Use Roslyn analyzers and FlagShark to find and remove stale LaunchDarkly flags in ASP.NET Core and .NET services.
Find and clean up stale Split.io feature flag treatments in Django, FastAPI, and Flask projects.
Identify and safely remove stale Unleash toggles from Django, FastAPI, and Flask Python applications.
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.