0

I have a development package set up like the following:

\polygonselector
    \polygonselector
        __init__.py
        \notebooks
            PolygonSelector.ipynb
    .gitignore
    LICENSE
    MANIFEST.in
    README.md
    setup.py

I am attempting to closely follow these instructions and the information in this question and this question in order to include a Jupyter notebook (inside the notebooks directory) file as part of a python package. However, I haven't been able to succeed.

The MANIFEST.in file looks like this:

recursive-include  notebooks *

I also have the include_package_data=True line in my setup.py file.

Here is the repository link; I've already made a dozen commits trying to get this to work, including trying to have the notebooks directory at the top of the directory structure.

But no matter what I do, when I pip install from the repository, the notebooks directory is not included in the Lib\site-packages directory.

Rick
  • 43,029
  • 15
  • 76
  • 119
  • add this in manifest file `recursive-include polygonselector/notebooks/* ` start from the directory level same as manifest.in – sahasrara62 May 13 '19 at 21:48
  • @pashantrana I believe that structure has already been tried as one of the previous commits. I'll try it later though. – Rick May 13 '19 at 22:31
  • Do you want subdirectory `notebooks` installed in `Lib\site-packages` or in `Lib\site-packages\polygonselector`? – phd May 13 '19 at 23:13
  • @phd I'd like to know how to accomplish both but I think I'd prefer it to be under `polygonselector` for this project – Rick May 13 '19 at 23:48
  • @prashantrana the line you provided doesn't seem to work, however this does...: `polygonselector/notebooks *` but i don't really understand the difference. – Rick May 14 '19 at 02:13
  • 1
    @RickTeachey you can try `recursive-include polygonselector/notebooks/*.*` instead of `recursive-include polygonselector/notebooks/*` – sahasrara62 May 14 '19 at 07:19
  • @prashantrana ah ha, i did NOT try that one yet and i bet you are correct. – Rick May 14 '19 at 14:14

1 Answers1

1

If you want subdirectory notebooks installed in Lib\site-packages:

Change MANIFEST.in:

recursive-include notebooks *

Change setup.py:

# include_package_data=True,
package_data={'polygonselector': ['../notebooks/*']},

To install into Lib\site-packages\polygonselector:

git mv notebooks polygonselector

Change MANIFEST.in:

recursive-include polygonselector/notebooks *

setup.py for this case is ok.

phd
  • 82,685
  • 13
  • 120
  • 165
  • excellent. can you explain or point to a link discussing the difference between `polygonselector/notebooks *` and `polygonselector/notebooks/*` in MANIFEST.in? – Rick May 14 '19 at 02:11
  • 1
    I don't know one. And I don't think syntax `polygonselector/notebooks/*` is valid. The syntax is [`recursive-include directory patterns`](https://docs.python.org/3/distutils/commandref.html#sdist-cmd). – phd May 14 '19 at 10:35