Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
92 changes: 0 additions & 92 deletions Makefile

This file was deleted.

5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ file::
If you would like your subsidence profile to change with time, see the
section above, `Time-varying parameters`_.

.. end-input-files


Output File
-----------

Expand All @@ -427,8 +430,6 @@ You can now run the simulation (from within the *example* folder)::

$ sequence run

.. end-input-files

Plotting output
---------------

Expand Down
1 change: 0 additions & 1 deletion docs/readme.rst

This file was deleted.

3 changes: 3 additions & 0 deletions news/60.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Set up `nox <https://nox.thea.codes>`_ to automate testing and routine package
maintenance.

144 changes: 144 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import os
import pathlib
import shutil
from itertools import chain

import nox


@nox.session
def tests(session: nox.Session) -> None:
"""Run the tests."""
session.install("pytest")
session.install(".[dev]")
session.run("pytest", "--cov=sequence", "-vvv")
session.run("coverage", "report", "--ignore-errors", "--show-missing")
# "--fail-under=100",


@nox.session
def notebooks(session: nox.Session) -> None:
"""Run the notebooks."""
session.install(".[dev,notebook]")
session.run("pytest", "--nbmake", "notebooks/")


@nox.session
def cli(session: nox.Session) -> None:
"""Test the command line interface."""
session.install(".")
session.run("sequence", "--version")
session.run("sequence", "--help")
session.run("sequence", "generate", "--help")
session.run("sequence", "plot", "--help")
session.run("sequence", "run", "--help")
session.run("sequence", "setup", "--help")

INFILES = ("bathymetry.csv", "sealevel.csv", "sequence.toml", "subsidence.csv")

for infile in INFILES:
session.run("sequence", "generate", infile)
session.run("sequence", "generate", "sequence.yaml")

tmp_dir = pathlib.Path(session.create_tmp()).absolute()
session.cd(tmp_dir)
for infile in INFILES:
(tmp_dir / infile).unlink(missing_ok=True)

session.run("sequence", "setup")
for infile in INFILES:
assert pathlib.Path(infile).is_file()
assert not pathlib.Path("sequence.yaml").exists()


@nox.session
def lint(session: nox.Session) -> None:
"""Look for lint."""
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files")

towncrier(session)


@nox.session
def towncrier(session: nox.Session) -> None:
"""Check that there is a news fragment."""
session.install("towncrier")
session.run("towncrier", "check", "--compare-with", "origin/develop")


@nox.session
def docs(session: nox.Session) -> None:
"""Build the docs."""
session.install(".[doc]")

session.chdir("docs")
if os.path.exists("_build"):
shutil.rmtree("_build")
session.run("sphinx-apidoc", "--force", "-o", "api", "../sequence")
session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")


@nox.session
def build(session: nox.Session) -> None:
"""Build sdist and wheel dists."""
session.install("pip")
session.install("wheel")
session.install("setuptools")
session.run("python", "--version")
session.run("pip", "--version")
session.run(
"python", "setup.py", "bdist_wheel", "sdist", "--dist-dir", "./wheelhouse"
)


@nox.session
def release(session):
"""Tag, build and publish a new release to PyPI."""
session.install("zest.releaser[recommended]")
session.install("zestreleaser.towncrier")
session.run("fullrelease")


@nox.session
def publish_testpypi(session):
"""Publish wheelhouse/* to TestPyPI."""
session.run("twine", "check", "wheelhouse/*")
session.run(
"twine",
"upload",
"--skip-existing",
"--repository-url",
"https://test.pypi.org/legacy/",
"wheelhouse/*.tar.gz",
)


@nox.session
def publish_pypi(session):
"""Publish wheelhouse/* to PyPI."""
session.run("twine", "check", "wheelhouse/*")
session.run(
"twine",
"upload",
"--skip-existing",
"wheelhouse/*.tar.gz",
)


@nox.session(python=False)
def clean(session):
"""Remove all .venv's, build files and caches in the directory."""
PROJECT = "sequence"
ROOT = pathlib.Path(__file__).parent

shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("wheelhouse", ignore_errors=True)
shutil.rmtree(f"{PROJECT}.egg-info", ignore_errors=True)
shutil.rmtree(".pytest_cache", ignore_errors=True)
shutil.rmtree(".venv", ignore_errors=True)
for p in chain(ROOT.rglob("*.py[co]"), ROOT.rglob("__pycache__")):
if p.is_dir():
p.rmdir()
else:
p.unlink()
11 changes: 2 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ changelog = "https://github.com/sequence-dev/sequence/blob/develop/CHANGES.rst"
[project.optional-dependencies]
dev = [
"black",
"coverage",
"flake8",
"isort",
"nbmake",
"nox",
"pre-commit",
"pytest",
"pytest-cov",
Expand All @@ -59,16 +61,7 @@ dev = [
"towncrier",
]
doc = [
"pandoc",
"nbformat",
"jupyter_client",
"ipython",
"sphinx",
"sphinx_rtd_theme",
"tornado",
"entrypoints",
"nbsphinx>=0.2.12",
"sphinxcontrib_github_alt",
"pygments>=2.4",
"sphinx-inline-tabs",
"furo",
Expand Down