kisspy - Simple Python Scripting Helpers
This is a collection of simple helper methods and classes that I have found useful for data processing
Usage
The package offers simple methods that I found I was reusing frequently.
Converters
Numeric Converter
from kisspy import toNumeric, returnTxt,raiseValExc
def rtnMsg(*args):
return "Can't Convert '{}' To A Number".format(args[0])
alphaVal = "55"
numVal = toNumeric(alphaVal)
print(isinstance(numVal, int))
alphaVal = "88 ft"
numVal = toNumeric(alphaVal)
print(numVal)
numVal = toNumeric(alphaVal, onFail=returnTxt)
print(numVal)
numVal = toNumeric(alphaVal, onFail=rtnMsg)
print(numVal)
numVal = toNumeric(alphaVal, onFail=raiseValExc)
>> True
>> None
>> 88 ft
>> Can't Convert '88 ft' To A Number
>> Traceback (most recent call last):
>> File "C:\Files\code\python\projects\kisspy\examples\converters.py", line 26, in <module>
>> numVal = toNumeric(alphaVal, onFail=raiseValExc)
>> File "C:\Files\code\python\projects\kisspy\kisspy\converters\numericConverter.py", line 32, in toNumeric
>> return onFail(val,verr)
>> File "C:\Files\code\python\projects\kisspy\kisspy\converters\numericConverter.py", line 5, in raiseValExc
>> raise args[1]
>> File "C:\Files\code\python\projects\kisspy\kisspy\converters\numericConverter.py", line 27, in toNumeric
>> val = float(val)
>> ValueError: could not convert string to float: '88 ft'
>> The Value '88 ft' Could Not Be Converted To A Numeric Value
Spreadsheet Converters
from kisspy.converters.excelHelpers import fromExcelCol, toExcelCol
col = "C"
print(fromExcelCol(col))
col = "AF"
print(fromExcelCol(col))
num = 2
print(toExcelCol(num))
num = 33
print(toExcelCol(num))
>> 3
>> 32
>> B
>> AG
The elements in decorators and metaclasses modules speak for themselves.
There are a number of Python "extensions" that do stuff you would have wanted anyways:
Unique Appending To Lists:
from kisspy import appendUnique
vl = [2, 4, 6, 8]
if appendUnique(vl, 4):
print("Added 4 Again: {}".format(vl))
if appendUnique(vl, 10):
print("Added 10: {}".format(vl))
>> Added 10: [2, 4, 6, 8, 10]
Asserting One Record: Returns the one record, with options:
from kisspy import assertOne
from kisspy.exceptions import TooManyRecordsException, ZeroRecordsException
def thrwZeroRecordsEx(*args, **kwargs):
raise ZeroRecordsException()
vl = [2, 4, 6, 8]
print(assertOne([]))
print(assertOne([44]))
try:
oneValue = assertOne(vl)
except TooManyRecordsException as err:
print(err.toStrWithTyp())
try:
print(assertOne([], onZeroRcds=thrwZeroRecordsEx))
except ZeroRecordsException as err:
print(err.toStrWithTyp())
>> None
>> 44
>> TooManyRecordsException: 4 Records Returned, 1 Were Expected
>> ZeroRecordsException: Zero (0) Records Returned, > 0 Were Expected
Nested Dicts:
from kisspy import setValueOfPath, getValueOfPath
vd = {"animals": {"dog": {"whippet": "fast", "lab": "slower"}}}
wv = getValueOfPath(vd, keyPath="animals/dog/lab")
print(wv)
cv = getValueOfPath(vd, keyPath="animals/cat/tabby")
print(cv)
setValueOfPath(vd, "animals/dog/golden", "silly")
print(vd)
>> slower
>> None
>> {'animals': {'dog': {'whippet': 'fast', 'lab': 'slower', 'golden': 'silly'}}}
Installation
Using In Projects
Installation:
pip install kisspy-python
Cloning For Development
Set up a virtual environment. Once an environment is set up, run the command below to:
- validate the environment variable
- activate the environment (if not already activated)
- install all of the necessary packages into the local environment
pip install -U -r requirements/dev.txt
The dev.txt file includes:
- BLACK, a code formatter, see notes at the bottom of this file for details
Dependancies
This library depends on the following projects:
- unidecode
Tests
To run tests:
python -m unittest discover -s tests/
Code Formatting
Code formatting is done using BLACK. BLACK allows almost no customization to how code is formatted with the exception of line length, which has been set to 119 characters.
Use the following to bulk format files:
black . -l 144
Creating A New Release
Please do the following when making a new release, most are documented above:
- Run tests
- Code format
- Be sure to update the change log and _metadata.json with version and notes
- git add, commit, and push changes
- run the following code to generate a wheel:
python -m build
Metadata
Release files for kisspy-python 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kisspy_python-1.3.0.tar.gz | 16.9 kB | With provenance | Details for kisspy_python-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kisspy_python-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for kisspy_python-1.3.0-py3-none-any.whl |
Total release size: 36.3 kB
Release files / kisspy_python-1.3.0.tar.gz
| Download URL | kisspy_python-1.3.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa7a0bfd85498f79f273ea336fd0d819c4d20275137fd889ccc8f8e757ac2b06
|
|
BLAKE2b-256 checksum How to use checksums |
0b0156ace503ae3104e84d3623cdaa6673d00308dfdb44a475490d11f0f89291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.
Transparency logRelease files / kisspy_python-1.3.0-py3-none-any.whl
| Download URL | kisspy_python-1.3.0-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
badd03ec65bc6743439da2a45d58659e5237eea85dc3fadac5589e7d98bcc525
|
|
BLAKE2b-256 checksum How to use checksums |
8c6aa0197da571df74ac912b09cd92cdbfed0f36815ce62b83300b56477fa51e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.
Transparency logSecurity for kisspy-python 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kisspy_python-1.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.