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 supports Monica
  • 38,813
  • 14
  • 65
  • 113

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
  • 69,888
  • 11
  • 97
  • 133
  • excellent. can you explain or point to a link discussing the difference between `polygonselector/notebooks *` and `polygonselector/notebooks/*` in MANIFEST.in? – Rick supports Monica 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