I have a small project that requires a third-party module that's rarely updated (once every other year or so) and not maintained by any package management system. The context, here, is cognitive science & research, the third party module is for linking proprietary hardware to custom scripting, in the house project, potentially, may end up seeing wider (eventually open source) use within cog. psych so I want to plan for distribution. Can anyone poke holes in or thumbs up this approach: #!/usr/bin/env pythonfrom distutils.core import setuptry:    import third_party_package    install_packages = ['in_house_package']except ImportError:    print Warning: 'third_party_package' not found in PYTHON_PATH, installing version in_house_package v. <VERSION>    install_packages = ['in_house_package', 'in_house_package.third_party_package']setup(    name='InHousePackage',     version = '0.1',     description = 'A framework for building psychological experiments in Python',     author = 'me',     author_email = 'my_address',     url = 'a local git',     packages=install_packages,    requires = ['numpy']    )
Listing an optional Python dependency in setup.py
python;modules;installer
A few small comments:The error message looks wrong to me.This is what the logic looks like to me:if (third party package is installed):    install(in-house package)else:    install(in-house package)    install(in-house variant of third-party package)but the printed warning tells me that the in-house package isnt installed. Shouldnt it tell me the third-party package isnt installed?An ImportError doesnt necessarily mean a module isnt installed. It just indicates any error when the module was imported. For example, if I have a file foo.py that contains:import barand no module bar.py, I get an ImportError when trying to import foo, even though the foo file exists:>>> import fooTraceback (most recent call last):  File <stdin>, line 1, in <module>  File foo.py, line 1, in <module>    import barImportError: No module named barYou can jump through hoops with import tools, or check the error message of the ImportError. That may or may not be something worth worrying about; just remember that this edge case is there.Trivial nitpicks.Im sure this is just an artefact of posting on CR, and it isnt actually called in_house_package, but youve misspelt it in the error message.When specifying keyword arguments to a function (such as setup()), its common to omit the spaces around the equals sign.