======Python Project Setup====== How to create a project suitable for PyPI * https://python-packaging.readthedocs.io/en/latest/minimal.html [[https://amir.rachum.com/blog/2017/07/28/python-entry-points/|How to create a command line version of your python script]] **DONT USE python setup.py install**, use **"pip install ."**. Otherwise console scripts do not work. ====You need a MANIFEST.in file!!==== Manifest.in needs to include requirements.txt for it to get added into the distribution. Add this line: include requirements.txt ====setup.py example===== """ setup.py -- setup script for use of packages. """ import sys import os from os import path from setuptools import setup # Restrict to a fairly recent python version if sys.version_info < (3,6): sys.exit('Sorry, Python < 3.6 is not supported') # Get the list of requirements #with open('/Users/jrichards/Projects/jrtools/requirements.txt') as f: with open('requirements.txt') as f: requirements = f.read().splitlines() # Not using 'packages=find_namespace_packages(include=['jrtools.*'])', # but instead 'packages=['jrtools.flux_densities', 'jrtools.quick_chart']'. # The reason is that setuptools.find_namespace_packages is not available # on some pthon distributions. Listing them all manually is better anyway. setup( name='jrtools', packages=['jrtools.flux_densities', 'jrtools.quick_chart'], version='1.0', install_requires=requirements, entry_points={ 'console_scripts': [ 'flux_densities=jrtools.flux_densities:main', ], }, url='https://github.com/jrseti/jrtools', license='MIT', author='Jon Richards', author_email='jrseti@gmail.com', description='Various Python tools and applications by Jon Richards, jrseti@gmail.com', test_suite='nose.collector', tests_require=['nose'] ) ====Sample tox.ini file==== # tox (https://tox.readthedocs.io/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. [tox] envlist = py37 [testenv] deps = pytest commands = pytest