Skip to main content

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

  1. Two Sum is looked up by slug. Created if new, otherwise reused.
  2. A new Solution row captures your code, language, complexities.
  3. A new Review row runs through SM-2 with your confidence rating.
  4. problem.next_review_at and problem.status are updated.
  5. 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.

Metadata

Release files for dsa-tracker 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dsa-tracker 0.8.0
File Size Uploaded Provenance Actions
dsa_tracker-0.8.0.tar.gz 35.6 kB Without provenance Details for dsa_tracker-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dsa-tracker 0.8.0
File Interpreter ABI Platform Actions
dsa_tracker-0.8.0-py3-none-any.whl Python 3 none any Details for dsa_tracker-0.8.0-py3-none-any.whl

Total release size: 44.7 kB

Release files / dsa_tracker-0.8.0.tar.gz

Download URL dsa_tracker-0.8.0.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
52a6293222aa44f3e59d6abea1d87396bbab6050f454539319b10e70da2210fa
BLAKE2b-256 checksum
How to use checksums
ac26ff35b4622b29231390bfceb2ed9e8d259fe7389c4ed71cd5410339ccf7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dsa_tracker-0.8.0-py3-none-any.whl

Download URL dsa_tracker-0.8.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d648237bc83c2a23585fae30df9a1606901c59b99df32b8998c06e2336ef4c88
BLAKE2b-256 checksum
How to use checksums
a7d0cdaa62a026ae2fe47b7055583c2dc6df8e6cb2b856a6d12603979506dcef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for dsa-tracker 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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