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 https://static.pepy.tech/personalized-badge/structura?period=total&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads

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.

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

Detailed documentation can be found in the docs folder.

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

  • 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)

Trees, Ropes, Graphs, iterables.

All contributions, suggestions, and optimization ideas are welcome!

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