Skip to content

A Python library to chunk list based on number of items or number of chunks

License

Notifications You must be signed in to change notification settings

bhavaniravi/pychunk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyChunk

A Python library to chunk list based on number of items or number of chunks

Why?

Two Reasons!

  1. Python doesn't come with out of box chunking functionality for lists. Hence I thought of writing a library instead of referring stackoverflow everytime
  2. I always wanted to publish a library in pypi

Installation

pip install pychunk

Usage

from pychunk import chunk

chunk([1, 2, 3, 4, 5], num_chunks=2)
chunk([1, 2, 3, 4, 5], num_items=3)

Tech Used

  1. Peotry for package management
  2. Pytest for testing
  3. Mypy for static code checking

This is my first time using python types in my project

Ahaa moments!

  1. I'm deeply suprised by how Poetry makes it so simple to publish a library. I always got list in setuptools and disttools
  2. But, I don't think poetry supports pip install -e . equivalent command
  3. Looks like it's been added to Poetry 1.2. Need to figure out how it works.

About

A Python library to chunk list based on number of items or number of chunks

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages