Search code examples
pythondjangopippython-wheel

pip wheel created without any python sub-packages


operating system and version

Ubuntu 18.04 VM hosted by WIN10

Python version

Python 2.7.15rc1

version of pip

pip 18.0

description

*I'm trying to package Django project and wheel created but without any python sub-packages

what i'm missing please ?? *

Folder structure

zoharngo@zoharngo-VirtualBox:~/todobackend$ tree -L 4

.

├── manage.py

├── setup.py

└── todobackend

    ├── __init__.py
    ├── todo
    │   ├── admin.py
    │   ├── apps.py
    │   ├── __init__.py
    │   ├── migrations
    │   │   ├── 0001_initial.py
    │   │   └── __init__.py
    │   ├── models.py
    │   ├── serializers.py
    │   ├── tests.py
    │   ├── urls.py
    │   └── views.py
    └── todobackend
        ├── __init__.py
        ├── settings
        │   ├── base.py
        │   ├── __init__.py
        │   ├── release.py
        │   └── test.py
        ├── urls.py
        └── wsgi.py

setup.py

from setuptools import setup, find_packages
setup(
name                 = "todobackend",
version              = "0.1.0",
description          = "TodoBackend Djnago REST service",
package              = find_packages(),
include_package_data = True,
scripts              = ["manage.py"],
install_requires     = ["Django>=1.9,<2.0",
                        "django-cors-headers>=2.4.0",
                        "djangorestframework>=3.8.2",
                        "MySQL-python>=1.2.5",
                        "uwsgi>=2.0"
                        ],
 extras_require     =   {
                            "test": [
                                "colorama>=0.3.9",
                                "coverage>=4.5.1",
                                "django-nose>=1.4.5",
                                "nose>=1.3.7",
                                "pinocchio>=0.4.2"
                            ]
                        }

)


Solution

  • As far as I know, the only wheel will be your package, the others will be downloaded when setup.py is run. If you want to create an artefact that requires no downloading it is possible to do the following (this assumes a virtualenv in the folder venv):

    venv/bin/pip download --dest wheels/ --no-cache-dir .
    venv/bin/python setup.py sdist --dist-dir="wheels"
    tar -czvf dist/artefact.tar.gz wheels/
    

    You can reunpack this artefact into a venv without downloading anything using

    tar -xzf artefact.tar.gz
    virtualenv --no-download venv
    venv/bin/pip install --force-reinstall --no-index --no-cache-dir --find-links=./wheels/ todobackend