Skip to content

py-simple-wrap πŸš€

All Contributors

Making Python feel like plain English.

PyPI Docs License: MIT GitHub stars

py-simple-wrap is a beginner-friendly Python wrapper package designed to help beginners and developers perform common tasks using simple, intuitive functions.

The goal of this project is to remove the need for memorizing complex syntax or writing repetitive boilerplate code, making Python more accessible and enjoyable for everyone.

You'll love py-simple-wrap if:

Typing SVG

Before and After

😰 The traditional way

import requests
from bs4 import BeautifulSoup

try:
    response = requests.get('https://github.com', timeout=10)
    response.raise_for_status()
    page = BeautifulSoup(response.content, 'html.parser')
    title = page.title.string
except Exception as e:
    print("The site is down or address is invalid.")

😎 The py-simple-wrap way

from py_simple import get_page_title

print(get_page_title("https://github.com"))

πŸ› οΈ Installation

pip install py-simple-wrap
from py_simple import make_blank_file, miles_to_km, is_valid_email

make_blank_file("notes.txt")
print(miles_to_km(26.2))                    # 42.16...
print(is_valid_email("hello@example.com"))  # True

Full walkthrough in QUICKSTART.md, or browse the full documentation site.

⭐ If py-simple-wrap made something easier for you

Consider giving it a star β€” it helps other beginners find it, and it genuinely makes my day. And if there's a function you wish existed, fork it and add it; this project grew because other people did exactly that. Every module below started here, except easy_strings, which came from a contributor.


πŸ› οΈ Module Menu

py-simple-wrap provides simple modules designed to make common Python tasks easier.

πŸ“‚ Easy File Manager

Click to expand β€” file operations without the os boilerplate
| Function | What it does | |--------------------------------------|-------------------------------------| | `make_blank_file("notes", "txt")` | Create an empty file | | `is_file_there("notes.txt")` | Check if a file exists | | `add_a_line("notes.txt", "hello!")` | Append a line to a file | | `read_file_to_list("notes.txt")` | Read lines into a list | | `remove_file("notes.txt")` | Delete a file | | `rename_file("old.txt", "new.txt")` | Rename a file | | `copy_file("src.txt", "dst.txt")` | Copy a file | | `list_files()` / `list_files("txt")` | List files, optionally by extension |

πŸ•°οΈ Easy Date Formatter

Click to expand β€” readable dates without memorizing strftime codes
**Get the current date in any format:** | Function | Example output | |----------------------|-------------------------| | `get_pretty_date()` | `Friday, July 31, 2026` | | `dd_mm_yyyy()` | `31-07-2026` | | `mm_dd_yyyy()` | `07-31-2026` | | `slash_dd_mm_yyyy()` | `31/07/2026` | | `slash_mm_dd_yyyy()` | `07/31/2026` | **Need past or future dates?** Add `past_` or `future_` to any function above and pass the number of days: | Pattern | Example | |-----------------------|--------------------------------------------| | `past_(7)` | `past_pretty_date(7)` β†’ one week ago | | `future_(30)` | `future_dd_mm_yyyy(30)` β†’ 30 days from now | **Also available:** `list_available_formats()` to see all supported format names.

πŸ”’ Easy Numbers

Click to expand β€” number checks and calculations without the mental math
| Function | What it does | Example | |---------------------------------|------------------------------------------|-----------------------------------------| | `is_even(n)` | Check if a number is even | `is_even(90)` β†’ `True` | | `is_odd(n)` | Check if a number is odd | `is_odd(67)` β†’ `True` | | `is_positive(n)` | Check if a number is positive | `is_positive(90)` β†’ `True` | | `is_negative(n)` | Check if a number is negative | `is_negative(-10)` β†’ `True` | | `is_prime(n)` | Check if a number is prime | `is_prime(2)` β†’ `True` | | `is_evenly_divisible(n, d)` | Check if `n` divides evenly by `d` | `is_evenly_divisible(90, 9)` β†’ `True` | | `average(nums)` | Average of a list, rounded to 2 decimals | `average([1.5, 2, 3])` β†’ `2.17` | | `percentage_of(n, p)` | Get a percentage of a number | `percentage_of(100, 0.5)` β†’ `50.0` | | `round_to_nearest(n, m)` | Round to the nearest multiple | `round_to_nearest(23, 5)` β†’ `25.0` | | `greatest_common_divisor(a, b)` | Find the GCD of two numbers | `greatest_common_divisor(12, 18)` β†’ `6` | | `clamp(n, min, max)` | Keep a number within a range | `clamp(15, 0, 10)` β†’ `10` |

πŸ“‹ Easy Lists

Click to expand β€” list helpers that keep your code short and readable
| Function | What it does | Example | |-----------------------------------|------------------------------------------|------------------------------------------------------------| | `unique_items(items)` | Remove duplicates, keeping order | `unique_items([1, 2, 2, 3])` β†’ `[1, 2, 3]` | | `find_duplicates(items)` | Find items that appear more than once | `find_duplicates([1, 2, 2, 3, 3, 3])` β†’ `[2, 3]` | | `chunk_list(items, size)` | Split a list into smaller lists | `chunk_list([1, 2, 3, 4, 5], 2)` β†’ `[[1, 2], [3, 4], [5]]` | | `flatten_list(items)` | Flatten nested lists one level deep | `flatten_list([[1, 2], [3]])` β†’ `[1, 2, 3]` | | `most_common_item(items)` | Find the most frequent item | `most_common_item([1, 1, 2])` β†’ `1` | | `rotate_list(items, steps)` | Rotate items to the right | `rotate_list([1, 2, 3], 1)` β†’ `[3, 1, 2]` | | `merge_lists(list_a, list_b)` | Combine two lists | `merge_lists([1, 2], [3, 4])` β†’ `[1, 2, 3, 4]` | | `alternate_lists(list_a, list_b)` | Combine lists by taking turns | `alternate_lists([1, 2], [3, 4])` β†’ `[1, 3, 2, 4]` | | `sum_all(items)` | Add up numbers, even in nested lists | `sum_all([1, [2, 3], 4])` β†’ `10` | | `sort_numbers(items)` | Sort numbers smallest to largest | `sort_numbers([3, 1, 2])` β†’ `[1, 2, 3]` | | `sort_words(items)` | Sort words alphabetically, ignoring case | `sort_words(["banana", "Apple"])` β†’ `["Apple", "banana"]` |

πŸ”€ Easy Strings

Click to expand β€” string operations that read like English
| Function | What it does | Example | |-----------------------------|--------------------------------------------|--------------------------------------------------------------| | `remove_extra_spaces(text)` | Strip leading, trailing, and double spaces | `remove_extra_spaces(" hello world ")` β†’ `"hello world"` | | `to_snake_case(text)` | Convert to snake_case | `to_snake_case("Hello World")` β†’ `"hello_world"` | | `to_kebab_case(text)` | Convert to kebab-case | `to_kebab_case("Hello World")` β†’ `"hello-world"` | | `is_palindrome(text)` | Check if text reads the same backwards | `is_palindrome("Never odd or even")` β†’ `True` | | `is_alphanumeric(text)` | Check if text is letters and numbers only | `is_alphanumeric("Something123")` β†’ `True` | | `count_words(text)` | Count the number of words | `count_words("Hello world! How are you?")` β†’ `5` |

βœ‚οΈ Easy Text

Click to expand β€” text formatting helpers that read like English
|------------------------------|---------------------------------------------|---------------------------------------------------------------| | Function | What it does | Example | | `truncate(text, length)` | Shorten text and add an ellipsis | `truncate("Hello world!", 5)` β†’ `"Hello…"` | | `remove_punctuation(text)` | Strip punctuation, keep letters and numbers | `remove_punctuation("Hello, world!")` β†’ `"Hello world"` | | `reverse_words(text)` | Reverse the order of words | `reverse_words("Hello world")` β†’ `"world Hello"` | | `capitalize_title(text)` | Capitalize the first letter of each word | `capitalize_title("the great gatsby")` β†’ `"The Great Gatsby"` | | `count_letters(text)` | Count the number of letters | `count_letters("Hello 123!")` β†’ `5` | | `count_digits(text)` | Count the number of digits | `count_digits("Hello 123!")` β†’ `3` | | `mask_part(text, visible=4)` | Hide part of text behind asterisks | `mask_part("1234567890", 4)` β†’ `"1234 ******"` | | `pluralize(word, count)` | Get the singular or plural form | `pluralize("cat", 3)` β†’ `"cats"` | | `extract_hashtags(text)` | Extract hashtags without the # symbol | `extract_hashtags("#python rocks")` β†’ `["python"]` | | `word_frequency(text)` | Count how often each word appears | `word_frequency("the cat and the dog")` β†’ `{"the": 2, ...}` |

πŸ”„ Easy Converter

Click to expand β€” unit conversions without memorizing formulas
**Time** | Function | Example | |--------------------------------|--------------| | `seconds_to_hh_mm_ss(3665)` | `"01:01:05"` | | `hh_mm_ss_to_seconds(1, 1, 1)` | `3661` | **Distance & Length** | Function | Example | |--------------------------|----------| | `km_to_mile(100)` | `62.13` | | `miles_to_km(100)` | `160.93` | | `meters_to_feet(100)` | `328.08` | | `feet_to_meters(328.08)` | `100.0` | | `cm_to_inches(100)` | `39.37` | | `inches_to_cm(39.37)` | `100.0` | **Weight** | Function | Example | |--------------------|---------| | `kg_to_lb(5)` | `11.02` | | `lb_to_kg(110.23)` | `50.0` | **Temperature** | Function | Example | |------------------------------|---------| | `celsius_to_fahrenheit(25)` | `77.0` | | `fahrenheit_to_celsius(104)` | `40.0` | **Volume** | Function | Example | |------------------------------------|---------| | `fluid_oz_to_ml(1, standard='us')` | `29.6` | | `fluid_oz_to_ml(1, standard='uk')` | `28.4` | | `ml_to_fluid_oz(1, standard='us')` | `0.03` | | `ml_to_fluid_oz(1, standard='uk')` | `0.04` | **Area** | Function | Example | |--------------------------------|----------| | `sq_meters_to_sq_feet(10)` | `107.64` | | `sq_feet_to_sq_meters(107.64)` | `10.0` | **Speed** | Function | Example | |------------------------|---------| | `mph_to_kph(0.621371)` | `1.0` | | `kph_to_mph(1.60934)` | `1.0` |

βœ… Easy Validator

Click to expand β€” input validation without regex memorization
| Function | What it checks | Example | |---------------------------|-----------------------------------------------------|----------------------------------------------| | `is_valid_email(str)` | Valid email format | `is_valid_email("hello@world.com")` β†’ `True` | | `is_valid_username(str)` | Letters, numbers, and underscores only | `is_valid_username("user_name")` β†’ `True` | | `is_valid_url(str)` | URLs with http, https, or www | `is_valid_url("www.google.com")` β†’ `True` | | `is_valid_zipcode(int)` | 5-digit US zip code | `is_valid_zipcode(12345)` β†’ `True` | | `is_password_secure(str)` | 8+ chars, upper, lower, digits, special, no repeats | `is_password_secure("1andkrf!AG5")` β†’ `True` |

🌐 Easy Web

Click to expand β€” web scraping and checks without the requests/BS4 boilerplate
| Function | What it does | Example | |-----------------------------|--------------------------------------------------|-----------------------------------------------------------| | `is_page_up(url)` | Check if a site returns 200 | `is_page_up("https://github.com")` β†’ `True` | | `get_page_title(url)` | Get the page title | `get_page_title("https://github.com")` β†’ `"GitHub Β· ..."` | | `get_page_content(url)` | Get prettified HTML | `get_page_content("https://google.com")` | | `count_links(url)` | Count links on a page | `count_links("https://github.com")` β†’ `144` | | `get_link_list(url)` | Get all links as a list | `get_link_list("https://github.com")` β†’ `[...]` | | `count_tags(url, tag)` | Count tags of a given type (e.g. `'a'`, `'img'`) | `count_tags("https://github.com", "img")` β†’ `12` | | `get_tag_list(url, tag)` | Get useful info from each matching tag | `get_tag_list("https://github.com", "img")` β†’ `[...]` | | `print_allowed_tags()` | Print the supported tag β†’ attribute map | `print_allowed_tags()` β†’ `{'a': 'href', 'img': 'src'}` | | `get_meta_description(url)` | Get all meta tag contents | `get_meta_description("https://github.com")` β†’ `[...]` | | `get_all_headers(url)` | Get text from all `
` tags | `get_all_headers("https://github.com")` β†’ `[...]` |

🎨 Easy Colors

Click to expand β€” hex and RGB conversions without the manual math
| Function | What it does | Example | |-----------------------|----------------------------------------|---------------------------------------------| | `is_valid_hex(str)` | Check if a string is a valid hex color | `is_valid_hex("#FFFFFF")` β†’ `True` | | `hex_to_rgb(str)` | Convert hex to (R, G, B) tuple | `hex_to_rgb("#FFFFFF")` β†’ `(255, 255, 255)` | | `rgb_to_hex(r, g, b)` | Convert RGB to hex string | `rgb_to_hex(255, 255, 255)` β†’ `"#FFFFFF"` |

πŸ”„ Easy Flow

Click to expand β€” run Python files and time function calls without the boilerplate
| Function | What it does | Example | |-------------------------------------------|---------------------------------------------------------------|------------------------------------------------| | `run_py_file(filename)` | Run a .py file as `__main__` | `run_py_file("script.py")` | | `time_function_call(function, args=None)` | Runs a function once and returns how long it took, in seconds | `time_function_call(add, [2, 3])` β†’ `0.000002` |

πŸ“„ Easy JSON

Click to expand β€” JSON file handling without the boilerplate
| Function | What it does | Example | |------------------------------|----------------------------------------------|---------------------------------------------------------------------| | `open_json(path)` | Read a JSON file into a dict | `open_json("config.json")` | | `save_json_data(path, dict)` | Save a dict to a new JSON file | `save_json_data("config.json", {"name": "Sara"})` | | `update_json(path, dict)` | Merge new data into an existing JSON file | `update_json("config.json", {"name": "Sara"})` | | `pretty_json(data=dict)` | Pretty-print a dict as indented JSON | `pretty_json(data={"name": "Sara"})` | | `pretty_json(filepath=path)` | Pretty-print a JSON file's contents | `pretty_json(filepath="config.json")` | | `is_json_file(path)` | Check if a file exists and is .json | `is_json_file("config.json")` β†’ `True` | | `is_nested_json(data=dict)` | Check if a dict has any nested dicts/lists | `is_nested_json(data={"a": 1, "b": {"c": 2}})` β†’ `True` | | `flatten_json(data=dict)` | Flatten a nested dict into single-level keys | `flatten_json(data={"a": 1, "b": {"c": 2}})` β†’ `{"a": 1, "b-c": 2}` |

πŸ” Easy Regex

Click to expand β€” pull common patterns out of text without writing regex
| Function | What it does | Example | |----------------------------------|--------------------------------------------------------------------------------|------------------------------------------------------------------------------------| | `extract_emails(text)` | Find all email addresses in text | `extract_emails("Contact hello@example.com")` β†’ `['hello@example.com']` | | `extract_urls(text)` | Find all URLs in text | `extract_urls("Visit www.example.com")` β†’ `['www.example.com']` | | `extract_number_sequences(text)` | Find number sequences joined by `-`, `_`, `:`, or `.` (dates, times, IPs, IDs) | `extract_number_sequences("IP 192.168.1.1 at 14:32")` β†’ `['192.168.1.1', '14:32']` | | `extract_numbers(text)` | Find all standalone digit sequences | `extract_numbers("I have 3 cats and 12 fish")` β†’ `['3', '12']` |

⚑ Easy Async

Click to expand β€” run multiple functions at the same time without touching ThreadPoolExecutor directly
| Function | What it does | Example | |--------------------------------------------------------|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------| | `run_at_the_same_time_no_params(functions)` | Runs multiple functions at the same time | `run_at_the_same_time_no_params([add, sub])` β†’ `[('add', 2), ('sub', 2)]` | | `run_at_the_same_time_with_params(functions_and_args)` | Runs multiple functions at the same time, each with its own arguments | `run_at_the_same_time_with_params([(add, 1, 1), (sub, 4, 2)])` β†’ `[('add', 2), ('sub', 2)]` |

🀝 Contributing

I would love to have your help in making Python simpler for everyone!

Contributions of all sizes are welcome:

  • Fix documentation
  • Improve existing modules
  • Suggest new features
  • Add new functionality
  • Improve examples

Please check CONTRIBUTING.md before submitting changes.

Every contribution helps make py-simple-wrap better for beginners and developers.


🀝 Contributors

A huge thank you to these wonderful people for helping make Python simpler for everyone!

Emoji Key:

  • πŸ’» = Code
  • πŸ“– = Docs
  • πŸ› = Bug Reports
  • πŸ§ͺ = Tests
  • πŸš‡ = Infrastructure
  • πŸ›‘οΈ = Maintainer
  • πŸ‘‘ = Original Author
  • πŸš€ = Project Management
  • βœ‹ = Collaborators
Sara Czasak
Sara Czasak

πŸ›‘οΈ πŸš€ πŸ’» πŸ“– πŸ‘‘ βœ‹
jagjitkaur0000
jagjitkaur0000

πŸ§ͺ βœ‹
atiqur rahman
atiqur rahman

πŸ§ͺ βœ‹
Gaohar Imran
Gaohar Imran

πŸ§ͺ πŸ’» βœ‹
Yassin Azzouzi
Yassin Azzouzi

πŸ“– βœ‹
ghostfix-pm
ghostfix-pm

πŸš‡ πŸ§ͺ πŸ’» πŸ“–
Pranjal Solanki
Pranjal Solanki

πŸ’»
Shivam Singh
Shivam Singh

πŸ“– πŸ§ͺ πŸ’»
Challa Leela Prasad
Challa Leela Prasad

πŸ’»
HeaTTap
HeaTTap

πŸ“– πŸ§ͺ πŸ’»
Avery Quinn
Avery Quinn

πŸ§ͺ
Marcos Max
Marcos Max

πŸ“–
Matheus
Matheus

πŸ§ͺ
Mlandvo Maphalala
Mlandvo Maphalala

πŸ§ͺ πŸ›
qotique
qotique

πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!


βš–οΈ License

This project is licensed under the MIT License.

You are free to use, modify, and distribute it.

See the LICENSE.md file for the full legal text.