1

Given a Python package with the following structure.

enter image description here

Installed it with pip

pip install --upgrade git+git://github.com/balandongiv/driving_tools.git

The installed directory looks as below

enter image description here

As shown in figure above, the subfolder sub_file and the nickname_override.py are missing in the installation folder.

May I know what modification is required to amend this issue.

Modification to be made as per Balaitous

from setuptools import setup,find_packages

setup(name='ppackage',
    version='0.0.111',
    description='make life easier',
    author='testx',
    packages=['ppackage','ppackage.sub_file'],
)
mpx
  • 3,081
  • 2
  • 26
  • 56
  • Check gitignore. One more way. Right button of mouse and click Add from Git submenu – Andy Pavlov Jun 19 '21 at 14:35
  • Hi @AndyPavlov, May I know check for what specifically, thanks – mpx Jun 19 '21 at 14:38
  • Please list your gitignore. Any way. Try to make any change at nickname_override.py and make commit from pycharm. Do you see any changes at commit/push window of pycharm? – Andy Pavlov Jun 19 '21 at 15:50

1 Answers1

3

In packages argument of setup fonction, all modules have to be explicitly mentioned. Module can be a python file or a folder containing __init__.py.

It is not recursive. Here you have two modules ppackage and ppackage.sub_folder.

See: https://docs.python.org/3/distutils/setupscript.html#listing-whole-packages

So you should have:

setup(
    name=...,
    packages=["ppackage", "ppackage.sub_folder"],
    ...
)

If you want to embed all modules in you package, you can use find_packages

from setuptools import find_packages

setup(
    packages=find_packages(),
    ...
)
Balaïtous
  • 826
  • 6
  • 9
  • Thanks for the effort, but both approach is not working – mpx Jun 19 '21 at 15:25
  • On your screnhot, `setup.py` seems be be in `ppackage` while on github it is at top level. The good place is at toplevel. – Balaïtous Jun 19 '21 at 15:40
  • Hi @Balai, neither suggestion is working, thanks. Have you ever confirm this on your side? – mpx Jun 20 '21 at 05:36
  • After forking to https://github.com/adelplanque/driving_tools seems working. – Balaïtous Jun 20 '21 at 06:55
  • Can you share the screenshot of the installation folder – mpx Jun 20 '21 at 08:09
  • After `pip3 install git+http://github.com:adelplanque/driving_tools.git` into a fresh virtual env, `find env/lib/python3.9/site-packages/ppackage -name "nickname*.py"` result in `env/lib/python3.9/site-packages/ppackage/sub_file/nickname_override.py`. packages list is `["ppackage", "ppackage.sub_file"]`, but `find_packages` should work too. – Balaïtous Jun 20 '21 at 08:21
  • Please share the screenshot, I have tested this on Windows and Ubuntu, but fail to get the output as per your explanation. – mpx Jun 20 '21 at 09:38
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/233980/discussion-between-balaitous-and-balandongiv). – Balaïtous Jun 20 '21 at 09:40