Making Your pythonds9 Package

At this point you should have a new Github git repository named pythonds9, and cloned it to your computer. These instructions are biased toward UNIX-like operating systems, e.g. Mac and Linux. Windows systems tend to be different, though enterprising individual can find out how to make this tutorial work for them. In short, if you have access to a usable text editor (such as IDLE), some way to see your files (Mac Finder, or Windows Explorer), and installed a graphical application like Github Desktop you might be able to avoid most of the use of the terminal (though, not all!)

Create a package hierarchy:

pythonds9/
    README.md
    setup.py
    pythonds9/
        __init__.py
        basic/
            __init__.py
            stack.py
            queue.py
            deque.py
        graphs/
            __init__.py
            graph.py
            priority_queue.py
            vertex.py
        trees/
            __init__.py
            balance.py
            binary_tree.py
            bin_heap.py
            bst.py
        recursion/
            __init__.py
        search/
            __init__.py
        sort/
            __init__.py

The setup.py file

Used for installation through Python’s package manager, pip, this file describes the package which you are installing, include perquisite packages, and other details. This is particularly useful if you make your package available for public download through the Python Package Index (PyPi) (an entirely optional choice for your future projects).

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="pythonds9",
    version="0.0.0",
    author="Joe John Smith",
    author_email="joe@example.org",
    description="Data Structures package for Problem Solving with Algorithms and Data Structures using Python",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/YOUR_GITHUB_USERNAME/pythonds9",
    packages=setuptools.find_packages(),
    classifiers=(
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
        "Operating System :: OS Independent",
    ),
)

Contents of the Package

This is left up to you to do on your own. Simply, you are incorporating the code from the textbook for a particular data structure (e.g. the Stack class), or algorithm (which is often a minimalist implementation) and writing it into correct file in your package. You can use my lecture notes as we go along in the course.