-
-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install channels without daphne #490
Comments
This is a good point, but I also want to ensure that people who Do you know of a way we could have a default dependency in Python that's possible to exclude? |
I have no idea if it is possible to have optional default dependencies in python. Another way to solve this would be, if renamed the current package to something like |
My guess is that making runserver command implementation independent of Daphne code base will be the right decision. For example we can make Daphne itself depends on runserver at this moment and eventually move it totally into fully async twisted stack. |
That will still destroy the first time user experience though. I even think having |
Maybe I wasn't clean. runserver will work out of the box without installing Daphne. So first impression still be the same. But when you deploy to production you'll install Daphne explicitly. |
@andrewgodwin Did you find time to think about this issue? My preference would be, if you created two packages. A package called "channels" that has no dependency to daphne and does not ship the runserver command. Another package called for example "channels-environment", ships the runserver command and has all the dependencies. |
I have given it some thought, but there's not an ideal solution yet. I don't really want to make two packages as channels is already 5 packages as it is , but if I did, it would be something like It's possible this can be done with a single The other part of the issue is that so far, you're the only person requesting the change, so it's quite low priority at the moment compared to other issues that are around. |
I like the idea of runserver not depending on daphne because edit: we will just uninstall ws4redis |
I like the idea of a separate package version ( |
The only way I know how to do it is some think like have empty PyPI package called |
The |
That was my idea, yes. I know that having a |
Great idea ... |
@ostcar did you consider that you'll need to run manage.py runworkers in production in order to get the websockets running? Or did you find a way around that as well? |
Thanks @ostcar. Your statement concerning My question was totally unrelated to daphne, indeed. |
I haven't found a good solution to this even in the Channels 2.0 refactor, so I am going to close this as an effective WONTFIX. If someone can think of a clever solution that preserves |
Maybe we can have two separate But I don't know if we really want to support this complexity. |
I just don't think it's worth the overhead to maintain and publish two separate packages. If someone cannot install Daphne for some reason, they can download and build their own package from the source plus a patch easily. |
Currently the
In practice I do use channels without daphne, because uvicorn seems to be a better choice than daphne, and since ASGI technology is evolving actively, I think make channels a pure library without server could becoming more and more considerable. One thing also worth noticing is that daphne requires twisted, which is very bloated comparing to uvloop required by uvicorn... |
If I could make an argument to reconsider this issue: the problem with requiring |
So looking on the pip issue tracker, there's this closed issue, "Way to specify --no-deps option in requirements.txt?"
Looking at uvicorn, they've now got Maybe we can think about this in the future, but don't have the bandwidth to think about re-opening it right now. (Just use |
How about we have just 1 channels package, but allow users to set an env var that skips installation of Daphne. Channels would check for it in setup.py:
(The env var could also be called CHANNELS_INSTALL_WITHOUT_DAPHNE etc.) Also in apps.py, we would wrap the daphne import in a try/except. |
Here is a diff with the changes I propose: 3.0.2...oTree-org:master |
Hi, any feedback on my above approach and linked PR? To summarize:
|
Hey @oTree-org. I haven't had bandwidth to look at it properly yet, but it does look like it resolves the concerns at first pass yes. |
OK thank you :) |
@oTree-org That doesn’t work. |
I would recommend setting |
@andrewgodwin Why not just do like uvicorn with uvicorn and uvicorn[standard]. That way, if people are installing uvicorn[standard], they will have a standard install. And people installing just uvicorn will just have uvicorn. Their pull request for info : encode/uvicorn#666 |
|
The issue I see with the A |
I personally like the idea of a separate |
I think we could do a Could is the operative work: it needs input.
|
Psycopg2 had to split between two packages so yes it could be the way to go. But in that case, that means maintaining two pyproject.toml. Is it ok ? |
Hi @Atem18
I don't see another way — but it's just (cough) the extra If someone wants to lay it out, with checklists for building etc. I'm very happy to have a look. (Otherwise I will eventually get to it, but it's not high on my personal priority list.) |
Hi @carltongibson, I would say so. I think the steps are first to convert the setup.py to a working pyproject.toml, then create the pyproject-core.toml ? |
@Atem18 Something like that yes... — I'd convert to using Flit, and then add the extra configuration. |
@carltongibson Here you go : #1840 I tested the build and install and it's working. I cannot test the publish as you can imagine but you probably can on TestPyPi :) When the migration is done, I think we could just do a copy paste and that's all. |
@carltongibson Do you think some kind of optional |
@johnthagen "Planning Channels v4.0" #1898 currently says "A move of the runserver command to Daphne, so that folks using other ASGI servers don't have that import overhead to use Channels." Update: Ohh I see runserver command was already deleted in #1897, but the daphne requirement is still currently there. |
@johnthagen my plan is a I'll settle it whilst reviewing the tutorial and docs next. Discussion probably better over there than here 😜 ... ... but v4.0 Will resolve the underlying request here I hope. So... 💃 |
@collinanderson I have this under "...then I'll look at updating the packaging..." (on #1898) If you both (and anyone else) want to follow along there, that would be super! I'm guaranteed to miss things without extra 👀 |
Maybe we could use #1840 ? ^^ |
Currently channels has daphne as dependency. So it is not possible to install channels on one machine without installing daphne with its dependencies.
The only place in code of channels, which needs daphne, is the
runserver
command, which kind of a development command that should not be used in production. So there is no need to require daphne as a requirment for a production setup.Could it be possible to create a package, that you can install without installing daphne as well?
Our background is as follows: We have a django-channels app, that has be used also on windows from low-tech-users. But it is quite hard to install a current version of twisted on windows. So we build geiss as an replacement for daphne, which does not need twisted. But with the current package of channels, it is not possible to get rid of twisted, even when we don't want to use daphne.
But I think, that there are other use cases where someone wants to install channels without daphne. For example if you want to separate the worker on different containers/hardware then the protocol server.
The text was updated successfully, but these errors were encountered: