Skip to content

sekomer/structura

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structura

PyPI version

image

Structura is a Python library that provides data structures that are implemented in C for better performance. Its main purpose is to provide a simple and easy interface for data structures. The name comes from the Latin word structura which means structure.

Installation

Structura is available on PyPI and can be installed with pip. It requires Python 3.5 or above.

pip install structura

From Source

git clone github.com/sekomer/structura
cd structura
sudo python3 setup.py install

Documentation

Detailed documentation can be found in the docs folder.

General Information

Using Structura

Structura API follows the pythonic way of doing things. It has a simple and straightforward interface. Its works with any type of data and python objects. Heres a quick example of how to use it with RingBuffer data structure.

from structura import RingBuffer

buffer = RingBuffer(capacity=3)

buffer.enqueue(0) # [0]
buffer.enqueue(1) # [0, 1]
buffer.enqueue(2) # [0, 1, 2]
buffer.enqueue(3) # [1, 2, 3]

buffer.is_full() # True
buffer.peek()    # 1

a = buffer.dequeue() # [2, 3]
b = buffer.dequeue() # [3]
c = buffer.dequeue() # []
print(a, b, c)       # 1 2 3

for i in range(3):
    buffer.enqueue(i)

buffer.clear()    # []
buffer.is_empty() # True

Detailed documentation and examples can be found in the docs folder

What's New

  • 0.1.0
    • RingBuffer
  • 0.2.0
    • Stack
    • LinkedList
  • 0.2.1
    • Bug fixes
    • Documentation
  • 3.0.0
    • Queue
    • HashMap
    • PriorityQueue
    • Bug fixes
  • 3.0.1
    • Python version support added. (3.5 and above)

What's Coming

Trees, Ropes, Graphs, iterables.

Contributing

All contributions, suggestions, and optimization ideas are welcome!

Proposals for enhancement

You can create an issue or mail me at a.serkanaksoz@gmail.com