https://github.com/gaurav-822/localdsa
A Python library for managing and solving coding problems locally. It fetches similar problems from your local database, adds helpful comments after `question.id` and `question.name`, and lets you quickly test and store solutions without using external APIs.
https://github.com/gaurav-822/localdsa
python sql sqlite3
Last synced: 11 months ago
JSON representation
A Python library for managing and solving coding problems locally. It fetches similar problems from your local database, adds helpful comments after `question.id` and `question.name`, and lets you quickly test and store solutions without using external APIs.
- Host: GitHub
- URL: https://github.com/gaurav-822/localdsa
- Owner: Gaurav-822
- Created: 2025-08-05T11:15:24.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-05T11:53:56.000Z (11 months ago)
- Last Synced: 2025-08-05T11:54:29.179Z (11 months ago)
- Topics: python, sql, sqlite3
- Language: Python
- Homepage: https://pypi.org/project/local-dsa/0.1.0/
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Local DSA
**local_dsa** is a Python package designed to streamline coding problem-solving.
It automatically fetches related problem suggestions from a local database,
inserts automated comments into your code, and allows you to run solution tests
easily just from a single .py file
---
## Features
- **Global `question` object**
Easily set and access:
```python
from local_dsa import question
question.name = "Sum of Two Numbers"
question.id = 1
```
- **Automatic problem suggestions**
Finds similar problems and inserts comments directly after your `question.name` line.
- **Problem statement injection**
Adds the problem statement after `question.id` line.
- **Solution testing & storage**
- `test_problem()` → runs test cases without storing code
- `solve_problem()` → runs test cases and stores your solution in the database.
---
## Installation
Install using pip:
```bash
pip install local-dsa
```
---
## Quick Start
### Example usage:
```python
from local_dsa import question, test_problem
# Set question details
question.name = "Sum of Two Numbers"
question.id = 1
class SumTwoNumbers:
def solve(self, a, b):
return a + b
# Test the solution
test_problem(question, SumTwoNumbers)
```
**Expected auto-comments in your file after saving & running:**
```python
question.name = "Sum of Two Numbers"
## Problem found here: [ID: 1] Sum of Two Numbers
question.id = 1
## Attempting problem: Sum of Two Numbers
## Given two integers, return their sum.
```
---
## Command Overview
- **`solve_problem(question, solver_class)`**
Runs test cases and stores the function code.
- **`test_problem(question, solver_class)`**
Runs test cases without storing.
---
## Project Structure
```
local_dsa/
├── __init__.py
├── question.py
├── main.py
├── check_solutions.py
├── code_storage.py
```
---
## Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.