Exemple #1
0
def black(session: Session) -> None:
    """Run black code formatter."""
    args = session.posargs or locations
    install_with_constraints(session, "black")
    session.run("black", *args)
Exemple #2
0
def docs(session: Session) -> None:
    """Build the documentation."""
    session.run("poetry", "install", "--no-dev", external=True)
    install_with_constraints(session, "sphinx", "sphinx-autodoc-typehints")
    session.run("sphinx-build", "docs", "docs/_build")
Exemple #3
0
def coverage(session: Session) -> None:
    """Upload coverage data."""
    install_with_constraints(session, "coverage[toml]", "codecov")
    session.run("coverage", "xml", "--fail-under=0")
    session.run("codecov", *session.posargs)
Exemple #4
0
 def logic(session: Session) -> None:
     for n, v in os.environ.items():
         session.env[n] = v
     return func(session)
Exemple #5
0
def xdoctest(session: Session) -> None:
    """Run examples with doctest."""
    args = session.posargs or ["all"]
    session.run("poetry", "install", "--no-dev", external=True)
    install_with_constraints(session, "xdoctest")
    session.run("python", "-m", "xdoctest", package, *args)
Exemple #6
0
def pre_commit(session: Session) -> None:
    """Run pre-commit code formatter."""
    args = session.posargs or []
    install_with_constraints(session, "pre_commit ")
    session.run("pre-commit", "run", "--hook-stage", "manual", "-a", *args)
Exemple #7
0
def isort(session: Session) -> None:
    """Run isort code formatter."""
    args = session.posargs or locations
    install_with_constraints(session, "isort ")
    session.run("isort", "--profile", "black", *args)
Exemple #8
0
def typeguard(session: Session) -> None:
    """Runtime type checking using Typeguard."""
    args = session.posargs or ["-m", "not e2e"]
    session.run("poetry", "install", "--no-dev", external=True)
    install_with_constraints(session, "pytest", "pytest-mock", "typeguard")
    session.run("pytest", f"--typeguard-packages={package}", *args)
Exemple #9
0
def tests(session: Session) -> None:
    """Run the test suite."""
    args = session.posargs or ["--cov", "-m", "not e2e"]
    session.run("poetry", "install", "--no-dev", external=True)
    session.install("coverage[toml]", "pytest", "pytest-cov", "pytest-mock")
    session.run("pytest", *args)
Exemple #10
0
def mypy(session: Session) -> None:
    """Type-check using mypy."""
    args = session.posargs or locations
    install_with_constraints(session, "mypy")
    session.run("mypy", *args)
Exemple #11
0
def coverage(session: Session) -> None:
    """Upload the coverage data."""
    session.run('poetry', 'install', external=True)
    session.run('coverage', 'xml', '--fail-under=0')
    session.run('codecov', *session.posargs)
Exemple #12
0
def docs(session: Session) -> None:
    """Build the documentation."""
    session.run("poetry", "install", "--no-dev", external=True)
    install_with_constraints(session, "pdoc3")
    session.run("pdoc", "--html", "--output-dir", "docs", f"src/{package}")