wichert / lingua

Translation toolkit for Python
Other
45 stars 32 forks source link

Does lingua really require Chameleon? #91

Closed bochecha closed 4 years ago

bochecha commented 6 years ago

Hi,

I'm working on a new Pyramid application, using Lingua for the translations. We use Jinja2 for our templates, which means we have to use the babel-jinja2 extractor, and do not need the chameleon one.

Does lingua really require Chameleon? Or could it be made an extra_requires, to be installed only by those who actually want to use Chameleon for their templates?

(I'm of course happy to send a pull request if you agree to relaxing the dependency 🙂)

bochecha commented 6 years ago

Thinking about it some more, someone using the Chameleon templating system will install Chameleon anyway (usually before even installing lingua) so there doesn't seem to be a need for the dependency at all.

This is similar to other extractors:

I feel like the dependency on Chameleon could be removed, and we would get the same behaviour.

Would you consider just removing the dependency?

sinoroc commented 4 years ago

See #94 and sqlalchemy/mako#304. I might be able to propose a fix.

wichert commented 4 years ago

This is fixed by #97

ronanpaixao commented 1 year ago

The chameleon dependency must have creeped back into lingua. I'm just starting out with it and bumped into the problem:

C:\project_dir>pot-create project_file.py

Traceback (most recent call last):
  File "C:\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\anaconda3\Scripts\pot-create.exe\__main__.py", line 7, in <module>
  File "C:\anaconda3\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\anaconda3\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\anaconda3\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\anaconda3\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\anaconda3\lib\site-packages\lingua\extract.py", line 388, in main
    register_extractors()
  File "C:\anaconda3\lib\site-packages\lingua\extractors\__init__.py", line 167, in register_extractors
    extractor = entry_point.load(require=True)
  File "C:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2471, in load
    return self.resolve()
  File "C:\anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\anaconda3\lib\site-packages\lingua\extractors\xml.py", line 12, in <module>
    from chameleon.namespaces import I18N_NS
ModuleNotFoundError: No module named 'chameleon'

I don't have chameleon installed, don't use it and pip didn't install it as a requirement. Workaround was to install it.

Using Anaconda 64-bit on Windows 10. lingua-4.15.0 polib-1.1.1 installed from pip.