Log DSA prep solves from a Colab/Jupyter notebook to your DSA Tracker instance.
Project description
dsa-tracker
Tiny Python client for DSA Tracker. Log a solve from a Colab/Jupyter notebook in one call — same SM-2 scheduling and GitHub auto-push you get from the web app.
Install
pip install dsa-tracker
Get an API key
In your DSA Tracker dashboard → Settings → API keys → Generate new key. The plaintext value is shown exactly once — copy it and treat it like a password. You can name keys per device/notebook so revoking one doesn't break the others.
Use it
from dsa_tracker import Tracker
tracker = Tracker(
api_url="https://your-dsa-tracker.com",
api_key="dsa_xxxxxxxxxxxxxxxxxxxxxx",
)
# Solve the problem like you always do
def two_sum(nums, target):
seen = {}
for i, n in enumerate(nums):
if target - n in seen:
return [seen[target - n], i]
seen[n] = i
# Log it without leaving the notebook
import inspect
result = tracker.log(
title="Two Sum",
confidence=4, # 1 (Forgot) → 5 (Easy)
code=inspect.getsource(two_sum),
language="python",
difficulty="easy",
topics=["Array", "HashMap"],
pattern="Hash Lookup",
time_complexity="O(n)",
space_complexity="O(n)",
playlist="leetcode-75", # optional: push to this playlist's GitHub config
)
print(f"→ next review: {result['next_review_at']} · status: {result['status']}")
if result.get('git_push_queued'):
print("→ pushed to GitHub via playlist 'leetcode-75'")
elif result.get('git_push_skip_reason'):
print(f"→ no GitHub push: {result['git_push_skip_reason']}")
What happens on the server
Two Sumis looked up by slug. Created if new, otherwise reused.- A new
Solutionrow captures your code, language, complexities. - A new
Reviewrow runs through SM-2 with your confidence rating. problem.next_review_atandproblem.statusare updated.- If you have GitHub auto-push enabled, the solution is committed to your repo in the background.
The return value tells you exactly what happened:
{
'problem_id': 42,
'solution_id': 87,
'review_id': 105,
'created': True, # False if you've logged this title before
'next_review_at': '2026-05-27',
'status': 'learning',
'reps': 1,
'interval_days': 1,
}
All parameters
| Required | Optional |
|---|---|
title, confidence |
code, language, difficulty, topics, pattern, platform, problem_url, approach, time_complexity, space_complexity, notes |
Defaults: language="python", difficulty="medium", approach="optimal". Anything you omit just isn't sent.
Errors
The client raises TrackerError on any non-2xx response with the server's reason attached:
from dsa_tracker import TrackerError
try:
tracker.log(title="X", confidence=4)
except TrackerError as e:
print(f"Couldn't log: {e}")
Common cases: 401 (bad/revoked API key), 422 (missing required field), connection timeout.
Context manager
For scripts that make many calls, use it as a context manager to clean up the underlying connection pool:
with Tracker(api_url=..., api_key=...) as tracker:
for problem in queue:
tracker.log(title=problem.name, confidence=problem.rating, code=problem.code)
License
MIT.
Project details
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 dsa_tracker-0.2.0.tar.gz.
File metadata
- Download URL: dsa_tracker-0.2.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e6658fe5074c4d4041d749cc4b9301fb648b8f762dc9ede23fe1b638f693f4
|
|
| MD5 |
dfc27a8b6b57cbb701b342e1815fae9d
|
|
| BLAKE2b-256 |
aee9083f8ff74cde5eb0480affc113405dc5fa30c4f11fcb63fc75052d5b716e
|
File details
Details for the file dsa_tracker-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dsa_tracker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a20c02814c19e70597ef14f1df35d97844cb2ffbf3861880a16ac919b640eeaa
|
|
| MD5 |
fa25c08e308219b612e284cbb4952a58
|
|
| BLAKE2b-256 |
ce3c095726c0c9ba83add2c6ef8e331a10a9f1f71277aff1917c93c6d6707e27
|