Asdoost
Asdoost

Reputation: 394

The data folder doesn't included when I upload my package to pypi?

I created a package and I wanted to upload it to pypi. The structure of files is like this:

AAA
├── AAA
│   ├── AAA.py
│   ├── BBB.py
│   ├── CCC.py
│   ├── __init__.py
│   └── DDD.py
│
├── data
│   ├── table2.json
│   └── table2.json
│
├── LICENSE.txt
├── README.md
└── setup.py

I used python3 setup.py sdist and twine upload dist/* to upload the package into pypi. But when I installed my own package there was not any data folder. I came back to dist folder but again there was not any data folder in the AAA.tar.gz.

I'm confused what am I doing wrong?

Upvotes: 1

Views: 568

Answers (1)

Asdoost
Asdoost

Reputation: 394

I used the following page suggested by @Gonzalo Odiard:

https://docs.python.org/3/distutils/setupscript.html#installing-package-data

First, I moved data folder to AAA folder and then I added package_dir={'AAA': 'AAA'} to setup.py and the problem was solved.

Upvotes: 1

Related Questions