|
1 | 1 | # Python String Utils Changelog
|
2 | 2 |
|
| 3 | +## v1.0.0 (March 2020) |
| 4 | + |
| 5 | +### Deprecations |
| 6 | + |
| 7 | +We are in 2020 and finally old versions of Python have been |
| 8 | +[officially deprecated](https://www.python.org/doc/sunset-python-2/). |
| 9 | +So the following versions are **no longer supported**: |
| 10 | + |
| 11 | +- 2.7.x |
| 12 | +- 3.3.x |
| 13 | +- 3.4.x |
| 14 | + |
| 15 | +(suite tests are now being executed against all currently supported versions: 3.5, 3.6, 3.7 and 3.8) |
| 16 | + |
| 17 | +### Added: |
| 18 | + |
| 19 | +- `compress()`: compress strings into shorter ones that can be restored later on |
| 20 | +- `decompress()`: restore a previously compressed string |
| 21 | +- `roman_encode()`: encode integers/strings into roman number strings |
| 22 | +- `roman_decode()`: decode roman number into an integer |
| 23 | +- `roman_range()`: generator which returns roman numbers on each iteration |
| 24 | +- `asciify()`: Force string content to be ascii-only by translating all non-ascii chars into the closest possible |
| 25 | + representation |
| 26 | +- `is_ip_v4()`: checks only for v4 ips |
| 27 | +- `is_ip_v6()`: checks only for v6 ips |
| 28 | +- `is_isbn_13()`: checks if the given string is a valid ISBN 13 |
| 29 | +- `is_isbn_10()`: checks if the given string is a valid ISBN 10 |
| 30 | +- `is_isbn()`: checks if the given string is a valid ISBN (any version) |
| 31 | +- `is_number()`: checks if the given string is a valid number (either an integer or a decimal) |
| 32 | +- `is_integer()`: checks if the given string is a valid integer |
| 33 | +- `is_decimal()`: checks if the given string is a valid decimal |
| 34 | +- `booleanize()`: turns string into boolean based on its content |
| 35 | +- `strip_margin()`: remove left margin from multi line strings so you don't have to bother about indentation |
| 36 | +in your code (inspired by Scala) |
| 37 | +- `random_string()`: generates string of given size with random alpha-numeric chars |
| 38 | +- `secure_random_hex()`: generates hexadecimal string of the given bytes count using secure random generator |
| 39 | + |
| 40 | +### Fixes |
| 41 | + |
| 42 | +- `is_ip()` now checks both ip v4 (and validates 0-255 range) and ip v6 |
| 43 | +(the previous implementation was really shallow, my apologies :P) |
| 44 | +- `is_json()` now considers as valid json array objects (eg. `is_json('[1, 2, 3]')` returns true now) |
| 45 | +- `prettify()` does not screw up urls or emails anymore (from now on it won't consider those as text to be formatted) |
| 46 | +- Solved deprecation warnings over invalid escape sequences in Python >= 3.7 |
| 47 | + |
| 48 | +### Changes |
| 49 | + |
| 50 | +- Old module `string_utils.py` has been replaced by a package with submodules (`validation.py`, `manipulation.py`, |
| 51 | +`generation.py` and `errors.py`), anyway all the functions are still |
| 52 | +importable as before (`from string_utils import xxx`). Similarly `tests.py` has been refactored into a package |
| 53 | +with a module for each test case |
| 54 | +- `is_snake_case()` now considers as "snake case" strings with mixed upper and lower case characters, strings with |
| 55 | +leading or trailing underscores and string containing multiple underscores in sequence |
| 56 | + |
| 57 | +### Improvements |
| 58 | + |
| 59 | +- Added Python type hints to all functions arguments and return types |
| 60 | +(this is now feasible since the minimum supported Python version is the 3.5) |
| 61 | +- Each method that expect a valid string as input now will raise a more detailed `InvalidInputError` exception |
| 62 | +(eg: ***Expected "str", received "list"***) |
| 63 | +- `reverse()`, `shuffle()`, `prettify()` now raise the detailed `InvalidInputError` if input is not a valid string |
| 64 | +- String checks should now be a bit faster (switched from `.search()` to `.match()` in internal regex when the goal |
| 65 | +is to match the full string) |
| 66 | +- `is_palindrome()` algorithm has been redesigned to offer a faster check and better memory usage |
| 67 | +(only 2 chars are now being access at the same time instead of the whole string) |
| 68 | +- `slugify()` is now able to translate more non-ascii chars during the string conversion |
| 69 | +(it now makes use of the new extracted method `asciify()`) |
| 70 | +- `is_uuid()` has now a second parameter `allow_hex` that if true, considers as valid UUID hex value |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | + |
| 75 | + |
3 | 76 | ## v0.6.0
|
4 | 77 |
|
5 | 78 | ### Added:
|
|
0 commit comments