I like your suggestion of importing the code from Python files into the notebook, which will prevent the notebook from being messy. Sometimes I do that as well. I have added it to the conclusion of the article.
Could you be more specific about ignoring other possibilities to work with the code you write? You mean not to mention the tools like MLFlow or Hydra.cc?