ryan-hoffman / calorimetry-project

0 stars 0 forks source link

new demo started #4

Open paul-shannon opened 5 years ago

paul-shannon commented 5 years ago

@ryan-hoffman I just started a new subdirectory of explorations in which (I propose - you decide!) we will work through good coding practices, and gain a grasp of dash eccentricities, using a tiny app to convert Farhrenheit to Centigrade.

If you do a pull you can see where I am headed:

None of the code works yet.

Will this be useful?

paul-shannon commented 5 years ago

@ryan-hoffman The non-gui version of this silly demo class is now complete. Let me know what you think. It has the minimal engineering structure (virtual environment, makefile, pip install requirements.txt with versions specified, tests).

Though the concept may seem foreign at first, it is very useful to think of any web project as having two parts:

The GUI uses the computational core - which is maintained (developed, tested) entirely separately. An entirely new GUI could be swapped in at any time, as often happens.

ryan-hoffman commented 5 years ago

Great, thanks Paul! I think I successfully pulled the new code to my machine. I'll get a chance to look it over more later tonight.

ryan-hoffman commented 5 years ago

Hi Paul, I added a toFahrenheit() method to the TemperatureConverter() class and updated the test_temperatureConverter() script, however I can't push the changes to the repo. I keep getting an "Everything up to date" message even though I've made changes and saved them. I'm using in the terminal...maybe that's incorrect.

ryan-hoffman commented 5 years ago

I've tested the code I added in sublime and I ran the updated tests on my machine, and all seemed to work...but somewhere I'm getting the github part wrong.

Whoops, in my previous comment, it should read 'I'm using in the terminal...maybe that's incorrect."

ryan-hoffman commented 5 years ago

Okay, I think I figured it out. I was forgetting the 'git add .' and the 'git commit' steps. Seems to have pushed correctly now.

ryan-hoffman commented 5 years ago

@paul-shannon ...ha! I see now that I need this salutation to make sure my messages reach you. I've pushed some code with a new toFahrenheit() calculation and updated tests.

paul-shannon commented 5 years ago

@ryan-hoffman Tiny addition, new directory gui/ I see that Dash now (since February) allows not only multiple inputs to a callback, but multiple outputs as well. This long-awaited addition should simplify coding a lot:

https://community.plot.ly/t/multiple-outputs-in-dash-now-available/19437

ryan-hoffman commented 5 years ago

@paul-shannon Thanks. I pulled and got the app running in my browser.

paul-shannon commented 5 years ago

@ryan-hoffman firstLook.py is now totally broken - in a constructive way! My goal is to use that simple program to understand dash 1.0 features, and to illustrate basic operations.

Quoting from comments in the code: image

ryan-hoffman commented 5 years ago

Great! I pulled the broken code.

paul-shannon commented 5 years ago

I am beginning to suspect that dash’s limitations are fundamental. And that I may take a look at django,

I have an ongoing pro bono project called SLEXIL, with the International Journal of American Linguistics, rendering indigenous stories onto the web. dash has been a struggle. I’ll keep you posted!

On Aug 5, 2019, at 9:12 AM, ryan-hoffman notifications@github.com wrote:

Great! I pulled the broken code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

paul-shannon commented 5 years ago

@ryan-hoffman I -think- you will like this suggestion for a change in direction.
dash now seems to me like a poor choice. It's too new, too opaque, lacks too many features, forces us into nasty contortions.

I was playing a few tunes with Dan Tennenbaum yesterday, and I posed this question to him: how would you write a python web app? In essence he said, "Keep it simple. Use jquery, use its ajax capability to update the DOM, use flask."

I found this tutorial How to Build a Single Page App with Python Flask and followed it to create github /calorimetry-project/explorations/flask-jquery-singlePageApp/ I predict that you will like this approach. I will probably migrate SLEXIL away from dash, and towards this approach.

ryan-hoffman commented 5 years ago

@paul-shannon Sure sounds good. I'm definitely more at home with flask.

ryan-hoffman commented 5 years ago

@paul-shannon Thanks! I pulled the new code and have the app working in my browser. Now I'm trying to get some traction with jQuery.