-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mdpiper/update-examples-for-realz
- Loading branch information
Showing
16 changed files
with
182 additions
and
110 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,54 +1,7 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.egg-info/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
.coverage | ||
.ipynb_checkpoints/ | ||
__pycache__/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ |
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,65 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.12.1 | ||
hooks: | ||
- id: black | ||
name: black | ||
description: "Black: The uncompromising Python code formatter" | ||
entry: black | ||
language: python | ||
language_version: python3 | ||
minimum_pre_commit_version: 2.9.2 | ||
require_serial: true | ||
types_or: [python, pyi] | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-bugbear | ||
- flake8-comprehensions | ||
- flake8-simplify | ||
args: [--max-line-length=88] | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py310-plus] | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-builtin-literals | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: forbid-new-submodules | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- id: name-tests-test | ||
- id: file-contents-sorter | ||
files: | | ||
(?x)^( | ||
.*requirements(-\w+)?.(in|txt)| | ||
requirements/.*\.txt| | ||
.gitignore | ||
) | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.8.0 | ||
hooks: | ||
- id: mypy | ||
language_version: python3.12 | ||
files: heat/.*\.py$ | ||
additional_dependencies: | ||
- types-PyYAML |
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,103 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
import pathlib | ||
import shutil | ||
|
||
import nox | ||
|
||
PROJECT = "heat" | ||
ROOT = pathlib.Path(__file__).parent | ||
|
||
|
||
@nox.session | ||
def test(session: nox.Session) -> None: | ||
"""Run the tests.""" | ||
session.install(".[testing]") | ||
|
||
args = ["--cov", PROJECT, "-vvv"] + session.posargs | ||
|
||
if "CI" in os.environ: | ||
args.append(f"--cov-report=xml:{ROOT.absolute()!s}/coverage.xml") | ||
session.run("pytest", *args) | ||
|
||
if "CI" not in os.environ: | ||
session.run("coverage", "report", "--ignore-errors", "--show-missing") | ||
|
||
|
||
@nox.session | ||
def lint(session: nox.Session) -> None: | ||
"""Look for lint.""" | ||
session.install("pre-commit") | ||
session.run("pre-commit", "run", "--all-files") | ||
|
||
|
||
@nox.session | ||
def build(session: nox.Session) -> None: | ||
session.install("pip") | ||
session.install("build") | ||
session.run("python", "--version") | ||
session.run("pip", "--version") | ||
session.run("python", "-m", "build", "--outdir", "./build/wheelhouse") | ||
|
||
|
||
@nox.session(name="publish-testpypi") | ||
def publish_testpypi(session): | ||
"""Publish wheelhouse/* to TestPyPI.""" | ||
session.run("twine", "check", "build/wheelhouse/*") | ||
session.run( | ||
"twine", | ||
"upload", | ||
"--skip-existing", | ||
"--repository-url", | ||
"https://test.pypi.org/legacy/", | ||
"build/wheelhouse/*.tar.gz", | ||
) | ||
|
||
|
||
@nox.session(name="publish-pypi") | ||
def publish_pypi(session): | ||
"""Publish wheelhouse/* to PyPI.""" | ||
session.run("twine", "check", "build/wheelhouse/*") | ||
session.run( | ||
"twine", | ||
"upload", | ||
"--skip-existing", | ||
"build/wheelhouse/*.tar.gz", | ||
) | ||
|
||
|
||
@nox.session(python=False) | ||
def clean(session): | ||
"""Remove all .venv's, build files and caches in the directory.""" | ||
folders = ( | ||
(ROOT,) if not session.posargs else (pathlib.Path(f) for f in session.posargs) | ||
) | ||
for folder in folders: | ||
if not str(folder.resolve()).startswith(str(ROOT.resolve())): | ||
session.log(f"skipping {folder}: folder is outside of repository") | ||
continue | ||
|
||
with session.chdir(folder): | ||
session.log(f"cleaning {folder}") | ||
|
||
shutil.rmtree("build", ignore_errors=True) | ||
shutil.rmtree("dist", ignore_errors=True) | ||
shutil.rmtree(f"src/{PROJECT}.egg-info", ignore_errors=True) | ||
shutil.rmtree(".pytest_cache", ignore_errors=True) | ||
shutil.rmtree(".venv", ignore_errors=True) | ||
|
||
for pattern in ["*.py[co]", "__pycache__"]: | ||
_clean_rglob(pattern) | ||
|
||
|
||
def _clean_rglob(pattern): | ||
nox_dir = pathlib.Path(".nox") | ||
|
||
for p in pathlib.Path(".").rglob(pattern): | ||
if nox_dir in p.parents: | ||
continue | ||
if p.is_dir(): | ||
p.rmdir() | ||
else: | ||
p.unlink() |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
black | ||
bmi-tester | ||
coveralls | ||
isort | ||
pytest | ||
pytest-cov | ||
black | ||
isort | ||
ruff | ||
bmi-tester |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bmipy | ||
numpy | ||
scipy | ||
pyyaml | ||
bmipy | ||
scipy |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.