Skip to content

Commit

Permalink
Add import, cff, and build sessions for nox (#2682)
Browse files Browse the repository at this point in the history
* Add nox session to `import plasmapy`

* Add nox session to validate CITATION.cff

* Edit changelog: 2682.internal.rst

* Use  keyword so session can be called

* Edit changelog: 2682.internal.rst

* Add build session

* Put variable in function
  • Loading branch information
namurphy committed May 11, 2024
1 parent f35d5b3 commit 76c5e72
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog/2682.internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added |nox| sessions to test importing PlasmaPy, validating :file:`CITATION.cff`,
and building a source distribution and wheel.
24 changes: 24 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,27 @@ def mypy(session):
session.install("mypy >= 1.10.0", "pip")
session.install("-r", "requirements.txt")
session.run(*mypy_command, *mypy_options, *session.posargs)


@nox.session(name="import")
def try_import(session):
"""Install PlasmaPy and import it."""
session.install(".")
session.run("python", "-c", "import plasmapy")


@nox.session
def cff(session):
"""Validate CITATION.cff."""
session.install("cffconvert")
session.run("cffconvert", "--validate")


@nox.session
def build(session):
"""Build and verify a source distribution and wheel."""
session.install("twine", "build")
build_command = ("python", "-m", "build")
session.run(*build_command, "--sdist")
session.run(*build_command, "--wheel")
session.run("twine", "check", "dist/*")

0 comments on commit 76c5e72

Please sign in to comment.