python_setup
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python_setup [2019/12/20 17:03] – jrseti | python_setup [2019/12/28 19:19] (current) – [Sample tox.ini file] jrseti | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| [[https:// | [[https:// | ||
| + | |||
| + | **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(' | ||
| + | |||
| + | # Get the list of requirements | ||
| + | #with open('/ | ||
| + | with open(' | ||
| + | requirements = f.read().splitlines() | ||
| + | |||
| + | # Not using ' | ||
| + | # but instead ' | ||
| + | # The reason is that setuptools.find_namespace_packages is not available | ||
| + | # on some pthon distributions. Listing them all manually is better anyway. | ||
| + | setup( | ||
| + | name=' | ||
| + | packages=[' | ||
| + | version=' | ||
| + | install_requires=requirements, | ||
| + | entry_points={ | ||
| + | ' | ||
| + | ' | ||
| + | ], | ||
| + | }, | ||
| + | url=' | ||
| + | license=' | ||
| + | author=' | ||
| + | author_email=' | ||
| + | description=' | ||
| + | test_suite=' | ||
| + | tests_require=[' | ||
| + | ) | ||
| + | </ | ||
| + | |||
| + | ====Sample tox.ini file==== | ||
| + | |||
| + | # tox (https:// | ||
| + | # 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] | ||
| + | envlist = py37 | ||
| + | | ||
| + | [testenv] | ||
| + | deps = pytest | ||
| + | commands = pytest | ||
python_setup.1576861407.txt.gz · Last modified: 2019/12/20 17:03 by jrseti