shacker / django-todo

A multi-user, multi-group todo/ticketing system for Django projects. Includes CSV import and integrated mail tracking.
http://django-todo.org
BSD 3-Clause "New" or "Revised" License
819 stars 285 forks source link

setup.py imports django, which it shouldnt #118

Closed deniz195 closed 3 years ago

deniz195 commented 3 years ago

When trying to use django-todo on heroku I find that it cannot be deployed automatically. Why? When installing via pip -r requirements.txt on a clean installation the setup.py of django-todo fails, because it tries to import django.

I have made a demo repo here: https://github.com/deniz195/django-todo-fail

I think that setup.py should not make any assumptions on the packages which are installed at install time!

shacker commented 3 years ago

Not sure I understand the problem @deniz195 . Django is an absolute dependency for the project - it can't be used without Django, so naturally it is listed in the dependencies in setup.py. That's just the way things work.

Maybe you can tell us why you want to be able to install todo without its prerequisites?

deniz195 commented 3 years ago

Hi @shacker , of course django-todo lists django as (runtime) requirement in setup.py - there is no problem here.

The problem occurs if you try the following: 1) Create an empty virtual environement (e.g. virtualenv env) 2) In the (empty) virtual environment install via pip install django-todo

Result: An error in the setup.py is raised, since the execution environment of setup.py has django not yet available during installation! Problem: This error does not allow to use django-todo in an automated pipeline such as heroku.

I will make a suggestion for a pull request, which might clarify the situation!

PS: (Tried with pip 21.0.1 from ...\env\lib\site-packages\pip (python 3.8)) PPS: On my windows machine, the package will install correctly, despite the error being shown! On heroku not though.

shacker commented 3 years ago

I have not used Heroku before. It sounds like you are not saying that you want to use todo without Django, but only that in the Heroku environment, Django is provided in the path through other means, and does not need to be part of your requirements.txt or other manifest?

deniz195 commented 3 years ago

I agree, no point using todo without django.

On heroku django is as usual installed via requirements.txt.

I found the bug using heroku, but you can easily reproduce it (without heroku) on your local machine in a clean virtual environment (see above).

I suspect that bug might have become visible with newer python and pip versions. (Possibly older versions have been more forgiving).

Did you check the pull request? #120

shacker commented 3 years ago

@deniz195 I understand the problem now, and your PR makes perfect sense. Thanks a bunch for the contribution!

shacker commented 3 years ago

Merged.