Lightweight utility functions for working with strings, lists, and tuples.
Project description
sequencekit
A lightweight, deterministic utility library for working with strings, lists, and tuples.
sequencekit provides clean and efficient helpers for common sequence
operations such as frequency analysis, duplicate detection, and
order-preserving transformations. It eliminates repetitive boilerplate
while maintaining predictable and explicit behavior.
What is this project?
sequencekit is a focused utility toolkit built to simplify everyday
sequence manipulation tasks in Python.
While Python offers powerful built-ins, operations like:
- Extracting elements that appear only once
- Finding duplicates
- Removing duplicates while preserving order
- Determining the most or least frequent element
often require verbose or repetitive patterns.
This library provides:
- Deterministic results
- O(n) implementations
- Explicit error handling
- Configurable output formats
- Clean, test-driven design
Features
- Frequency counting (
frequency) - Duplicate detection (
contains_duplicates) - Extract elements appearing exactly once (
uniqueonly) - Extract elements appearing more than once (
duplicates) - Remove duplicates while preserving order (
remove_duplicates) - Find most frequent element (
most_frequent) - Find least frequent element (
least_frequent) - Circular rotation (
rotate) - Configurable output format (
list,tuple,str) - Comprehensive test coverage
- No third-party dependencies
Installation
From PyPI
pip install sequencekit
PyPI page: https://pypi.org/project/sequencekit/
Development Installation
git clone https://github.com/IHac-er/sequencekit.git
cd sequencekit
pip install -e .
Usage
from sequencekit import (
frequency,
contains_duplicates,
uniqueonly,
duplicates,
most_frequent,
least_frequent,
remove_duplicates,
rotate,
)
# ---------------------------------------------------
# Frequency Analysis
# ---------------------------------------------------
frequency("banana")
# {'b': 1, 'a': 3, 'n': 2}
frequency(["a", "b", "c", "a"])
# {'a': 2, 'b': 1, 'c': 1}
frequency((1, 2, 2, 3))
# {1: 1, 2: 2, 3: 1}
# ---------------------------------------------------
# Duplicate Detection
# ---------------------------------------------------
contains_duplicates("banana")
# True
contains_duplicates("abc")
# False
contains_duplicates([1, 2, 3, 4])
# False
# ---------------------------------------------------
# Elements Appearing Exactly Once
# ---------------------------------------------------
uniqueonly("banana")
# ['b']
uniqueonly("banana", out="tuple")
# ('b',)
uniqueonly("banana", out="str")
# 'b'
# ---------------------------------------------------
# Elements Appearing More Than Once
# ---------------------------------------------------
duplicates("banana")
# ['a', 'n']
duplicates([1, 2, 2, 3, 3])
# [2, 3]
# ---------------------------------------------------
# Remove Duplicates (Preserve Order)
# ---------------------------------------------------
remove_duplicates("banana")
# ['b', 'a', 'n']
remove_duplicates("banana", out="str")
# 'ban'
remove_duplicates((1, 2, 1, 3))
# [1, 2, 3]
# ---------------------------------------------------
# Most / Least Frequent
# ---------------------------------------------------
most_frequent("banana")
# 'a'
most_frequent([1, 2, 3, 1, 1, 4])
# 1
least_frequent("banana")
# 'b'
least_frequent([1, 2, 3, 1, 1, 4, 4, 1, 4, 3])
# 2
# Tie-breaking is deterministic (first occurrence wins)
most_frequent("aabb")
# 'a'
least_frequent("aabbcc")
# 'a'
# ---------------------------------------------------
# Circular Rotate
# ---------------------------------------------------
rotate("abcd", 1)
# ['b', 'c', 'd', 'a']
rotate("abcd", 1, direction="right")
# ['d', 'a', 'b', 'c']
Output Format Control
Functions returning sequences support:
- "list" (default)
- "tuple"
- "str"
Example:
uniqueonly("banana", out="tuple")
# ('b',)
remove_duplicates("banana", out="str")
# 'ban'
Invalid output types raise ValueError.
Running Tests
pytest
All functionality and edge cases are covered by tests.
Project Structure
sequencekit/
├── sequencekit/
│ ├── __init__.py
│ ├── core.py
│ ├── _internals.py
├── tests/
│ └── test_core.py
├── pyproject.toml
└── README.md
License
Copyright 2026 THARUN R
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributions
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
Bug reports and suggestions are appreciated.
Version
Current version: 0.2.0
Author
Tharun R GitHub: https://github.com/IHac-er
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sequencekit-0.2.0.tar.gz.
File metadata
- Download URL: sequencekit-0.2.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37827a904497e9d37f10d2f95167a7d32338b0777cab3416f61f9f3f2dc4592e
|
|
| MD5 |
d4edc1adf96d9be6defccbdb7aea2621
|
|
| BLAKE2b-256 |
aaa337c776c5ae0c3c6b51a713dd846f69407c1507bb9f57edd159444b030994
|
File details
Details for the file sequencekit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sequencekit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5353a16f09406cb98ca126d01f6c09d316d3b6768c66629d3758c67b1f41c673
|
|
| MD5 |
2d4141b2e4d37cb37e746811d7294d79
|
|
| BLAKE2b-256 |
99b50dd22bc19d3d7d64c9dc2b2528c68088ddb50b398615627d35d703cd4899
|