✨ Textcraft
🧵 A lightweight Python module for text transformation, cleaning, and basic analysis —
beginner-friendly and open source.
📖 Overview
Textcraft is a simple Python library that provides common text manipulation functions. It's designed to be easy to use and understand, making it perfect for beginners and for quick text processing tasks.
📦 Installation
Install Textcraft using pip:
pip install textcraft-py
Or clone the repository:
git clone https://github.com/O-sama12/textcraft
then import the module directly:
import textcraft
🚀 Getting Started
Basic Usage
import textcraft as txt
# Example text to work with
text = "Hello World! This is a TextCraft example."
# Text Case & Format Conversion
print(txt.to_lowercase(text)) # hello world! this is a textcraft example.
print(txt.to_uppercase(text)) # HELLO WORLD! THIS IS A TEXTCRAFT EXAMPLE.
print(txt.to_snake_case(text)) # hello_world!_this_is_a_textcraft_example.
print(txt.to_kebab_case(text)) # hello-world!-this-is-a-textcraft-example.
print(txt.to_camel_case(text)) # helloWorld!ThisIsATextcraftExample.
# Text Cleaning
print(txt.remove_punctuation(text)) # Hello World This is a TextCraft example
print(txt.normalize_spaces(text)) # Hello World! This is a TextCraft example.
# Text Statistics
print(txt.word_count(text)) # 8
print(txt.char_count(text)) # 43 (without spaces: 35)
print(txt.sentence_count(text)) # 1
print(txt.slugify(text)) # hello-world-this-is-a-textcraft-example
🚀 Features
🔤 Text Case & Format Conversion
- 🔡
to_lowercase(text)- Convert text to lowercase - 🐫
to_uppercase(text)- Convert text to uppercase - 🐍
to_snake_case(text)- Transform text intosnake_case - 🔗
to_kebab_case(text)- Convert text intokebab-case - 🐪
to_camel_case(text)- Convert text intocamelCase
🧹 Text Cleaning Utilities
- 🧽
remove_punctuation(text)- Remove all punctuation characters from text - 📐
normalize_spaces(text)- Normalize multiple spaces into a single space - 🌐
slugify(text)- Generate URL-friendly slugs
📊 Basic Text Statistics
- 🧮
word_count(text)- Count number of words in text - 🔢
char_count(text, include_spaces=True/False)- Count characters (with or without spaces) - 📑
sentence_count(text)- Count number of sentences
🧪 Common Use Cases
1. Preparing text for processing
raw_text = " This text has extra spaces. "
clean_text = txt.normalize_spaces(raw_text) # "This text has extra spaces."
2. Creating URL-friendly strings
title = "My Blog Post: An Introduction!"
slug = txt.slugify(title) # "my-blog-post-an-introduction"
3. Formatting text for different contexts
function_name = "my function name"
snake_case = txt.to_snake_case(function_name) # "my_function_name"
kebab_case = txt.to_kebab_case(function_name) # "my-function-name"
📝 Examples with Input → Output
| Function | Input | Output |
|---|---|---|
to_lowercase() |
"Hello World!" |
"hello world!" |
to_uppercase() |
"Hello World!" |
"HELLO WORLD!" |
to_snake_case() |
"Hello World" |
"hello_world" |
to_camel_case() |
"hello world" |
"helloWorld" |
remove_punctuation() |
"Hello, World!" |
"Hello World" |
word_count() |
"Hello World" |
2 |
slugify() |
"Hello, World!" |
"hello-world" |
to_title_case() |
"Hello, World!" |
⚠️ Edge Cases & Notes
- Empty strings will return empty strings for most functions
to_camel_case()handles various separators and converts them appropriatelysentence_count()recognizes.,!, and?as sentence terminatorschar_count()can optionally include or exclude spacesslugify()removes punctuation and replaces spaces with hyphens
🤝 Contributing
This project is beginner-friendly and welcomes:
- 🐞 Bug reports
- 💡 Feature suggestions
- 🔧 Pull requests
Before contributing, please take a moment to read the CONTRIBUTING.md file.
📄 License
This project is licensed under the
MIT License.
Metadata
Release files for textcraft-py 0.1.4
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 |
|---|---|---|---|---|
| textcraft_py-0.1.4.tar.gz | 6.0 kB | Without provenance | Details for textcraft_py-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textcraft_py-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for textcraft_py-0.1.4-py3-none-any.whl |
Total release size: 11.5 kB
Release files / textcraft_py-0.1.4.tar.gz
| Download URL | textcraft_py-0.1.4.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4ff447b7e188cefb890dbcc048f515aadc6ae7cfc0b17ad829cf3b1a95387fd
|
|
BLAKE2b-256 checksum How to use checksums |
fd6c8f304b0a9492fcb01b020907e7ca394148f5a6c1fc71ca4764b7b186fb1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / textcraft_py-0.1.4-py3-none-any.whl
| Download URL | textcraft_py-0.1.4-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
549d15880faca48eca4f09bf12601956f7194528ad32404ad12d3cdceda8e2a3
|
|
BLAKE2b-256 checksum How to use checksums |
a94a7351425bef6e654b27e3ccbd9994084c02960dea151fa9532a8e1fc9ba69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for textcraft-py 0.1.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.