How to use the nox.options function in nox

To help you get started, we’ve selected a few nox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asyrjasalo / RESTinstance / noxfile.py View on Github external
from os.path import abspath, dirname
from shutil import rmtree

import nox  # pylint: disable = import-error


PROJECT_NAME = "RESTinstance"
PACKAGE_NAME = "REST"
REPO_ROOT_PATH = dirname(abspath(__file__))

PYTHON = "3.6"

nox.options.envdir = ".venv"
nox.options.reuse_existing_virtualenvs = False
nox.options.stop_on_first_error = True

# The sensible default workflow
nox.options.sessions = ["test", "atest"]


@nox.session(python=PYTHON, venv_backend="venv", reuse_venv=True)
def test(session):
    """Run development tests for the package."""
    session.install("--upgrade", "-r", "requirements-dev.txt")
    session.run("pre-commit", "install")
    session.run("python", "-m", "unittest", "discover")
    if session.posargs:
        pytest_args = session.posargs
    else:
        pytest_args = ("--last-failed", "--last-failed-no-failures", "all")
    session.run("pytest", *pytest_args)
github sarugaku / resolvelib / noxfile.py View on Github external
import argparse
import json
import pathlib

import nox


ROOT = pathlib.Path(__file__).resolve().parent

INIT_PY = ROOT.joinpath("src", "resolvelib", "__init__.py")

nox.options.sessions = ["lint", "tests"]
nox.options.reuse_existing_virtualenvs = True


@nox.session
def lint(session):
    session.install(".[lint]")

    session.run("black", "--check", ".")
    session.run("flake8", ".")


@nox.session(python=["3.8", "3.7", "3.6", "3.5", "2.7"])
def tests(session):
    session.install(".[test]")

    files = session.posargs or ["tests"]
github pypa / pip / noxfile.py View on Github external
"""Automation using nox.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import io
import os
import shutil
import subprocess

import nox

nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint"]

LOCATIONS = {
    "common-wheels": "tests/data/common_wheels",
    "protected-pip": "tools/tox_pip.py",
}
REQUIREMENTS = {
    "tests": "tools/requirements/tests.txt",
    "common-wheels": "tools/requirements/tests-common_wheels.txt",
}

AUTHORS_FILE = "AUTHORS.txt"
VERSION_FILE = "src/pip/__init__.py"


def get_author_list():
    """Get the list of authors from Git commits.
github florimondmanca / ddtrace-asgi / noxfile.py View on Github external
import os

import nox

nox.options.reuse_existing_virtualenvs = True
nox.options.stop_on_first_error = True

source_files = (os.path.join("src", "ddtrace_asgi"), "tests", "setup.py", "noxfile.py")


@nox.session
def lint(session: nox.sessions.Session) -> None:
    session.install("autoflake", "black", "flake8", "isort", "seed-isort-config")

    session.run("autoflake", "--in-place", "--recursive", *source_files)
    session.run("seed-isort-config", "--application-directories=ddtrace_asgi")
    session.run(
        "isort", "--project=ddtrace_asgi", "--recursive", "--apply", *source_files
    )
    session.run("black", "--target-version=py36", *source_files)

    check(session)
github cs01 / gdbgui / noxfile.py View on Github external
import nox  # type: ignore
from pathlib import Path


nox.options.sessions = ["tests", "lint", "docs"]
python = ["3.6", "3.7", "3.8"]


doc_dependencies = [".", "mkdocs", "mkdocs-material"]
lint_dependencies = ["black", "flake8", "mypy", "check-manifest"]
files_to_lint = ["gdbgui", "tests"] + [str(p) for p in Path(".").glob("*.py")]


@nox.session(python=python)
def tests(session):
    session.install(".")
    tests = session.posargs or ["tests"]
    session.install(".", "pytest", "pytest-cov")
    tests = session.posargs or ["tests"]
    session.run(
        "pytest", "--cov=gdbgui", "--cov-config", ".coveragerc", "--cov-report=", *tests
github brandonskerritt / Ciphey / noxfile.py View on Github external
"""
The file for Nox
"""
import nox
from typing import Any
from nox.sessions import Session
import tempfile

locations = "ciphey/", "tests/", "docs/"
nox.options.sessions = "safety", "tests"
package = "ciphey"


def install_with_constraints(session: Session, *args: str, **kwargs: Any) -> None:
    """Install packages constrained by Poetry's lock file.
    This function is a wrapper for nox.sessions.Session.install. It
    invokes pip to install packages inside of the session's virtualenv.
    Additionally, pip is passed a constraints file generated from
    Poetry's lock file, to ensure that the packages are pinned to the
    versions specified in poetry.lock. This allows you to manage the
    packages as Poetry development dependencies.
    Arguments:
        session: The Session object.
        args: Command-line arguments for pip.
        kwargs: Additional keyword arguments for Session.install.
    """
github encode / httpx / noxfile.py View on Github external
import nox

nox.options.stop_on_first_error = True
nox.options.reuse_existing_virtualenvs = True
nox.options.keywords = "not serve"

source_files = ("httpx", "tools", "tests", "setup.py", "noxfile.py")


@nox.session
def lint(session):
    session.install(
        "--upgrade", "autoflake", "black", "flake8", "isort", "seed-isort-config"
    )

    session.run("autoflake", "--in-place", "--recursive", *source_files)
    session.run("seed-isort-config", "--application-directories=httpx")
    session.run("isort", "--project=httpx", "--recursive", "--apply", *source_files)
    session.run("black", "--target-version=py36", *source_files)
github thebigmunch / google-music / noxfile.py View on Github external
import os
import shutil

import nox

ON_TRAVIS = 'TRAVIS' in os.environ

py36 = '3.6'
py37 = '3.7'
py38 = '3.8'

nox.options.reuse_existing_virtualenvs = True


@nox.session
def lint(session):
	session.install('-U', '.[lint]')
	session.run('flake8', 'src/')


@nox.session
def doc(session):
	shutil.rmtree('docs/_build', ignore_errors=True)
	session.install('-U', '.[doc]')
	session.cd('docs')
	session.run(
		'sphinx-build',
		'-b',
github pypa / pip / noxfile.py View on Github external
"""Automation using nox.
"""

# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False

import io
import os
import shutil
import subprocess

import nox

nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["lint"]

LOCATIONS = {
    "common-wheels": "tests/data/common_wheels",
    "protected-pip": "tools/tox_pip.py",
}
REQUIREMENTS = {
    "tests": "tools/requirements/tests.txt",
    "common-wheels": "tools/requirements/tests-common_wheels.txt",
}

AUTHORS_FILE = "AUTHORS.txt"
VERSION_FILE = "src/pip/__init__.py"


def get_author_list():
github scrapd / scrapd / noxfile.py View on Github external
from pathlib import Path

import nox

# Behavior's options.
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["venv"]

# Configuration values.
nox_file = Path()
project_name = 'scrapd'
dockerfile = 'Dockerfile'
docker_org = 'scrapd'
docker_repo = f'{docker_org}/{project_name}'
docker_img = f'{docker_repo}'


@nox.session()
def ci(session):
    """Run all the CI tasks."""
    session.install('-rrequirements-dev.txt')
    session.install('-e', '.')