How to not lose shell and python repl history

I am using a hacker package and my repl is always on. My python shell is killed fairly frequently (on order of hours) and shell history is lost, as is Python repl history. How can I get the shell history to persist? This is a deal breaker for me.