Syslifters / reptor

Other
11 stars 3 forks source link

deepl dependency missing #56

Closed noraj closed 1 year ago

noraj commented 1 year ago

Could you add this line

deepl >= 1.15.0',

to

https://github.com/Syslifters/reptor/blob/0184ea3ed87de4eda864ff3edabade8b4fd1336b/pyproject.toml#L21-L22

because it is missing

➜ reptor -h
No .sysreptor folder found in home directory...Creating one
Traceback (most recent call last):
  File "/tmp/.venv/lib/python3.11/site-packages/reptor/plugins/core/Translate/Translate.py", line 13, in <module>
    import deepl
ModuleNotFoundError: No module named 'deepl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/.venv/bin/reptor", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/tmp/.venv/lib/python3.11/site-packages/reptor/__main__.py", line 7, in run
    reptor.run()
  File "/tmp/.venv/lib/python3.11/site-packages/reptor/lib/reptor.py", line 273, in run
    self.plugin_manager.load_plugins()
  File "/tmp/.venv/lib/python3.11/site-packages/reptor/lib/pluginmanager.py", line 154, in load_plugins
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/.venv/lib/python3.11/site-packages/reptor/plugins/core/Translate/Translate.py", line 15, in <module>
    raise Exception("Make sure you have deepl installed.")
Exception: Make sure you have deepl installed.
noraj commented 1 year ago

Note : I don't have the permission to fork so to PR

aronmolnar commented 1 year ago

I would fix this error by catching the import error.

The deepl dependency is installed with pip3 install reptor[deepl] or [all]. If it is not available, it should only raise an exception if the translate plugin is used.

noraj commented 1 year ago

Oh yeah I didn't see it was in the optional dependencies

https://github.com/Syslifters/reptor/blob/0184ea3ed87de4eda864ff3edabade8b4fd1336b/pyproject.toml#L49

So yes it should raise an error only when the specific code is used.

noraj commented 1 year ago

Also pytest should be listed as a dev dependencies and not a runtime one.

https://github.com/Syslifters/reptor/blob/0184ea3ed87de4eda864ff3edabade8b4fd1336b/pyproject.toml#L34