I'm trying to write a python package that can be installed from PyPI and am having trouble getting my head around how exactly to structure setup.py
and requirements.txt
properly.
I know that they have different semantics and different purposes with setup.py
defining whats needed, and requirements.txt
given exact versions. I also know that you shouldn't read requirements.txt
into setup.py
.
So what I need to know is how to structure setup.py
and requirements.txt
so that when my package is installed from PyPI the reight requirements are installed.
In my example, I need django-haystack
(the latest version is 2.5.1
), but my code is only compatible with django-haystack
version 2.5.0
, so my setup.py
and requirements.txt
are as shown below:
setup.py
:
setup(
name='my_package',
install_requires = [
'django-haystack',
],
)
requirements.txt
:
django-haystack==2.5.0
How can I structure my setup code so that when this is installed, django-haystack==2.5.0
is installed not the latest?