简体   繁体   中英

Trouble including sub-directory files in site-packages

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM