I have the following directory structure:
foo/
└── setup.py
└── src/
└── bar.py
└── __init__.py
Here I am trying to install the package src under the name foo.
My setup.py looks like this:
from setuptools import setup, find_packages
setup(
name='foo',
version='0.0.1',
packages = find_packages(where='src'),
package_dir = {'foo': 'src'},
python_requires='>=3.8')
I installed the package using pip install -e . from the directory foo. When I try import foo or import foo.bar, I get a ModuleNotFoundError but import src works. How do I modify setup.py, so that import foo works?
Some additional information:
here is my __init__.py:
from foo import bar
and bar.py
def bar():
return "bar"