This is how I do it currently:
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
'requests',
'mock',
'gunicorn',
'mongoengine',
]
setup(name='repoapi',
version='0.0',
description='repoapi',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=requires,
test_suite="repoapi",
entry_points="""
[paste.app_factory]
main = repoapi:main
""",
)
Is this an okay way? I have some troubles. For example, for pyramid, I cannot use the system-wide nosetests plugin to run tests. I need to install pyramid
in the global python site-packages!
But I don't want that. So I must install nose in the virtualenv of this project. But I don't want it to be a dependency. I don't feel like it should belong to requires
. It isn't. Yet, I also don't want to install by hand all the time. Yeah I know I have a lot of I don't want to do this and that...
But how would you solve that? I don't want to tamper the global python site-packages, but I want to install nose as part of the virtualenv.
Also, pip install requirement files. It's slightly more accurate because I don't need to specify the version manually and I don't need to be afraid of updating setup.py manually. Just throw pip freeze > file.txt
and done.
However, pip can return garbage because we throw garbage packages into virtualenv.
So many blades. What's the best practice? How do you deal with these issues?
Maybe I missed it, but https://github.com/django/django/blob/master/setup.py, how did Django do it?
See Question&Answers more detail:
os