emmett-framework / severus

An internationalization engine designed with simplicity in mind
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

PyYAML as a runtime requirement or not? #2

Open brunobord opened 9 hours ago

brunobord commented 9 hours ago

Hi,

I was looking to test severus as an alternative to gettext in a tiny pet project, and I simply installed it on a virtualenv via:

pip install severus

Then I've followed the readme and created a hello.py file with the following code:

from severus import Severus, language

T = Severus()

with language("fr"):
    print(T("Hello world!"))

but it raised the following exception: ModuleNotFoundError: No module named 'yaml'

In the pyproject.toml file, I see that pyyaml is a "dev" requirement: https://github.com/emmett-framework/severus/blob/master/pyproject.toml#L108

But it looks like it's... not.

So, either:

gi0baro commented 8 hours ago

So, either:

  • pyyaml is a runtime requirement, so the pyproject.toml file should reflect this
  • pyyaml should not be required to run a severus-based i18n, and importing severus objects should be possible without triggering an exception (I admit that this one involves a lot of work to handle conditional imports, etc)

Thank you for reporting this, and sorry for the mess, I probably should've checked this properly once I took this out of Emmett. As of today, the requirement is actually needed at runtime, so pyproject.toml should be fixed accordingly. Gonna release a patch version asap.

Probably that requirement can be made optional with some minor effort, and make the yaml loader optional. Gonna probably tackle that in the next minor release.

brunobord commented 8 hours ago

that's great! many thanks!