Skip to main content

🤯 common-sense

Build Status Made with ❤️ Python Version

This library prevents you from doing stupid things (sometimes).

Installation

pip install common-sense

Quick Usage

from common_sense import *

# Dates
is_weekend(datetime.date.today())
days_until(datetime.date(2025, 12, 31))
pretty_date(datetime.date.today())
next_weekday('Monday')

# Debug
why_none(None)
why_empty([])
why_false(False)
explain_type(42)

# Philosophy
wisdom()
sarcastic('I love bugs')
shrug('It failed')
future_truth()
agree('Python is awesome')
disagree('Monday is the best')

# Life
should_sleep(datetime.time(23, 0))
should_eat(13)
caffeine_needed(0)
hydration_reminder()

# Strings
slugify('Hello World!')
humanize_number(1000)
camel_to_snake('CamelCase')
truncate('Hello world', 5)

# Numbers
safe_divide(10, 0)
percent(2, 8)
clamp(5, 1, 10)
is_prime(7)

# Utils
flatten([[1,2],[3,4]])
unique([1,2,2,3])
chunk([1,2,3,4,5], 2)
first([1,2,3])
last([1,2,3])

Why?

Because common sense is not so common. Now it is — in Python!


Fun Notes

  • 100+ witty helpers and one-liners.
  • "If it works, don’t touch it."
  • "Don’t argue with code — it always wins."
  • "This library prevents you from doing stupid things (sometimes)."

Testing

pytest

License

MIT

Metadata

Release files for common-sense 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for common-sense 0.1.0
File Size Uploaded
common_sense-0.1.0.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for common-sense 0.1.0
File Interpreter ABI Platform
common_sense-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.9 kB

Release files / common_sense-0.1.0.tar.gz

Download URL common_sense-0.1.0.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b73e4cf117d6dd14ec1963f54b736e52a55dd420525698f2ed20f99b9807402b
BLAKE2b-256 checksum
How to use checksums
2dc97598c44e3b8b29b8f36ddf27a86a4af1c08417ccf4fb92403c90e8183048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / common_sense-0.1.0-py3-none-any.whl

Download URL common_sense-0.1.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1af5e48f79f9e1882f7956db38ec804c05ab22ce50b5e1cc6ad9b0395be6e2c
BLAKE2b-256 checksum
How to use checksums
e17f1f75429a93550e940fcd852788dd0093a6bfec5e551271a5a7f453d9e270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page