Skip to main content

A package for solving coding problems with automatic problem fetching and comments injection

Project description

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:
    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:

pip install local-dsa

Quick Start

Example usage:

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:

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.


License

This project is licensed under the MIT License - see the LICENSE file for details.

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

local_dsa-0.1.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

local_dsa-0.1.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file local_dsa-0.1.2.tar.gz.

File metadata

  • Download URL: local_dsa-0.1.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for local_dsa-0.1.2.tar.gz
Algorithm Hash digest
SHA256 43e6a2bbd3ee4004b85411bd1b0b350ec26a224f7d170dc1854f866840e62132
MD5 1fb86748284eacf16acf76abcbb9c035
BLAKE2b-256 fc245469f4c63d96ef353210bc47e1a98a9efb8ed4fbf4b840e0b8d9677b725b

See more details on using hashes here.

File details

Details for the file local_dsa-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: local_dsa-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for local_dsa-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2705db9bb28e1254ba71f1c08489ca926b50bde3a2cc71b3bd29e9a021e64cb
MD5 848e1f57e3e4a6c607448da550483bc0
BLAKE2b-256 d5109f22ab7723e192136152c2c610eb8f4b2050a35eddefcba813efb15cd064

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page