django-lightweight-queue icon indicating copy to clipboard operation
django-lightweight-queue copied to clipboard

Expand Settings to handle different Django Architectures

Open itsthejoker opened this issue 3 years ago • 4 comments

Expanding from https://github.com/thread/django-lightweight-queue/pull/61

The settings for django-lightweight-queue expect and require that all settings are laid out in a single file and are all ready at runtime, which is not an accurate assumption for projects that use environment variables to determine which settings to load at runtime. This PR refactors the internal project settings to be similar to that of django-cors-headers, though this one is more complex because django-lightweight-queue expects to be able to rewrite every setting on its own.

This is a stacked PR with https://github.com/thread/django-lightweight-queue/pull/64 and this one should be merged first.

itsthejoker avatar Jun 24 '22 18:06 itsthejoker

@PeterJCLaw I've refactored it to flesh out your suggestion, but I'm a little concerned that the readability has gone down. (Very pleased about the decrease in length, though.) Ready for review again.

itsthejoker avatar Jul 10 '22 21:07 itsthejoker

Re: type checking: I admit that I have no idea how to properly pass the type hints through that __getattr__ call -- we passed the limit of my skills appeasing mypy long ago in this process. I'm open to trying whatever, but if you have an idea how to make it work then would you be open to implementing it? At this point I've spent about as much time fighting mypy errors as I have actually writing code and it's quite frustrating.

itsthejoker avatar Jul 13 '22 20:07 itsthejoker

Re: type checking: I admit that I have no idea how to properly pass the type hints through that __getattr__ call -- we passed the limit of my skills appeasing mypy long ago in this process. I'm open to trying whatever, but if you have an idea how to make it work then would you be open to implementing it? At this point I've spent about as much time fighting mypy errors as I have actually writing code and it's quite frustrating.

Sure, I'm happy to have a go at this. I realise that mypy errors can be a little obtuse at times! Thanks for your efforts getting us this far :)

PeterJCLaw avatar Jul 14 '22 08:07 PeterJCLaw

Quick update -- I haven't forgotten this, just haven't had time recently.

PeterJCLaw avatar Aug 02 '22 15:08 PeterJCLaw

Thanks for building this & sorry it's taken so long to reach a conclusion here. We've ended up extending this in #70 which I've now merged. Hopefully that resolves the use-cases you had in mind.

PeterJCLaw-mns avatar Dec 14 '23 14:12 PeterJCLaw-mns