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