A Python package for learning data structures and algorithms.
Project description
DALPy
DALPy is a Python package for learning data structures and algorithms. It is based off of Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. This library was made specifically for administering and grading assignments related to data structures and algorithms in computer science.
With this library students can receive progress reports on their problem sets in real time as they complete assignments. Additionally, student submission assessment is done with unit tests, instead of hand-tracing, ensuring that the grades that students receive accurately reflect their submissions.
The DALPy testing suite offers extremely lightweight and flexible unit testing utilities that can be used on any kind of assignment, whether to write functions or build classes. Course administration can be easily streamlined by restricting which library data structures students are allowed to use on any particular assignment.
DALPy began as a project by two Brandeis University undergraduate students to replace hand-written problem sets written in pseudocode.
Provided Data Structures
The DALPy library offers a set of fundamental data structures and algorithms, with behavior as specified by Cormen et al.'s Introduction to Algorithms. The following structures (separated by module) are supported:
- arrays
- Array
- Array2D
- queues
- Queue
- stacks
- Stack
- sets
- Set
- linked_lists
- SinglyLinkedListNode
- DoublyLinkedListNode
- trees
- BinaryTreeNode
- NaryTreeNode
- depth(NaryTreeNode)
- hashing
- HashTable
- heaps
- PriorityQueue
- build_min_heap(Array)
- graphs
- Vertex
- Graph
Unit Testing
Along with the DALPy data structures come test utilities for writing test cases. The testing framework allows a course administrator to easily write test cases for either expected function output or general class behavior. Test cases can then be combined into a testing suite. The testing suite has the capability to set a test case run-time timeout and to record comma-separated test results for administrative use.
Consider the example test case below:
import unittest
from dalpy.factory_utils import make_stack
from dalpy.test_utils import build_and_run_watched_suite, generic_test
from student_submission import student_function
# TestCase class for testing student_function
class StudentFunctionTest(unittest.TestCase):
# A single test case
def simple_test_case(self):
stack = make_stack([1, 2, 3])
expected = make_stack([1, 1, 2, 2, 3, 3])
generic_test(stack, expected, student_function, in_place=True)
# Run the test cases using build_and_run_watched_suite with a timeout of 4 seconds
if __name__ == '__main__':
build_and_run_watched_suite([StudentFunctionTest], 4)
Installation
DALPy is available on PyPI, and can be installed with pip.
pip install dalpy
DALPy has the following dependencies:
Python >= 3.6
Issues
We encourage you to report issues using the GitHub tracker. We welcome all kinds of issues, especially those related to correctness, documentation and feature requests.
Academic Usage
If you are planning to use DALPy for a university course and have questions, feel free to reach out by email.
Documentation
The full documentation for DALPy is available here.
Sample Usage
To view sample assignments using DALPy browse the DALPy sample problems repository on GitHub.
Notes
This project was formerly known as Cormen-Lib.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file dalpy-1.0.2.tar.gz
.
File metadata
- Download URL: dalpy-1.0.2.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b0ec664ce174105d7a5f7223880085e0764366148f351c2a0bd46be6c56a59 |
|
MD5 | 6b16e5841118ada05ee5d0cc5d562953 |
|
BLAKE2b-256 | 607b28c3bb19f04604c80ff9bf2c5d0ae487d1567e04076ed297f8c954ebec08 |
Provenance
The following attestation bundles were made for dalpy-1.0.2.tar.gz
:
Publisher:
publish.yml
on DALPy-Developers/DALPy
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
dalpy-1.0.2.tar.gz
- Subject digest:
20b0ec664ce174105d7a5f7223880085e0764366148f351c2a0bd46be6c56a59
- Sigstore transparency entry: 157731163
- Sigstore integration time:
- Permalink:
DALPy-Developers/DALPy@8bedce310be23d2438a4ccbdac793d9649979a53
- Branch / Tag:
refs/tags/1.0.2
- Owner: https://github.com/DALPy-Developers
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
publish.yml@8bedce310be23d2438a4ccbdac793d9649979a53
- Trigger Event:
release
- Statement type:
File details
Details for the file dalpy-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: dalpy-1.0.2-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aaf9127881bcf5d0bbcb88646c900593f96cb2c5046c527b6be975c0cd0dc25 |
|
MD5 | 54d7b86fe532016353f947d1195b9b56 |
|
BLAKE2b-256 | c6d0910347f10d1d0f38b5ee2f053e3818f3a0438e73f0a1a28c8c7b1d052750 |
Provenance
The following attestation bundles were made for dalpy-1.0.2-py3-none-any.whl
:
Publisher:
publish.yml
on DALPy-Developers/DALPy
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
dalpy-1.0.2-py3-none-any.whl
- Subject digest:
5aaf9127881bcf5d0bbcb88646c900593f96cb2c5046c527b6be975c0cd0dc25
- Sigstore transparency entry: 157731164
- Sigstore integration time:
- Permalink:
DALPy-Developers/DALPy@8bedce310be23d2438a4ccbdac793d9649979a53
- Branch / Tag:
refs/tags/1.0.2
- Owner: https://github.com/DALPy-Developers
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
publish.yml@8bedce310be23d2438a4ccbdac793d9649979a53
- Trigger Event:
release
- Statement type: