Hi, first of all thanks for building the tutorial!
When trying to build my first package with it, I ran into a problem which I wanted to report.
In setup.py the line from my_pip_package import __version__ can cause a problem, as it imports part of the package before the package dependencies are installed. For me this lead to a ModuleNotFoundError as I import my package modules into the _init.py_ file and those modules import my dependencies.
To solve this issue I would therefore suggest this solution from stack overflow:
- in setup.py: remove
from my_pip_package import __version__ from and instead sepecify the version number directly setup(..., version="X.X",)
- in init.py: replace
__version__ = 'X.X' with
from importlib import metadata
__version__ = metadata.version('my_pip_package')
No guarantee, that I am right here, but this finally solved my issue after several hours of looking elsewhere.
Hi, first of all thanks for building the tutorial!
When trying to build my first package with it, I ran into a problem which I wanted to report.
In setup.py the line
from my_pip_package import __version__can cause a problem, as it imports part of the package before the package dependencies are installed. For me this lead to a ModuleNotFoundError as I import my package modules into the _init.py_ file and those modules import my dependencies.To solve this issue I would therefore suggest this solution from stack overflow:
from my_pip_package import __version__from and instead sepecify the version number directlysetup(..., version="X.X",)__version__ = 'X.X'withNo guarantee, that I am right here, but this finally solved my issue after several hours of looking elsewhere.