OpenVoiceOS / ovos-utils

Apache License 2.0
3 stars 8 forks source link

dependencies are duplicated + add version specs #5

Closed JarbasAl closed 2 years ago

JarbasAl commented 3 years ago

dependencies are duplicated in setup.py and requirements.txt. Also, should add version specs to all deps

builderjer commented 2 years ago

I can help on this. Which file should they be in?

NeonDaniel commented 2 years ago

In OSM, we put them in setup.py and requirements.txt just included . to install from setup.py I think that's the best option for consistency? @ChanceNCounter did that one iirc https://github.com/OpenVoiceOS/ovos_skill_manager

ChanceNCounter commented 2 years ago

To be honest, I did about 10 minutes of research, another 10 minutes of trying to break it, and concluded that StackOverflow was right this time. I have no idea if that's a best practice or a kludge.

NeonDaniel commented 2 years ago

Alternate method I started using (before I knew . was a valid requirement) below. One new nice side-effect is PyCharm validation of requirements files https://github.com/NeonGeckoCom/neon-skill-utils/blob/e43adf3fe05774c031849c1a62b2cc6fe00a8556/setup.py#L34-L39

def get_requirements(requirements_filename: str):
    requirements_file = path.join(path.abspath(path.dirname(__file__)), "requirements", requirements_filename)
    with open(requirements_file, 'r', encoding='utf-8') as r:
        requirements = r.readlines()
    requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith("#")]
    return requirements