Fix ModuleNotFoundError
when using wheel
#4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Installing the wheel and then running the
polymidiexport
executable leads to aModuleNotFound
error:The root cause of this error is a feature mismatch in the build system.
While setuptools is built around Python packages, the
polytracker2midi.py
file is actually just a Python script (and module) but not a package. Therefore,setuptools
ignores that file and its sibling,polytracker2text.py
. The wheel is then published to PyPI without those modules.To work around the issue, convert both files to packages. That way, they can still be invoked via
python
(you just have to drop the.py
), and setuptools will pick them up as packages and include them in the wheel.(Note: an alternative solution would have been to switch to a different build system, e.g. Poetry, which supports single-file scripts and includes them in wheels as if they were packages. However, switching to Poetry would involve converting
setup.py
to apyproject.toml
file, an effort probably not worth the hassle, given that setuptools has worked just fine for this project so far.)