matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
197 stars 63 forks source link

Specify exact dependencies instead of >=version (follow 12factor principle) #71

Closed miraculixx closed 7 years ago

miraculixx commented 9 years ago

The current practice of specifying >= versions in setup.py leads to problems when installing with pip. Formerly perfectly running applications suddenly stop on the next pip install.

This is just an example of the general problem in setup.py.

  File "/home/projects/myshop/env/local/lib/python2.7/site-packages/plata/shop/models.py", line 13, in <module>
    from django_countries import CountryField
ImportError: cannot import name CountryField

Reason: Plata's setup.py requires django-countries>=1.5 which by December 2014 installs version 3.0. However, version 3.0 requires from django_countries.fields import CountryField.

If plata specified the exact version this would not happen (see 12factor dependencies principles of why that's a good idea).

matthiask commented 7 years ago

Sorry for the problem you encountered. However, it's not good practice to pin exact versions in install_requires of reusable apps if not absolutely necessary, version ranges should be used instead.

(IMO 12factor applies to projects, not reusable apps. We always* use exact versions in requirements files etc.)

https://caremad.io/2013/07/setup-vs-requirement/