I am new to this packaging, and facing now a problem. The problem is as follows. I have created a poetry project from the CLI:
poetry new mypackage_test
and have a file structure as follows:
here both my init.py are empty
pyproject.toml
[tool.poetry]
name = "mypackage-test"
version = "0.1.0"
description = ""
authors = ["my name <my@name.com>"]
readme = "README.md"
packages = [{include = "mypackage_test"}]
[tool.poetry.dependencies]
python = "^3.10"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
helloWorld.py
from pk1 import mypack
def helloworld():
print("hello world")
print(mypack.printMypk1())
if __name__ == "__main__":
helloworld()
mypack.py
def printMypk1():
print("in mypackage 1")
when I run this code eg.:
python helloWorld()
then it works as expected, but if i install this as a package and du this in python:
>>> from mypackage_test import helloWorld
i get this error:
Traceback (most recent call last): File "", line 1, in File "C:\Programs\Python\Python3102\lib\site-packages\mypackage_test\helloWorld.py", line 1, in from pk1 import mypack ModuleNotFoundError: No module named 'pk1'
am i doing this wrong? any suggestion ?
Note: if i unzip the ziped file in the dist folder then i can see that the files are packed/ziped as expected