fanout / django-eventstream

Server-Sent Events for Django
MIT License
638 stars 84 forks source link

Django 1.11 support on python 3 #56

Open AgDude opened 4 years ago

AgDude commented 4 years ago

The way that django-eventstream requires channels in setup.py prevents dependency resolution for django 1.11 on python 3. I am upgrading a project which uses pip-tools for dependency management and get the following output:

There are incompatible versions in the resolved dependencies:
  Django<2 (from -r requirements/requirements.in (line 33))
  Django>=2.2 (from channels==2.4.0->django-eventstream==3.1.0->-r requirements/requirements.in (line 34))

pip-tools does not currently have an option to override that. https://github.com/jazzband/pip-tools/issues/561

The way this is defined effectively makes django-eventstream only compatible with django>=2.2 on python 3. Since pip doesn't have strict dependency resolution this probably goes unnoticed in most cases.

I would be happy to offer a PR, but I don't see a good solution without forcing users to explicitly install channels, which would likely break things for many users. It seems like this might be addressed with extra_requires but I am not seeing how to make it dependent on the django version.

jkarneges commented 4 years ago

It looks like extra_requires could be used to specify channels as an optional dependency, that would only be installed if the user asks for it (for example by specifying a dependency to django-eventstream[channels]). This would be a breaking change though, and ideally the option would be inverted (channels enabled by default).

How about copying the django-eventstream module into your source tree, so you can control the dependencies and not attempt to install channels?

jkarneges commented 3 years ago

I've decided to simply require installing channels manually, to make it easier for users to select between older Django versions and the latest Channels versions. The major version of django-eventstream has been bumped to avoid surprises. Hopefully this fixes your issue.