Skip to content

andreafiori/python-data-structures-and-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Python data structures, algorithms, and design patterns

CI Python TDD

A Test‑Driven Development (TDD) playground for Python.

Implementations of classic data structures and algorithms in Python with unit tests, complexity analysis, and practical examples.

🗂 Project Structure

python-data-structures-and-algorithms
│
├── common/
├── data_structures/
├── algorithms/
│   ├── sorting/
│   ├── searching/
│   ├── graph/
│   └── dynamic_programming/
│
├── tests/
├── benchmarks/
└── pyproject.toml
└── README.md
└── requirements.txt
  • src/ contains production code
  • tests/ mirrors the same structure and contains all unit tests

🛠 Requirements

  • Python ≥ 3.x
  • pip

Recommended Tools


🚀 Getting Started

Create and activate a virtual environment (recommended):

python -m venv venv
source venv/bin/activate  # Linux / macOS
venv\Scripts\activate     # Windows

Install dependencies:

pip install -r requirements.txt

Update dependencies

python  -m pip install -r requirements.txt --upgrade

🧪 Running Tests

Run all tests:

pytest

Stop after the first failure:

pytest -x

Run a single test file:

pytest tests/algorithms/strings/test_stringutil.py

Run test from a venv:

.\.venv\Scripts\python.exe -m pytest

📊 Code Coverage

Run code coverage:

coverage run --source=src -m pytest
coverage report

Generate an HTML report:

coverage html

Using pytest-cov (recommended)

pytest-cov also reports files without tests:

pytest --cov=src tests/
pytest --cov=src tests/ --cov-report=html

Run tests and update coverage

pytest --cov=your_package --cov-report=term-missing --cov-report=html

🔍 Static Analysis (pylint)

Run pylint on source and tests (ignoring missing docstrings):

pylint src --disable=missing-docstring
pylint tests --disable=missing-docstring

📦 Managing Dependencies

Update requirements.txt:

pip freeze > requirements.txt

About

Implementations of classic data structures and algorithms in Python with unit tests, complexity analysis, and practical examples.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages