A simple Python package for randomizing letters in strings
Project description
String Randomizer
A simple Python package for randomizing letters in strings.
Installation
You can install the package using pip:
pip install -e .
For development with testing tools:
pip install -e ".[dev]"
Usage
The package provides two main functions:
randomize_string
Randomizes all characters in a string:
from string_randomizer import randomize_string
# Basic usage
result = randomize_string("hello world")
print(result) # Example output: "owllorhd le"
# With seed for reproducible results
result = randomize_string("hello", seed=42)
print(result) # Always produces the same output with seed=42
randomize_words
Randomizes letters within each word while preserving word boundaries:
from string_randomizer import randomize_words
# Basic usage
result = randomize_words("hello world")
print(result) # Example output: "olehl dlrow"
# With seed for reproducible results
result = randomize_words("hello world", seed=42)
print(result) # Always produces the same output with seed=42
Running Tests
To run the tests, first install the package with dev dependencies:
pip install -e ".[dev]"
pytest
To run tests with coverage:
pytest --cov=string_randomizer --cov-report=html
Building and Publishing
To build the package:
pip install build
python -m build
This will create distribution files in the dist/ directory.
To publish to PyPI (requires PyPI account and credentials):
pip install twine
twine upload dist/*
Project Structure
npi-dsw-example-eactions/
├── string_randomizer/ # Main package directory
│ ├── __init__.py # Package initialization
│ └── randomizer.py # Core functionality
├── tests/ # Test directory
│ ├── __init__.py
│ └── test_randomizer.py # Test cases
├── pyproject.toml # Modern Python project configuration
├── setup.py # Setup script for backward compatibility
├── MANIFEST.in # Package manifest for distribution
├── README.md # This file
└── LICENSE # License file
License
See LICENSE file for details.
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 string_randomizer-0.1.0.tar.gz.
File metadata
- Download URL: string_randomizer-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5224a66cc523908a2077664a1f4c0cac54185b80f53d25f54b287eaec5bc0c1
|
|
| MD5 |
489ff26664f72e6bf7566e71f08171f9
|
|
| BLAKE2b-256 |
65578e1d6d33c56c85e66836e68499615540f124fe4f7fec61574f174a602cd8
|
File details
Details for the file string_randomizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: string_randomizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3b9b4e445f3f09f9280d9796259d3fe93af65cc0906c7198ae14230f8fbc62b
|
|
| MD5 |
9efcf424d8960559b3fe9265128d6dc6
|
|
| BLAKE2b-256 |
02494d4dbcfecc829d5ea6daf5740cf7a07321dae60b819275f822c73b2f60bd
|