tox.ini 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Tox configuration file
  2. # Read more under https://tox.readthedocs.org/
  3. # THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!
  4. [tox]
  5. minversion = 3.15
  6. envlist = default
  7. [testenv]
  8. description = invoke pytest to run automated tests
  9. isolated_build = True
  10. setenv =
  11. TOXINIDIR = {toxinidir}
  12. passenv =
  13. HOME
  14. extras =
  15. testing
  16. commands =
  17. pytest {posargs}
  18. [testenv:{clean,build}]
  19. description =
  20. Build (or clean) the package in isolation according to instructions in:
  21. https://setuptools.readthedocs.io/en/latest/build_meta.html#how-to-use-it
  22. https://github.com/pypa/pep517/issues/91
  23. https://github.com/pypa/build
  24. # NOTE: build is still experimental, please refer to the links for updates/issues
  25. skip_install = True
  26. changedir = {toxinidir}
  27. deps =
  28. build: build[virtualenv]
  29. commands =
  30. clean: python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)'
  31. build: python -m build .
  32. # By default `build` produces wheels, you can also explicitly use the flags `--sdist` and `--wheel`
  33. [testenv:{docs,doctests}]
  34. description = invoke sphinx-build to build the docs/run doctests
  35. setenv =
  36. DOCSDIR = {toxinidir}/docs
  37. BUILDDIR = {toxinidir}/docs/_build
  38. docs: BUILD = html
  39. doctests: BUILD = doctest
  40. deps =
  41. -r {toxinidir}/docs/requirements.txt
  42. # ^ requirements.txt shared with Read The Docs
  43. commands =
  44. sphinx-build -b {env:BUILD} -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/{env:BUILD}" {posargs}
  45. [testenv:publish]
  46. description =
  47. Publish the package you have been developing to a package index server.
  48. By default, it uses testpypi. If you really want to publish your package
  49. to be publicly accessible in PyPI, use the `-- --repository pypi` option.
  50. skip_install = True
  51. changedir = {toxinidir}
  52. passenv =
  53. TWINE_USERNAME
  54. TWINE_PASSWORD
  55. TWINE_REPOSITORY
  56. deps = twine
  57. commands =
  58. python -m twine check dist/*
  59. python -m twine upload {posargs:--repository testpypi} dist/*