def xdoctest(session: Session) -> None: """Run examples with xdoctest.""" args = session.posargs or ["all"] session.run("poetry", "install", "--no-dev", external=True) session.install("xdoctest") session.run("python", "-m", "xdoctest", package, *args)
def black(session: Session) -> None: """Run black code formatter.""" args = session.posargs or locations session.install("black") session.run("black", *args)
def pytype(session: Session) -> None: """Run the static type checker using pytype.""" args = session.posargs or ["--disable=import-error", *locations] session.install("pytype") session.run("pytype", *args)
def tests(session: Session) -> None: """Run the test suite with pytest.""" print('CWD', os.getcwd()) session.install("-v", "--no-index", f"--find-links={Path('..', 'dist')}", "prql_python") session.install("-v", "-r", "requirements.txt") session.run("pytest", str(Path("python", "tests")))
def mypy(session: Session) -> None: """Type-check using mypy.""" session.install(".") install_with_constraints(session, "invoke", "mypy") session.run("inv", "mypy")
def publish_release(session: Session) -> None: """Publish a GitHub release.""" args = [f"--owner={owner}", f"--repository={repository}", *session.posargs] session.install("click", "github3.py") session.run("python", "tools/publish-github-release.py", *args, external=True)
def typeguard(session: Session) -> None: """Runtime type checking using Typeguard.""" session.install(".") session.install("pytest", "typeguard", "pygments", "pytest-asyncio", "aioresponses") session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
def pydocstyle(session: Session) -> None: """Check docstrings.""" session.install("pydocstyle") session.run("pydocstyle")
def isort(session: Session) -> None: """Run isort formatter.""" # TODO: remove args = session.posargs or locations session.install("isort") session.run("isort", *args)
def black(session: Session) -> None: """Check black.""" session.install("black==19.3b0") session.run("black", "--check", ".")
def mypy(session: Session) -> None: """Check mypy.""" session.install("mypy") session.run("mypy", ".")
def test_patch(session: Session) -> None: """It patches Session.install.""" import nox_poetry.patch # noqa: F401 Session.install(session, ".")
def apply_format(session: Session) -> None: """Apply formating rules to the selected files.""" session.install(*form_requirements) session.run("i", "-l", "79", *python_files, silent=False) session.run("isort", "-rc", *python_files, silent=False)
def docs(session: Session) -> None: """Build the documentation.""" session.run("poetry", "install", "--no-dev", external=True) session.install("sphinx", "sphinx_autodoc_typehints") session.run("sphinx-build", "docs", "docs/_build")
def coverage(session: Session) -> None: """Upload coverage data.""" session.install("coverage[toml]", "codecov") session.run("coverage", "xml", "--fail-under=0") session.run("codecov", *session.posargs)
def types(session: Session) -> None: args = session.posargs or locations session.install("mypy") session.run("mypy", *args)
def black(session: Session) -> None: args = session.posargs or locations session.install("black", "blackdoc") session.run("black", *args) session.run("blackdoc", *args)
def safety(session: Session) -> None: session.install("safety") session.run("safety", "check", "--file=requirements.txt", "--full-report")
def tests(session: Session) -> None: """Run tests.""" args = session.posargs + ["--cov=morfeus", "--import-mode=importlib", "-s"] session.install("pytest", "pytest-cov") session.install(".") session.run("pytest", *args)
def requirements(session: Session) -> None: args = session.posargs or ["-o", "requirements.txt", "requirements.in"] session.install("pip-tools") session.run("pip-compile", *args)
def safety(session: Session) -> None: """Scan dependencies for insecure packages.""" requirements = nox_poetry.export_requirements(session) session.install("safety") session.run("safety", "check", f"--file={requirements}", "--bare")
def changelog(session: Session) -> None: args = session.posargs or ["--unreleased"] session.install("auto-changelog") session.run("auto-changelog", *args)
def mypy(session: Session) -> None: """Nox session for running static type analysis.""" args = session.posargs or locations session.install("mypy") session.run("mypy", *args)
def docs_deploy(session: Session) -> None: """Deploy the documentation on Github Pages.""" args = session.posargs session.install("-r", "docs/requirements.txt") session.run("mkdocs", "gh-deploy", *args)
def contract_tests(session: Session) -> None: """Run the contract_test suite.""" args = session.posargs session.install(".", "pytest", "pytest-docker") session.run("pytest", "-m contract", *args)
def generate_news(session: Session, version: str) -> None: session.install("towncrier") session.run("towncrier", "--yes", "--version", version, silent=True)
def mypy(session: Session) -> None: """Type-check using mypy.""" args = session.posargs or locations session.install("mypy") session.run("mypy", *args)
def tests(session: Session) -> None: session.install(".") session.install("pytest", "coverage[toml]", "hypothesis", "pytest-cov") session.run("poetry", "install", external=True) session.run("pytest", "--cov")
def xdoctest(session: Session) -> None: """Run examples with xdoctest.""" args = session.posargs or ["all"] session.install(".", "xdoctest") session.run("python", "-m", "xdoctest", package, *args)
def typeguard(session: Session) -> None: """Runtime type checking using Typeguard.""" session.install(".") session.install("pytest", "typeguard", "pygments", "requests_mock") session.run("pytest", f"--typeguard-packages={package}", *session.posargs)