Reputation: 6029
My package tree looks like this: (with a few more irrelevant files)
- setup.py
- MANIFEST.in
- mydir
|
- file.py
- file.json
setup.py:
from distutils.core import setup
setup(
name = 'mydir',
packages = ['mydir'],
version = '1.2.2',
description = 'desc',
author = 'my name',
author_email = '[email protected]',
url = 'https://github.com/myname/mydir',
download_url = 'https://github.com/myname/mydir/archive/1.2.2.tar.gz',
keywords = ['key1', 'key2'],
classifiers = [],
)
When the MANIFEST.in
file was empty, the json wasn't included in the dist file.
So I've added the json file to the MANIFEST.in
so now it contains only:
include mydir/file.json
When I execute the python setup.py sdist
command, the auto generated MANIFEST
file contains all the necessary files, including file.json
.
However, as I try to install my package using pip
, I get the following error:
error: can't copy 'file.json': doesn't exist or not a regular file
Upvotes: 2
Views: 4185
Reputation: 6029
Got it.
Changed setup.py
to use from setuptools import setup, find_packages
instead of distutils.core
Also added include_package_data = True,
to setup.py
:
setup(
...
include_package_data = True,
...
)
together with the include in the MANIFEST.in
, the json file was extracted to the target dir as expected.
Upvotes: 5