-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from CAST-genomics/feat/actions
fix: file reads and writes in py3.10+
- Loading branch information
Showing
16 changed files
with
437 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"""Nox sessions.""" | ||
import os | ||
import sys | ||
import shutil | ||
from pathlib import Path | ||
|
||
import nox | ||
from nox_poetry import Session | ||
from nox_poetry import session | ||
|
||
|
||
package = "haptools" | ||
python_versions = ["3.7", "3.8", "3.9", "3.10"] | ||
nox.needs_version = ">= 2021.6.6" | ||
nox.options.sessions = ( | ||
"docs", | ||
"lint", | ||
"tests", | ||
) | ||
|
||
|
||
# detect whether mamba is installed | ||
conda_cmd = "conda" | ||
if (Path(os.getenv("CONDA_EXE")).parent / "mamba").exists(): | ||
conda_cmd = "mamba" | ||
conda_args = ["-c", "conda-forge"] | ||
|
||
|
||
@session(python=False) | ||
def docs(session: Session) -> None: | ||
"""Build the documentation.""" | ||
args = session.posargs or ["docs", "docs/_build"] | ||
if not session.posargs and "FORCE_COLOR" in os.environ: | ||
args.insert(0, "--color") | ||
|
||
build_dir = Path("docs", "_build") | ||
if build_dir.exists(): | ||
shutil.rmtree(build_dir) | ||
|
||
session.run("sphinx-build", *args) | ||
|
||
|
||
@session(python=False) | ||
def lint(session: Session) -> None: | ||
"""Lint our code.""" | ||
session.run("black", "--check", ".") | ||
|
||
|
||
@session(venv_backend=conda_cmd, venv_params=conda_args, python=python_versions) | ||
def tests(session: Session) -> None: | ||
"""Run the test suite.""" | ||
session.conda_install( | ||
"coverage[toml]", "pytest", "numpy>=1.20.0", channel="conda-forge" | ||
) | ||
# TODO: change this to ".[files]" once plink-ng Alpha 3.8 is released | ||
# https://github.com/chrchang/plink-ng/releases | ||
session.install(".") | ||
|
||
try: | ||
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs) | ||
finally: | ||
if session.interactive: | ||
session.notify("coverage", posargs=[]) | ||
|
||
|
||
@session(python=False) | ||
def coverage(session: Session) -> None: | ||
"""Produce the coverage report.""" | ||
args = session.posargs or ["report"] | ||
|
||
if not session.posargs and any(Path().glob(".coverage.*")): | ||
session.run("coverage", "combine") | ||
|
||
session.run("coverage", *args) |
Oops, something went wrong.