Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ This document explains the changes made to Iris for this release

#. `@jamesp`_ updated a test to the latest numpy version (:pull:`3977`)

#. `@bjlittle`_ rationalised the ``noxfile.py``, and for each ``nox`` session
executed list the ``conda`` environment packages and environment info.
(:pull:`3990`)


.. comment
Whatsnew author names (@github name) in alphabetical order. Note that,
Expand Down
142 changes: 50 additions & 92 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,52 @@ def cache_cartopy(session):
)


def prepare_venv(session):
"""
Create and cache the nox session conda environment, and additionally
provide conda environment package details and info.

Note that, iris is installed into the environment using pip.

Parameters
----------
session: object
A `nox.sessions.Session` object.

Notes
-----
See
- https://github.com/theacodes/nox/issues/346
- https://github.com/theacodes/nox/issues/260

"""
if not venv_cached(session):
# Determine the conda requirements yaml file.
fname = f"requirements/ci/py{session.python.replace('.', '')}.yml"
# Back-door approach to force nox to use "conda env update".
command = (
"conda",
"env",
"update",
f"--prefix={session.virtualenv.location}",
f"--file={fname}",
"--prune",
)
session._run(*command, silent=True, external="error")
cache_venv(session)

cache_cartopy(session)
session.install("--no-deps", "--editable", ".")
session.run("conda", "info")
session.run("conda", "list", f"--prefix={session.virtualenv.location}")
session.run(
"conda",
"list",
f"--prefix={session.virtualenv.location}",
"--explicit",
)


@nox.session
def flake8(session):
"""
Expand Down Expand Up @@ -141,30 +187,8 @@ def tests(session):
session: object
A `nox.sessions.Session` object.

Notes
-----
See
- https://github.com/theacodes/nox/issues/346
- https://github.com/theacodes/nox/issues/260

"""
if not venv_cached(session):
# Determine the conda requirements yaml file.
fname = f"requirements/ci/py{session.python.replace('.', '')}.yml"
# Back-door approach to force nox to use "conda env update".
command = (
"conda",
"env",
"update",
f"--prefix={session.virtualenv.location}",
f"--file={fname}",
"--prune",
)
session._run(*command, silent=True, external="error")
cache_venv(session)

cache_cartopy(session)
session.install("--no-deps", "--editable", ".")
prepare_venv(session)
session.run(
"python",
"-m",
Expand All @@ -184,30 +208,8 @@ def gallery(session):
session: object
A `nox.sessions.Session` object.

Notes
-----
See
- https://github.com/theacodes/nox/issues/346
- https://github.com/theacodes/nox/issues/260

"""
if not venv_cached(session):
# Determine the conda requirements yaml file.
fname = f"requirements/ci/py{session.python.replace('.', '')}.yml"
# Back-door approach to force nox to use "conda env update".
command = (
"conda",
"env",
"update",
f"--prefix={session.virtualenv.location}",
f"--file={fname}",
"--prune",
)
session._run(*command, silent=True, external="error")
cache_venv(session)

cache_cartopy(session)
session.install("--no-deps", "--editable", ".")
prepare_venv(session)
session.run(
"python",
"-m",
Expand All @@ -226,30 +228,8 @@ def doctest(session):
session: object
A `nox.sessions.Session` object.

Notes
-----
See
- https://github.com/theacodes/nox/issues/346
- https://github.com/theacodes/nox/issues/260

"""
if not venv_cached(session):
# Determine the conda requirements yaml file.
fname = f"requirements/ci/py{session.python.replace('.', '')}.yml"
# Back-door approach to force nox to use "conda env update".
command = (
"conda",
"env",
"update",
f"--prefix={session.virtualenv.location}",
f"--file={fname}",
"--prune",
)
session._run(*command, silent=True, external="error")
cache_venv(session)

cache_cartopy(session)
session.install("--no-deps", "--editable", ".")
prepare_venv(session)
session.cd("docs")
session.run(
"make",
Expand All @@ -274,30 +254,8 @@ def linkcheck(session):
session: object
A `nox.sessions.Session` object.

Notes
-----
See
- https://github.com/theacodes/nox/issues/346
- https://github.com/theacodes/nox/issues/260

"""
if not venv_cached(session):
# Determine the conda requirements yaml file.
fname = f"requirements/ci/py{session.python.replace('.', '')}.yml"
# Back-door approach to force nox to use "conda env update".
command = (
"conda",
"env",
"update",
f"--prefix={session.virtualenv.location}",
f"--file={fname}",
"--prune",
)
session._run(*command, silent=True, external="error")
cache_venv(session)

cache_cartopy(session)
session.install("--no-deps", "--editable", ".")
prepare_venv(session)
session.cd("docs")
session.run(
"make",
Expand Down