2👍
First, a warning: specify explicit version requirements in a setup.py
file without a range will guarantee frustration for end-users in the future.
You can simply do it like so in the setup.py
file.
setup(
name='my_package',
install_requires=[
'django-haystack==2.5.0',
],
)
However, if another user wish to use another package that requires django-haystack
latest version, they won’t be able to install your package as defined due to version conflict issues. Of course, if the package at hand is so flaky that it can’t even attempt to use semantic versioning then there isn’t really much can be done.
Now if all you are after is a reproducible build, the requirements.txt
method can be used for explicit version requirements for all packages within your environment, which is out of band from the typical package dependency structure, however it won’t suffer from the potentially crippling lockdown from conflicting requirements that aren’t actually in conflict. zc.buildout
is an alternative, but much more heavier but it does a lot more than just Python.