我的项目结构应该是什么才能在 PyPi 上分发个人 python 包?

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

我正在尝试通过 PyPi 分发个人 python 包。虽然 pip 安装成功,但当我在本地导入 PythonDebuggerTools 时出现 ModuleNotFound 错误。

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=[],
)

我的项目结构如下所示:


>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~

=======

如有任何帮助,我们将不胜感激!

py_modules=['PythonDebuggerTools'],

用于 *.py 个文件。没有 PythonDebuggerTools.py 所以没有添加到 wheel 包中。

您的 PythonDebuggerTools 是一个可导入的目录,因此将其声明为一个包:

packages=['PythonDebuggerTools'],

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