Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911128 - dev-python/charset-normalizer missing md__mypyc module
Summary: dev-python/charset-normalizer missing md__mypyc module
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-24 11:01 UTC by Mark
Modified: 2023-07-24 18:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark 2023-07-24 11:01:16 UTC
I have a python script that uses charset_normalizer by using the following code:

from charset_normalizer import md__mypyc

I installed mypy and charset_initializer but when I execute the script I get the message 

[...]
    from charset_normalizer import md__mypyc
ImportError: cannot import name 'md__mypyc' from 'charset_normalizer' (/usr/lib/python3.11/site-packages/charset_normalizer/__init__.py)

I downloaded the sources from charset_normalizer and found the following in setup.py:

USE_MYPYC = False

if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
    sys.argv.pop(1)
    USE_MYPYC = True
if os.getenv("CHARSET_NORMALIZER_USE_MYPYC", None) == "1":
    USE_MYPYC = True

if USE_MYPYC:
    from mypyc.build import mypycify

    MYPYC_MODULES = mypycify([
        "charset_normalizer/md.py"
    ])
else:
    MYPYC_MODULES = None

setup(
    name="charset-normalizer",
    version=get_version(),
    ext_modules=MYPYC_MODULES
)

So whatever it does, the mypyc module seems to be disabled by default unless --use-mypyc is provided to build that module. Would it be possible to detect mypyc or add a USE-flag to dev-python/charset-normalizer?