Skip to content

Instantly share code, notes, and snippets.

@cfbarbero
Last active October 30, 2018 19:19
Show Gist options
  • Save cfbarbero/c689b71d78908b138552d7963866771b to your computer and use it in GitHub Desktop.
Save cfbarbero/c689b71d78908b138552d7963866771b to your computer and use it in GitHub Desktop.
SetupTools Tips

Install some dependencies only in certain scenarios

$pip install -e .[development]
# from setuptools.py
setup(
		extras_require = dict(
				development = [
						'pytest-runner',
						'coverage',
						'pytest',
						'pytest-cov',
						'pytest-spec',
						'pytest-flakes',
					],
))

Only install pytest when running tests

# make pytest-runner a conditional requirement,
# per: https://github.com/pytest-dev/pytest-runner#considerations
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment