Skip to content

Commit

Permalink
❇️ Add unicode version output in CLI --version (#194)
Browse files Browse the repository at this point in the history
And deprecate the use of unicodedata2
  • Loading branch information
Ousret committed Jun 19, 2022
1 parent af9f36f commit 64d0475
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [2.1.0.dev0](https://github.com/Ousret/charset_normalizer/compare/2.0.12...master) (2022-??-??)

### Added
- Output the Unicode table version when running the CLI with `--version` (PR #194)

### Changed
- Re-use decoded buffer for single byte character sets from [@nijel](https://github.com/nijel) (PR #175)
- Fixing some performance bottlenecks from [@deedy5](https://github.com/deedy5) (PR #183)
Expand All @@ -15,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
- Support for Python 3.5 (PR #192)

### Deprecated
- Use of backport unicodedata from `unicodedata2` as Python is quickly catching up, scheduled for removal in 3.0 (PR #194)

## [2.0.12](https://github.com/Ousret/charset_normalizer/compare/2.0.11...2.0.12) (2022-02-12)

### Fixed
Expand Down
9 changes: 7 additions & 2 deletions charset_normalizer/cli/normalizer.py
Expand Up @@ -5,6 +5,11 @@
from platform import python_version
from typing import List

try:
from unicodedata2 import unidata_version
except ImportError:
from unicodedata import unidata_version

from charset_normalizer import from_fp
from charset_normalizer.models import CliDetectionResult
from charset_normalizer.version import __version__
Expand Down Expand Up @@ -119,8 +124,8 @@ def cli_detect(argv: List[str] = None) -> int:
parser.add_argument(
"--version",
action="version",
version="Charset-Normalizer {} - Python {}".format(
__version__, python_version()
version="Charset-Normalizer {} - Python {} - Unicode {}".format(
__version__, python_version(), unidata_version
),
help="Show version information and exit.",
)
Expand Down
2 changes: 2 additions & 0 deletions charset_normalizer/utils.py
@@ -1,4 +1,6 @@
try:
# WARNING: unicodedata2 support is going to be removed in 3.0
# Python is quickly catching up.
import unicodedata2 as unicodedata
except ImportError:
import unicodedata # type: ignore[no-redef]
Expand Down

0 comments on commit 64d0475

Please sign in to comment.