What should my project structure be for distributing a personal python package on PyPi?

Viewed 34

I'm trying to distribute a personal python package over PyPi. While it successfully pip installs, there's a ModuleNotFound error when I go to import PythonDebuggerTools locally.

setup.py

from setuptools import setup, find_packages
import codecs
import os

import setuptools

VERSION = '0.0.3'
DESCRIPTION = 'Debugging tools'
LONG_DESCRIPTION = 'A package that gives users access to several debugging functionality to make their development process efficient.'

# Setting up
setup(
    name='PythonDebuggerTools',
    version=VERSION,
    author='Aakash Haran',
    author_email='email',
    description='Testing installation of Package',
    long_description=LONG_DESCRIPTION,
    long_description_content_type="text/markdown",
    url='https://github.com/Luna-Cake/Logger',
    license='MIT',
    # packages=setuptools.find_packages(),
    py_modules=['PythonDebuggerTools'],
    install_requires=[],
)

My project structure looks like this:


>build
>dist
    >PythonDebuggerTools-0.0.3.tar.gz
>PythonDebuggerTools
    >__init__.py
    >logger.py
>PythonDebuggerTools.egg-info
    >dependency_links.txt
    >PKG-INFO
    >SOURCES.txt
    >top_level.txt
>README.md
>setup.py
>setup.py~

=======

Any help would be greatly appreciated!

1 Answers
py_modules=['PythonDebuggerTools'],

is for *.py files. There is no PythonDebuggerTools.py so nothing was added to the wheel package.

Your PythonDebuggerTools is an importably directory so declare it as a packge:

packages=['PythonDebuggerTools'],

See https://packaging.python.org/tutorials/packaging-projects/

Related