Skip to main content

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 your LEETCODE_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
  metadata.json          difficulty, topics, runtime/memory percentiles, ...
  notes.md                yours - never overwritten once created
README.md                 auto-generated dashboard: progress, streaks, full solutions table,
                          and clickable topic tags that jump to a per-topic problem list

Deduplicated by default within a 24h window — see --keep-all above to change that.

Honest limits

  • watch is 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

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

leetvault-0.3.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leetvault-0.3.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file leetvault-0.3.0.tar.gz.

File metadata

  • Download URL: leetvault-0.3.0.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for leetvault-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c2c8ecbee067231ee178ae63d90f537d98b77db8f479b758714a8e66530ab3fb
MD5 10454429f54d9a22d8c0a50ffaafde17
BLAKE2b-256 5c5d54f750542f779180c6a690592ff770cb0f63ef987fc17551349fa665a287

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetvault-0.3.0.tar.gz:

Publisher: publish.yml on priyadip/LeetVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leetvault-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: leetvault-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for leetvault-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b81822ea191f80bc8f4d466042a001d7e8414dad8507834298791a41e37058e
MD5 6028869f62a70cddb309a59dd6a73e49
BLAKE2b-256 4fb4b686960c73d1e3d7c0f2b81cfee89c9194ad49091b0e8c28ac0b84c0b4f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetvault-0.3.0-py3-none-any.whl:

Publisher: publish.yml on priyadip/LeetVault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.19.2

2 files

0.19.1

2 files

0.19.0

2 files

0.18.0

2 files

0.17.1

2 files

0.17.0

2 files

0.16.4

2 files

0.16.3

2 files

0.16.2

2 files

0.16.1

2 files

0.16.0

2 files

0.15.3

2 files

0.15.2

2 files

0.15.1

2 files

0.15.0

2 files

0.14.1

2 files

0.14.0

2 files

0.13.0

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page