This post will just be a how-to on creating a whl file.
You need the following files:
Manifest.in:
recursive-include <directory> * recursive-exclude tests *.py
Requirements.txt:
This file just holds your packages and the version.
Setup.py
You remove pytest and coverage from your whl file because you don’t want those applications being required when you deploy your code.
from setuptools import find_packages from distutils.core import setup import os import json if os.path.exists('requirements.txt'): req = [line.strip('\n') for line in open('requirements.txt') if 'pytest' not in line and 'coverage' not in line] setup( include_package_data=True, name=<app_name>, version=<app-version>, description=<app_desc>, install_requires=req, packages=find_packages(excude=["*tests.*","*tests"]), classifiers=[ "Programming Language :: Python || <python_Version>", "License || OSI Approved :: MIT License", "Operating System :: OS Independent", ], python_requires='>=<python_version>', package_dir={<directory>: <directory>}, )
To Check Your Whl File
Install package
pip install check-wheel-contents
Check WHL
check-wheel-contents <PATH_TO_WHL>\<filename>.whl
Install WHL
This will deploy to <PATH_TO_PYTHON>\Lib\site-packages\<directory>
<PATH_TO_PYTHON>\Scripts\pip3.7.exe install <PATH_TO_WHL>\<filename>.whl