Login
You're viewing the code4lib.social public feed.
  • Oct 20, 2026, 9:10 AM

    I should check #django 's new-feature repo later, but I wonder if an async version of BaseCommand would be useful. Mostly brainstorming it for when you're integrating Django bits with external libs that might be async. It would probably be simple enough (and easy enough to maintain) that it could fit along AppCommand and LabelCommand variants 🤔

    💬 1🔄 0⭐ 1

Replies

  • Oct 20, 2026, 10:26 AM

    For now I'm doing this, though probably needs more work to accept SIGINT more cleanly

    ```
    from asgiref.sync import async_to_sync
    from django.core.management import BaseCommand

    class Command(BaseCommand):
    @async_to_sync()
    async def handle(self, topic, **options):
    ...
    ```

    💬 0🔄 0⭐ 0
  • Oct 20, 2026, 10:26 AM

    @kfdm this sounds like a thing that would be useful to the folks who need it. It probably would start as a third-party package.

    💬 0🔄 0⭐ 0