Best practices for turning a PyScaffold script into a modularized project #736
Replies: 2 comments
-
Hi @wpd , Maybe this helps clearing some of your questions. |
Beta Was this translation helpful? Give feedback.
-
Closing this out. Blame it on brain fog. Blame it on hacking late at night. Blame it on relying on "it works when I run it in VSCode, but not when I install it on another computer/virtual environment". Blame it on poor note taking. Of course, the correct answer (as @Zaloog implement in the terminal kanban app) is to:
and that works. |
Beta Was this translation helpful? Give feedback.
-
I view PyScaffold as a demonstration of the best practices which should be followed when developing a Python application.
I wonder if you could provide any advice, (or perhaps change the Fibonacci example) that demonstrates the best practices as taught in a Python masters class regarding developing a script based application that is divided into modules.
I have found https://stackoverflow.com/questions/16981921/relative-imports-in-python-3, https://stackoverflow.com/questions/30669474/beyond-top-level-package-error-in-relative-import, and https://stackoverflow.com/questions/14132789/relative-imports-for-the-billionth-time, but am at an impasse regarding the best way to change the Fibonacci example into a script based application that divides its work into modules.
A very naive approach would be to move the
fib()
function into its own module and to add:to the top of
skeleton.py
. And that works fine when performing simple tests such as:But, when I modify
setup.cfg
to installfibonacci
as aconsole_script
, and try to distribute that simple application as a wheel (tox -e build; pip install wheel
), thefibonacci
script fails to import the function from the module.As I researched, this, I learned that this is a fairly common and complex issue. Perhaps there is no "Best Practice" to follow. But, if there is, I expect you PyScaffold developers would know it, and it would be nice if the documentation or example application could show that best practice.
So, I figured I'd ask.
--wpd
Beta Was this translation helpful? Give feedback.
All reactions