mahmoud / clastic

🏔️ A functional web framework that streamlines explicit development practices while eliminating global state.
https://python-clastic.readthedocs.io/en/latest/
Other
156 stars 19 forks source link

Not compatible with Werkzeug 0.11.11 #15

Closed cpforbes closed 5 years ago

cpforbes commented 8 years ago

The server implementation uses the reloader_loop function from Werkzeug which is now an internal function.

mahmoud commented 8 years ago

Hi there, thanks for the report! This is an issue I've known about for a while (this line in setup.py isn't joking around). I'd like to fix it, can you tell me more about your case? Also, you wouldn't happen to want to take a swing at it, by chance? :) :)

cpforbes commented 7 years ago

Would it be possible to just use the Werkzeug run_simple function?

What does the clastic run_simple do that Werkzeug doesn't do?

I ran into this problem because I was evaluating several different frameworks and ran into a conflict when installing both at the same time. So far I like clastic but I don't want to be stuck on an old version of Werkzeug where bugs won't be fixed.

mahmoud commented 7 years ago

Oh, well, first, thanks for trying out Clastic! As for your concerns, FWIW, I think you're far from stuck. I've been using clastic daily at work and on Wikipedia-related projects for years and have not run into any Werkzeug feature gaps, or even will-fix bugs. Just haven't experienced a need to upgrade.

Clastic's server differs from others because it's able to recover from SyntaxErrors, ImportErrors, and other errors that might keep your application from starting. It stays running and displays the error in your browser. When files are changed, Clastic tries restarting again to see if your changes fixed the error. I've found it invaluable for quickly iterating.

Thanks again! :)

cpforbes commented 7 years ago

I was able to get clastic running with the latest Werkzeug by replacing the entire contents of server.py with the following:

from  werkzeug import serving

def run_simple(*args, **kwargs):
    serving.run_simple(*args, **kwargs)

I ran the tests using this code and it ran 251 tests with no failures.

The question is: what functionality is lost by using the werkzeug server instead of the one in clastic?

mahmoud commented 7 years ago

The reason for all that code is the reload/restart behavior, detailed above. Clastic is a WSGI web framework so it certainly works with a wide variety of servers, including the current version of Werkzeug's dev server.

mahmoud commented 5 years ago

Fixed in 19.0! Had to vendor a small chunk of werkzeug to maintain current behaviors, but CI says it works in all the Python versions that really matter, so, hooray!