Add Data Files to Python Package


Add Data Files to Python Package using and

Suppose we have a file auth.json for some credentials for the package.

First of all, include this file in your

include hl_42/config/auth.json

To make it work, we have to enable include_package_data in For example, we could write the setup function like this:

from setuptools import setup as _setup

def setup():
    _setup(name = PACKAGE_NAME,
      version = PACKAGE_VERSION,
      description = PACKAGE_DESCRIPTION,
      long_description = PACKAGE_LONG_DESCRIPTION,
      url = PACKAGE_URL,
      author = 'Lei Ma',
      author_email = '[email protected]',
      license = 'MIT',
      packages = _find_packages(exclude=('tests',)),

Published: by ;

Lei Ma (2019). 'Add Data Files to Python Package', Datumorphism, 03 April. Available at:

Table of Contents

Current Ref:

  • til/programming/python/