0

I have two packages, main_package and sub_package. Both have been packaged into wheel files. I want to bundle sub_package into main_package so that while installing main_package, sub_package also gets installed.

my setup.py file looks like this

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="main-package",
    version="0.0.1",
    author="author",
    author_email="author@example.com",
    description="Package 1",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/pypa/sampleproject",
    packages=setuptools.find_packages()
    install_requires=[
        'sub_package'
    ],
    include_package_data=True
)

How do I add sub_package to main_package so that when I do pip install main_package.whl , sub_package also gets installed?

  • [This](https://stackoverflow.com/q/56676206/5028532) might be relevant. – razdi Jul 31 '19 at 02:46
  • @razdi I looked at that and added a requirements file in my main_package and specified the path for my sub_package. But somehow when I run pip install -r requirements.txt main_package.whl , it does not find the requirements.txt file – Roshan Joe Vincent Jul 31 '19 at 14:43
  • 1
    You can also [vendor](https://stackoverflow.com/questions/18812614/embedding-a-python-library-in-my-own-package) a copy of your sub package in your main package. Or you can give your `pip install main_package` instruction a parameter [`--find-links`](https://pip.pypa.io/en/stable/reference/pip_wheel/#cmdoption-f) which points to the directory where the sub-package lies. – Arne Aug 02 '19 at 14:59

0 Answers0