Netflix/sureal

Package structure is broken

slhck opened this issue · 1 comments

slhck commented

I think that the package structure is not ideal and not according to Python guidelines, which will eventually lead to problems when installing via pip.

For example, run_subj is a script in the main directory, outside of any Python package. It then always calls the pip-installed sureal module:

from sureal.subjective_model import SubjectiveModel

So the code cannot be run if sureal was not properly installed as a package before.

I would suggest to:

  • Create a folder called sureal which is a Python package that should get installed
  • Have this module contain a main entry point for the CLI
  • Move the actual CLI-code from run_subj to sureal.__main__

This would allow the user to run:

python -m sureal

to call the CLI interface, and to use from sureal import … whenever they need SUREAL within another Python package.

You can see a simple example of such a module structure here, or a general recommendation in this post (section Installable Single Package).

Thanks for refactoring the repo structure. I was learning Python the proper way along the way.