tox.ini 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Tox configuration file
  2. # Read more under https://tox.wiki/
  3. # THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!
  4. [tox]
  5. minversion = 3.24
  6. envlist = default
  7. isolated_build = True
  8. [testenv]
  9. description = Invoke pytest to run automated tests
  10. setenv =
  11. TOXINIDIR = {toxinidir}
  12. passenv =
  13. HOME
  14. SETUPTOOLS_*
  15. extras =
  16. testing
  17. commands =
  18. pytest {posargs}
  19. # # To run `tox -e lint` you need to make sure you have a
  20. # # `.pre-commit-config.yaml` file. See https://pre-commit.com
  21. # [testenv:lint]
  22. # description = Perform static analysis and style checks
  23. # skip_install = True
  24. # deps = pre-commit
  25. # passenv =
  26. # HOMEPATH
  27. # PROGRAMDATA
  28. # SETUPTOOLS_*
  29. # commands =
  30. # pre-commit run --all-files {posargs:--show-diff-on-failure}
  31. [testenv:{build,clean}]
  32. description =
  33. build: Build the package in isolation according to PEP517, see https://github.com/pypa/build
  34. clean: Remove old distribution files and temporary build artifacts (./build and ./dist)
  35. # https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it
  36. skip_install = True
  37. changedir = {toxinidir}
  38. deps =
  39. build: build[virtualenv]
  40. passenv =
  41. SETUPTOOLS_*
  42. commands =
  43. clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]'
  44. clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]'
  45. build: python -m build {posargs}
  46. # By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want
  47. # to make it available, consider running: `tox -e build -- --wheel`
  48. [testenv:{docs,doctests,linkcheck}]
  49. description =
  50. docs: Invoke sphinx-build to build the docs
  51. doctests: Invoke sphinx-build to run doctests
  52. linkcheck: Check for broken links in the documentation
  53. passenv =
  54. SETUPTOOLS_*
  55. setenv =
  56. DOCSDIR = {toxinidir}/docs
  57. BUILDDIR = {toxinidir}/docs/_build
  58. docs: BUILD = html
  59. doctests: BUILD = doctest
  60. linkcheck: BUILD = linkcheck
  61. deps =
  62. -r {toxinidir}/docs/requirements.txt
  63. # ^ requirements.txt shared with Read The Docs
  64. commands =
  65. sphinx-build --color -b {env:BUILD} -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/{env:BUILD}" {posargs}
  66. [testenv:publish]
  67. description =
  68. Publish the package you have been developing to a package index server.
  69. By default, it uses testpypi. If you really want to publish your package
  70. to be publicly accessible in PyPI, use the `-- --repository pypi` option.
  71. skip_install = True
  72. changedir = {toxinidir}
  73. passenv =
  74. # See: https://twine.readthedocs.io/en/latest/
  75. TWINE_USERNAME
  76. TWINE_PASSWORD
  77. TWINE_REPOSITORY
  78. TWINE_REPOSITORY_URL
  79. deps = twine
  80. commands =
  81. python -m twine check dist/*
  82. python -m twine upload {posargs:--repository {env:TWINE_REPOSITORY:testpypi}} dist/*