如何在PyPi的程序包中包含csv文件?

This is the first time I'm creating a python package. I follow all the instructions in this text, which was very well written and I was able to replicate every step without any issue.

因此,我创建了一个具有以下结构的本地目录:

mypackage/
    mypackage/
        __init__.py
        mypackage.py
    LICENSE.txt
    README.md
    setup.cfg
    setup.py

接下来,我按照以下步骤操作:

  1. Push the directory to github
  2. Create a new release
  3. Update setup.py file
  4. run python setup.py sdist
  5. run twine upload dist/*

And proceed to install my package using pip. It works finely

但是,当我尝试导入它时,出现以下错误:

FileNotFoundError: [Errno 2] File counties_1872_1991.csv does not exist: 'counties_1872_1991.csv'

Then I search for a while and found this two questions (here and here). Folowing the instructions in the answers to each question, I did:

  1. Create a MANIFEST.in file and add the line include counties_1872_1991.csv
  2. Edit the setup.py file and add package_data={'cartpy': ['counties_1872_1991.csv']},include_package_data=True to the function setup

不幸的是,这对我没有用,在这里我不能说我做错了什么。我以为是与绝对路径和相对路径有关的东西,然后我尝试了每种可能的组合,但也没有用。

如何在包中包含csv文件?