I added the src/sample/run.py
below to the sampleproject. It runs locally (prints "add_one(2) = 3"), but deployed pip version fails:
virtualenv venv
source venv/bin/activate
pip install -i https://test.pypi.org/simple/ sampleproject-valhuber
sample-run
ModuleNotFoundError: No module named 'simple'
Here is src/sample/run.py
:
import simple # FAILS in PyPi: ModuleNotFoundError...
def main():
print("add_one(2) = " + str(simple.add_one(2)))
if __name__ == '__main__':
main()
The complete code, along with packaging procedure is on this GitHub project.
Your simple.py
is inside sample
package. You have to import it from the package:
import sample.simple
or
from sample import simple