Search code examples
pythonpython-3.xlibrariespypi

Cant import my newly created python package (Module not found)


So I recently developed my first python library, but I tried downloading from pip the package while testing, but even though the download was successful, I couldn't import it.

Setup.py:

from setuptools import find_packages, setup
import pathlib

README = (pathlib.Path(__file__).parent / "README.md").read_text(encoding='utf8')

setup(
    name='pretty-downloader',
    packages=find_packages(),
    version='0.0.4',
    description='This is a simple python pretty downloader for your projects.',
    long_description=README,
    long_description_content_type='text/markdown',
    author='DeadSec-Security',
    author_email='amng835@gmail.com',
    url='https://github.com/DEADSEC-SECURITY/pretty-downloader',
    keywords=[
        'progressbar',
        'downloader',
        'download',
        'console',
        'bar',
        'progress',
        'download-bar'
    ],
    license='MIT',
    install_requires=[
        'tqdm==4.57.0',
        'requests==2.25.1'
    ],
    setup_requires=['pytest-runner'],
    tests_require=['pytest==6.2.2'],
    python_requires='>=3.7'
)

The output from the terminal:

enter image description here

GitHub repo

Pypi repo

Disclaimer: I'm not in any way trying to promote my library. This is a real problem I'm facing since it's my first time developing such a library.


Solution

  • I believe you just need to add an __init__.py file in the pretty_downloader folder with the following contents

    from .pretty_downloader import download