leetvault
Mirror your LeetCode account (accepted submissions + source code + metadata) into a normalized SQLite database and a GitHub repository with an auto-generated README dashboard.
Sync is account-based, driven by your authenticated LeetCode session — not a browser extension. Your LeetCode account is the single source of truth. Free and open source; the only external services involved are LeetCode and GitHub.
Install
pip install leetvault
Requires Python 3.11+. See docs/DEVELOPER.md for an editable/dev install.
Quickstart
leetvault login # paste LEETCODE_SESSION + csrftoken
leetvault config repo_url https://github.com/you/repo.git # optional: enable GitHub push
leetvault import # one-time full history
leetvault sync # incremental, run anytime
leetvault watch # or: poll automatically
Commands
leetvault login [--leetcode|--github] [--force]— store yourLEETCODE_SESSION+csrftoken(and optionally a GitHub PAT) in the OS keyring. Only prompts for what's actually missing or expired — see below.leetvault import [--keep-all]— full history import of every accepted submission (resumable, one-time per site).leetvault sync [--keep-all]— incremental sync of new accepted submissions since the last run.leetvault watch— poll LeetCode and sync automatically (--interval, default 90s).leetvault status— show session validity/expiry and sync state.leetvault logout— remove stored credentials.leetvault config— get/set persistent configuration (repo URL, DB path, dedup window, ...).
Refreshing credentials
Your LeetCode session cookies expire roughly every 14 days; a GitHub PAT lasts until you revoke
it or it hits its own expiry. They fail independently, so login checks each one live and
only prompts for what actually needs replacing:
leetvault login # checks both, prompts only for what's expired/missing
leetvault login --leetcode # only refresh LeetCode cookies, never touch the stored PAT
leetvault login --github # only refresh the GitHub PAT, never re-ask for cookies
leetvault login --force # re-prompt for everything, even if still valid
If both are still good, login prompts for nothing and tells you so. leetvault status shows
the same live check without changing anything.
--keep-all
By default, import/sync keep only the newest accepted submission per problem within a
rolling 24-hour window (dedup_window_seconds in leetvault config, default 86400) — solving
the same problem twice in one sitting doesn't clutter history with near-duplicate attempts.
--keep-all disables that and stores every accepted submission individually:
leetvault sync --keep-all # one-off: keep everything from this run onward
leetvault import --keep-all # same, for the initial full-history import
To make this the permanent default instead of retyping the flag every time:
leetvault config dedup_window_seconds 0
--keep-all only changes how future submissions are processed — it can't retroactively
recover a submission an earlier (non---keep-all) run already deduped, since sync only walks
forward from the last submission it saw. See
docs/TROUBLESHOOTING.md
if you hit that.
What gets stored
A normalized SQLite database (problems, submissions, source code, topics, sync state) plus a disk layout per problem:
Problems/<slug>/
latest.<ext> the most recent accepted submission
history/submission_<id>.<ext> every kept accepted submission
question.md the problem statement, examples, constraints + collapsed hints
run.py runs your solution against the problem's example inputs
metadata.json difficulty, topics, runtime/memory percentiles, ...
notes.md yours - never overwritten once created
leetvault_runner.py shared runner that each run.py delegates to
.devcontainer/ so the repo opens ready-to-run in GitHub Codespaces
README.md auto-generated dashboard: progress, streaks, full solutions table,
and clickable topic tags that jump to a per-topic problem list
Running solutions in the browser
Open your solutions repo on GitHub and choose Code ▸ Codespaces ▸ Create codespace - you get full VS Code with a terminal, and the devcontainer means Python is already set up:
python Problems/two-sum/run.py
It prints your solution's output for each of LeetCode's example inputs. It intentionally does
not report pass/fail: the API exposes example inputs but not their expected outputs, so any
verdict would be guesswork - check the Output: lines in that problem's question.md.
Problems needing non-JSON inputs (linked lists, trees) or with no single entry point (design
problems) say so rather than running incorrectly.
question.md is fetched once per problem and never re-fetched, so it costs nothing on
subsequent syncs. Disable it entirely with leetvault config write_question_md false. Problem
statements remain the property of LeetCode; each file notes this.
Deduplicated by default within a 24h window — see --keep-all above to change
that.
Honest limits
watchis polling (default 90s, configurable), not a real-time push — LeetCode has no public webhook/streaming API.- LeetCode may Cloudflare-challenge automated HTTP clients; leetvault fails gracefully rather than faking success.
- Storing session cookies for automated access may be against LeetCode's Terms of Service. Use at your own risk, against your own account only.
- LeetCode has no official API — every endpoint leetvault uses is reverse-engineered and could change without notice.
Docs
- docs/ARCHITECTURE.md — data flow, module responsibilities, and every place live API behavior diverged from initial assumptions.
- docs/DEVELOPER.md — dev setup, project layout, running checks.
- docs/FAQ.md
- docs/TROUBLESHOOTING.md
- CONTRIBUTING.md
- CHANGELOG.md
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leetvault-0.7.0.tar.gz.
File metadata
- Download URL: leetvault-0.7.0.tar.gz
- Upload date:
- Size: 64.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec9734c895c27e29bd8e681b93cfbd6e4bb83d9fccbfe03dd4cc94122a1ac67d
|
|
| MD5 |
334a784dff0a9bb15163cd6f6f73a64f
|
|
| BLAKE2b-256 |
ff5faa51db679f6d0c17d0e482c2637e0366a3d21412784fcef8c27d2bfc4690
|
Provenance
The following attestation bundles were made for leetvault-0.7.0.tar.gz:
Publisher:
publish.yml on priyadip/LeetVault
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetvault-0.7.0.tar.gz -
Subject digest:
ec9734c895c27e29bd8e681b93cfbd6e4bb83d9fccbfe03dd4cc94122a1ac67d - Sigstore transparency entry: 2340908229
- Sigstore integration time:
-
Permalink:
priyadip/LeetVault@e0fc802f86a8eff5e6dd7c0f26c14ee33760b9ad -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/priyadip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0fc802f86a8eff5e6dd7c0f26c14ee33760b9ad -
Trigger Event:
push
-
Statement type:
File details
Details for the file leetvault-0.7.0-py3-none-any.whl.
File metadata
- Download URL: leetvault-0.7.0-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21b431cdd457104d3c64cbdf37bd83d4f95ea4e9144efecbd4ec60032df703ac
|
|
| MD5 |
f8119720de70bc9de24f62a80ef840cb
|
|
| BLAKE2b-256 |
7fc7b053846480c97bd14ce8db28e0cacabf181edcd4850426a67c61e1a2e61d
|
Provenance
The following attestation bundles were made for leetvault-0.7.0-py3-none-any.whl:
Publisher:
publish.yml on priyadip/LeetVault
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetvault-0.7.0-py3-none-any.whl -
Subject digest:
21b431cdd457104d3c64cbdf37bd83d4f95ea4e9144efecbd4ec60032df703ac - Sigstore transparency entry: 2340908243
- Sigstore integration time:
-
Permalink:
priyadip/LeetVault@e0fc802f86a8eff5e6dd7c0f26c14ee33760b9ad -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/priyadip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0fc802f86a8eff5e6dd7c0f26c14ee33760b9ad -
Trigger Event:
push
-
Statement type: