Skip to content

Commit

Permalink
Add constraints file
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysle committed Nov 29, 2023
1 parent 82d0037 commit aae5868
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 44 deletions.
2 changes: 2 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
setuptools >= 68.2.2
wheel >= 0.42.0
78 changes: 35 additions & 43 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,75 +25,67 @@
USE_PYTHON_VERSIONS = USE_PYTHON_VERSIONS_DEFAULT


install_commands = (
('pip', 'install', '.'),
('pip', 'install', '-e', '.')
)
install_commands = (("pip", "install", "."), ("pip", "install", "-e", "."))


def install_packages(session, package_a, package_b, command_a, command_b):
session.install(
"--upgrade",
"setuptools",
"pip",
"wheel",
env={"PIP_CONSTRAINT": f"{HERE}/constraints.txt"},
)
session.chdir(package_a)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run("rm", "-rf", "dist", "build", "*.egg-info")
session.run(*command_a)
session.chdir(HERE)
session.chdir(package_b)
session.run('rm', '-rf', 'dist', 'build', '*.egg-info')
session.run("rm", "-rf", "dist", "build", "*.egg-info")
session.run(*command_b)
session.chdir(HERE)


@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pkgutil(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkgutil/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
install_packages(session, "pkgutil/pkg_a", "pkgutil/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")


@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pkg_resources(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'pkg_resources/pkg_a', 'pkg_resources/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
session, "pkg_resources/pkg_a", "pkg_resources/pkg_b", command_a, command_b
)
session.run("python", "verify_packages.py")


@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_pep420(session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'native/pkg_a', 'native/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
install_packages(session, "native/pkg_a", "native/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")


@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pkg_resources_pkgutil(
session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_cross_pkg_resources_pkgutil(session, command_a, command_b):
install_packages(
session, 'pkg_resources/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
session, "pkg_resources/pkg_a", "pkgutil/pkg_b", command_a, command_b
)
session.run("python", "-m", "pip", "list")
session.run("python", "verify_packages.py")


@nox.session(python=USE_PYTHON_VERSIONS)
@nox.parametrize('command_a', install_commands)
@nox.parametrize('command_b', install_commands)
def session_cross_pep420_pkgutil(
session, command_a, command_b):
session.install('--upgrade', 'setuptools', 'pip')
install_packages(
session, 'native/pkg_a', 'pkgutil/pkg_b',
command_a, command_b)
session.run('python', 'verify_packages.py')
@nox.parametrize("command_a", install_commands)
@nox.parametrize("command_b", install_commands)
def session_cross_pep420_pkgutil(session, command_a, command_b):
install_packages(session, "native/pkg_a", "pkgutil/pkg_b", command_a, command_b)
session.run("python", "verify_packages.py")
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -- PYTHON PACKAGE REQUIREMENTS:
# USE: pip install -r <THIS_FILE>

setuptools >= 68.2.2
nox >= 2023.04.22

0 comments on commit aae5868

Please sign in to comment.