Skip to content
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

Lifespan #264

Open
ahopkins opened this issue May 27, 2019 · 18 comments
Open

Lifespan #264

ahopkins opened this issue May 27, 2019 · 18 comments

Comments

@ahopkins
Copy link

Does daphne currently (or plan to) support the lifespan protocol? We are working on ASGI support for Sanic and looking to make sure that it includes this feature.

@carltongibson
Copy link
Member

Hi @ahopkins. Sorry for the slow reply. (Life.)

First off, super! I had thought Sanic was more or less -1 on ASGI, so good to hear!

Then, no not currently, but yes definitely. Would happily take a PR 🙂 Failing that it'll be shortly.

@ahopkins
Copy link
Author

ahopkins commented Jun 5, 2019

Sorry for the slow reply. (Life.)

Been there. No worries 🍻

Then, no not currently, but yes definitely. Would happily take a PR slightly_smiling_face Failing that it'll be shortly.

Glad to hear this. Would love to submit a PR, but need to find the time for it. (Life.) If I can, I will.

@carltongibson
Copy link
Member

OK, let's do this. Thanks for the report @ahopkins!

@michaelurban
Copy link

It's been three years. Is there an update?

@michaelurban
Copy link

michaelurban commented May 6, 2022

@andrewgodwin Is Daphne still being actively developed? I only see one very minor commit in the past ~1.5 years. I thought that Daphne was supposed to be the reference implementation for ASGI, is this no longer the case?

I'm relying on lifespan events n my project, a pure ASGI app, not a framework. Without support for lifespan in Daphne my project doesn't work against the reference.

Is this going to change or would I be better off skipping ASGI and using Twisted?

@marcinowski
Copy link
Contributor

@michaelurban I'm not the right person to ask, when I made a change it was reviewed and merged really quickly which I suppose would indicate that there is someone from the Django team overlooking it.

@michaelurban
Copy link

@michaelurban I'm not the right person to ask, when I made a change it was reviewed and merged really quickly which I suppose would indicate that there is someone from the Django team overlooking it.

@marcinowski Sorry about that, I tagged you by accident!

@andrewgodwin: could you weigh in on #264 (comment)

@andrewgodwin
Copy link
Member

Daphne was always a reference server - a "true" ASGI server is going to be uvicorn or hypercorn. I also don't maintain this any more, we instead have other people doing security patches only.

@ahopkins ahopkins closed this as completed May 7, 2022
@ahopkins
Copy link
Author

ahopkins commented May 7, 2022

Thanks @andrewgodwin for the clarity.

@carltongibson
Copy link
Member

@michaelurban life has left little room for me recently but if a Lifespan PR turned up, I'd happily review it.

"It's been X years" just means no-one has made that contribution yet. (Not necessarily surprising as it doesn't necessarily fit the Django/Channels approach.)

My plan is to cut back to the Channels trio after Django 4.1a1 but this particular issue isn't high on my personal list.

@michaelurban
Copy link

michaelurban commented May 10, 2022

I'm not here to rag on you or complain.

I'm here because I'm building an API Gateway framework and wanted to make sure that it supports Daphne out of the box.

I like the work you guys are doing, I was writing a new piece of software that I thought was a good candidate for ASGI, I like Django, and am rooting for async Django+ASGI.

However, I regret engaging.

The "It's been three years" bit is in reference to a previous comment about Lifespan support stating "yes, definitely" and that the time-frame was "shortly" followed by three years of silence.

image

I was under the impression that Daphne is a reference implementation/server of the ASGI spec. In that it would "implements all requirements from a corresponding specification" ASGI, in this case.

image

This issue was closed so, Daphne is not going to support the full ASGI spec?

I was 100% under the impression that Daphne's purpose was to implement the ASGI spec in full and to act as the Django approved/supported way to deploy Channels. I don't know what is meant by a reference server if that isn't the case. Which means that I don't know what Daphne is.. Which is concerning, because I used to have a few hundred instances of it running in production.

Should Daphne be used in production? I don't see anything in the documentation that says it shouldn't.

I first started using Channels five years ago. I don't care about the pace of development or anything like that. But, the communication around async in Django has been very poor. It's hard to tell what's in progress and what's been abandoned (like Lifespan support.), etc. Communications from developers have, at times, seemed angry, depressed, or both. I feel ya!

Do you need money? More time? More support? How can we get you what you need to keep doing important work that will benefit many people in a healthy way? I've never understood how Django is so resource starved when so many profitable companies use it. I'll go throw another $25 in the tip jar for now and if I ever make it big I'll bury the jar in nickels.

Unfortunately, because of the communication issues, I had to make the choice to move to Elixir/Phoenix for tasks that I would have used Channels for.

I'm rooting for you, but, for now, I don't have the time or resources to contribute much to Django/Daphne personally (you should see my bank account. It's bleak.) I'm fixing blockers for my projects in three other projects currently. And, this isn't a blocker for me, it's a blocker for people who want to use Daphne. I can't fix every non-blocker bug in every tangentially related project myself. There are just too many.

Back to the present: I've built a shim that works around Daphne's lack of Lifespan support. Until Daphne supports Lifespan I'll recommend an alternative ASGI server.

I wish you guys well, I really do.

@ahopkins
Copy link
Author

This issue was closed so, Daphne is not going to support the full ASGI spec?

I closed the issue because it seemed like it was not something that anyone was planning on adding. I do not have the time to add it, and have accepted the fact that if someone wants to use Daphne with Sanic, then they will not be able to make use of the features that this would enable. Therefore, it has become the third place choice that we recommend to anyone wanting to run Sanic over ASGI.

I've reopened since maybe it is still relevant?

@ahopkins ahopkins reopened this May 10, 2022
@carltongibson
Copy link
Member

OK, thanks @michaelurban. I've opened django/asgiref#326 to adjust the description of Daphne as the current reference implementation.

'Twas originally, but current goal is Does it work for Channels?.

You are right, my original comment did say, PR or Shortly but that was pre-COVID I'm afraid.

I wish you well too.

@carltongibson
Copy link
Member

@ahopkins Thanks too!

I am still happy to take a PR adding this.

I am still maintaining Daphne, even if not super-actively. A release pulling in the recent PRs, and updating Twisted, and Python support is on the list for post-Django 4.1a1.

Aside (trying to communicate what's going on):

I think there are two segments here. The full-on ASGI/async folks, who aren't interested in Daphne much anyway, and the folks using Django/Channels for whom plenty are using Daphne very successfully.

The focus has entirely been on the core use cases around Channels, and on Django's async support.

To that: Channels was updated to ASGI v3, and that went well, and Django 4.1 includes another batch of async improvements.

As far as I can tell that's what we're aiming for, and I can't help but be positive about it, and think we're on a good road.

All that time, Daphne has had my eye, and I've made releases where needed and merged what I've had time for, but it's not been pressing (not compared to other bits in the stack).

It still works fine; that's one of the benefits of building on twisted it turns out. The X-feature wasn't added doesn't mean more than it wasn't essential yet.

I appreciate that if you're in the wider async/ASGI world, Daphne isn't as INSERT-YOUR-ADJECTIVE as the other servers... But for a moderately high-throughput websocket server for Channels it does perfectly well.

And as life returns to normal, I still hope to pick up the pace.

As well as working on Django, I do OSS in the Django-world for a hobby — always have. Channels &co is where that time will go for the next period — which means few years at least. (I can't say more than that.)

If folks want to join in and help, then super. Equally, if you're more of the I'll just use X line, I'm all with you.

Hopefully that clarifies the status a little.

@michaelurban
Copy link

@carltongibson Thanks for the update. I used Daphne in production for years and it was one of those rare 100% positive experiences.

Really excited for Channels + async ORM.

@michaelurban
Copy link

@carltongibson

You are right, my original comment did say, PR or Shortly but that was pre-COVID I'm afraid.

THERE WAS A TIME BEFORE COVID?

@carltongibson
Copy link
Member

@michaelurban I seem to recall one vaguely 🥳

@ngnpope
Copy link
Member

ngnpope commented May 11, 2022

THERE WAS A TIME BEFORE COVID?

I seem to recall one vaguely 🥳

Feels like a lifespan ago... 🥁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants