سؤال

I've created some small and simple python package and uploaded it to the PYPI.
When I install my package using pip install, everything works fine,
but the python source files are not extracted, the installed-files.txt file does not include it.
SOURCES.txt DOES include the python source file.
Only __init__.py file is extracted.

I can not understand what is wrong with my package or the way I create it.
Please advice....

My package name is test_pypi
You can find it here: https://pypi.python.org/pypi/test_pypi
Package has no requirements

Package folder contains following files:

  • __init__.py - empty file

  • LICENSE.txt - contains Apache license

  • MANIFEST.in

    include READMT.rst  
    include LICENSE.txt  
    recursive-include test_pypi/mdl *.py
    
  • setup.py

    from setuptools import setup
    
    def readme():
    with open('README.rst') as f:
            return f.read()
    
    setup(name='test_pypi',
        version='1.0',
        description='test_pypi_description',
        url='https://pypi.python.org/pypi/test_pypi',
        license='LICENSE.txt',
        author='Evgeny Fedoruk',
        author_email='minievg@hotmail.com',
        packages=['test_pypi'],
        install_requires=[],
        zip_safe=False)  
    

The package folder (test_pypi) contains:

  • __init__.py - empty file

  • mdl (folder) contains

    • empty __init__.py file

    • python source file test.py

      print 'hello'
      

I do the following for uploading the package:

python setup.py register sdist upload

I do the following for installing it:

pip install test_pypi

One last thing, I tried installing it with virtual env and without it - same problem, the test.py file is not extracted

هل كانت مفيدة؟

المحلول

You need to include mdl in your packages argument to setup():

packages=['test_pypi','test_pypi.mdl'],

Packages you want to include must either be explicitly listed, or you can have setuptools find them using find_packages() :

from setuptools import find_packages
my_packages=find_packages()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top