I followed this article to create a python package.
https://packaging.python.org/tutorials/packaging-projects/
I created a new project and set up a new virtual environment. Instead of uploading it to pip and installing it from there i installed it from my local file system with:
python -m pip install path/to/.whl
retrieving the message: Installing collected packages: alexs-utils Successfully installed alexs-utils
I am not able to import my function from my_utils
This is my setup.py:
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="alexs_utils",
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/my_utils",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
py_modules=['my_utils']
)
This is my my_utils.py:
def foo():
print('bar')
This is my init.py:
name = "example_pkg"