anschelburk / nutrient_guide

Apache License 2.0
0 stars 0 forks source link

Refactor code by using functions #19

Open ryaustin opened 9 months ago

ryaustin commented 9 months ago

While streamlit is magical and does a great job at running scripts, refactoring your code into functions will help you to become a better developer by getting practice with writing reusable functions and maintainable code.

At minimum, the add_button and remove_button should be functions.

anschelburk commented 9 months ago

Created a new branch - refactoring_28feb2024 - for the refactored code. Pulled your code from our last meeting, and using that code, created a new file - refactoring_scratch_code.py - where my refactored code is. (The changes were extensive enough that I wanted to create a new file, so that we could reference the original new-app.py file if needed.)

Not entirely bug-free, but much more organized. Started adding in a few tests (you'll notice some print statements sprinkled in) - will continue working on this for our check-in tomorrow!

anschelburk commented 9 months ago

Also - got an error (screenshot below) when I tried to put some streamlit commands (like headers or subheaders) into functions. Still trying to figure out how to stop variables from resetting, hoping this screenshot can be helpful for our conversation tomorrow.

image

ryaustin commented 9 months ago

OKay, if the repo is up to date, I’ll pull and check this out.

Thanks, Ryan On Feb 28, 2024 at 4:41 PM -0500, anschelburk @.***>, wrote:

Also - got an error (screenshot below) when I tried to put some streamlit commands (like headers or subheaders) into functions. Still trying to figure out how to stop variables from resetting, hoping this screenshot can be helpful for our conversation tomorrow. image.png (view on web) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>