mediaforensics/medifor

setup.py deps are overconstrained

xkortex opened this issue · 1 comments

The dependencies in setup.py are very tightly constrained, and some are only needed for only parts of the repo. Ideally, install_requires should only be used for things that the base API needs for performers to implement. The rest should be compartmentialized into extra requires. For example, it appears to me that Pillow is only imported in filtersvc. A lot of performer code uses their own version of PIL/Pillow, so this tight constraint causes conflicts. Also should try to deconstraint by using the 'compatible' operator ~=, or avoiding version numbers wherever possible. This is usually fine for very stable APIs like setuptools and six.

Also it causes a "thrashing" of sorts with docker image builds where it forces pip to switch versions which bloats the overlayfs.

Example:

setup(name=pkg_name,
      package_dir={
          '': 'python',
      },
      version='0.2.3',
      description='Protocol wrapper for MediFor Analytics',
      author='Data Machines Corp.',
      author_email='help@mediforprogram.com',
      url='gitlab.mediforprogram.com/medifor/medifor-proto/py',
      license='Apache License, Version 2.0',
      packages=find_packages(),
      install_requires=[
          'setuptools',
          'grpcio==1.15.0',
          'grpcio_health_checking==1.15.0',
          'protobuf>=3.6.1',
          'googleapis-common-protos==1.6.0',
          'dataclasses~=0.6',
          'six',
      ],
      extras_require={
            'protoc': [  # only needed for compiling protobufs
                'grpcio-tools==1.15.0'
            ],
            'prov_example': [  # provenance filter example
                'pillow~=6.2.0',
                'Flask~=1.1.1',
                'requests~=2.22.0',
            ],
            'client': [
                'Click~=7.0',
            ]
      },
      data_files=list(iter_protos(pkg_name)),
      py_modules=[
          'medifor.v1.analytic_pb2',
...
      ]
      )

Was it taken care of? I do not see the pillow dep anymore:
https://github.com/mediaforensics/medifor/blob/develop/setup.py