Skip to content

Commit

Permalink
Add boilercore dependency and xfail the flux test
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeNaccarato committed Aug 15, 2023
1 parent 5081fe8 commit 542a80a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 225 deletions.
2 changes: 2 additions & 0 deletions .tools/requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ simple-pid==2.0.0
# ! Unpin numba once it supports numpy>=1.25
numba==0.57.1
numpy==1.24.4
# ! boilercore specified differently in dev and CI to allow editable package in dev
# boilercore==...
2 changes: 1 addition & 1 deletion .tools/requirements/requirements_ci.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# * -------------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

boilerdata==0.0.1
boilercore@git+https://github.com/blakeNaccarato/boilercore@8229c65f8e31aa22fe3316cd07a394c036d2dcc9

# * -------------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.
Expand Down
2 changes: 1 addition & 1 deletion .tools/requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# * -------------------------------------------------------------------------------- * #
# * Changes below should persist in significant template updates.

-e ../boilerdata
-e ../boilercore

# * -------------------------------------------------------------------------------- * #
# * Changes below may be lost in significant template updates.
Expand Down
204 changes: 0 additions & 204 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,210 +21,6 @@
"tasks": [
// * -------------------------------------------------------------------------- * //
// * Changes below should persist in significant template updates.
{
"label": "proj: hide notebook inputs",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "python -m boilercv.docs",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "proj: Run file PREVIEW/WRITE",
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": {
"BOILERCV_PREVIEW": "True",
"BOILERCV_WRITE": "True"
}
},
"command": "python ${file}",
"icon": { "id": "repo" },
"problemMatcher": []
},
{
"label": "proj: Run file DEBUG/PREVIEW/WRITE",
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": {
"BOILERCV_DEBUG": "True",
"BOILERCV_PREVIEW": "True",
"BOILERCV_WRITE": "True"
}
},
"command": "python ${file}",
"icon": { "id": "repo" },
"problemMatcher": []
},
{
"label": "proj: Run file PREVIEW",
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": { "BOILERCV_PREVIEW": "True" }
},
"command": "python ${file}",
"icon": { "id": "repo" },
"problemMatcher": []
},
{
"label": "proj: Run file WRITE",
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": { "BOILERCV_WRITE": "True" }
},
"command": "python ${file}",
"icon": { "id": "repo" },
"problemMatcher": []
},
{
"label": "proj: preview",
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": { "BOILERCV_PREVIEW": "True" }
},
"command": "python -m boilercv.previews.${input:preview}",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro build docs",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "dvc repro build_docs",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro force downstream (debug)",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": { "BOILERCV_DEBUG": "True" }
},
"command": "dvc repro --force --downstream ${input:stage}",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro (debug)",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": {
"shell": { "executable": "pwsh", "args": ["-Command"] },
"env": { "BOILERCV_DEBUG": "True" }
},
"command": "dvc repro ${input:stage}",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro force downstream",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "dvc repro --force --downstream ${input:stage}",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "dvc repro ${input:stage}",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro force all",
"dependsOrder": "sequence",
"dependsOn": [
"setup: Update project",
"dvc: pre-repro",
"dvc: freeze",
"git: Stage all files",
"pre-commit",
"git: Stage all files"
],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "dvc repro --force",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: repro all",
"dependsOrder": "sequence",
"dependsOn": [
"setup: Update project",
"dvc: pre-repro",
"dvc: freeze",
"git: Stage all files",
"pre-commit",
"git: Stage all files"
],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "dvc repro",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: dag",
"dependsOrder": "sequence",
"dependsOn": ["dvc: pre-repro"],
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "(dvc dag --md) -Replace 'mermaid', '{mermaid}' > docs/dag.md && . '~/.local/nodeenvs/markdownlint/Scripts/Activate.ps1' && markdownlint --fix docs/dag.md",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: pre-repro",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "python -m boilercv.pre_repro",
"icon": { "id": "graph" },
"problemMatcher": []
},
{
"label": "dvc: freeze",
"type": "shell",
"options": { "shell": { "executable": "pwsh", "args": ["-Command"] } },
"command": "pip freeze --requirement .tools/requirements/requirements.txt --local --exclude-editable > repro.txt",
"icon": { "id": "graph" },
"problemMatcher": []
},
// * -------------------------------------------------------------------------- * //
// * WSL-SPECIFIC * //
{
"label": "wsl: Copy PID of Python Debugger",
"type": "shell",
"command": "ps aux | grep python | grep --max-count 1 -- --adapter-access-token | grep --only-matching --perl-regexp 'user\\s+\\d+' | grep --only-matching --perl-regexp '\\d+' | clip.exe",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"close": false,
"focus": true,
"reveal": "always"
},
"icon": { "id": "terminal-linux" },
"problemMatcher": []
},

// * -------------------------------------------------------------------------- * //
// * Changes below may be lost in significant template updates.
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = { file = "LICENSE" }
requires-python = ">=3.11"
classifiers = ["License :: OSI Approved :: MIT License"]
dependencies = [
"boilerdata>=0.0.1",
"boilercore>=0.0.0",
"dulwich>=0.21.5",
"dvc[gs]>=3.10.1",
"ipykernel>=6.25.0",
Expand Down Expand Up @@ -50,14 +50,14 @@ Tracker = "https://github.com/blakeNaccarato/boilerdaq/issues"
[tool.fawltydeps]
# ignore_undeclared = ["pytest"]
ignore_unused = [
"boilerdata", # Fawltydeps struggles here
"boilercore", # Not picked up by fawltydeps
"dvc", # For experiment orchestration
"numba", # Pin numba until it supports numpy>=1.25
"numpy", # Pin numpy until numba supports numpy>=1.25
"pandas-stubs", # Provides stubs for pandas
]
ignore_undeclared = [
"boilerdata", # Fawltydeps struggles here
"boilercore", # Not picked up by fawltydeps
"graphviz", # .tools/requirements/requirements_docs.txt
"originpro", # .tools/requirements/requirements_dev.txt
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion src/boilerdaq/examples/controlled/flux_control.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Use heat flux as a control parameter."""

import boilerdata # noqa: F401
import boilercore # noqa: F401

import boilerdaq as bd
from boilerdaq.examples import CONTROL_SENSOR_NAME, OUTPUT_LIMITS
Expand Down
28 changes: 13 additions & 15 deletions tests/test_boilerdaq.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Tests."""


from importlib import import_module
from pathlib import Path
from typing import Any

import pytest
from PyQt5.QtCore import QTimer
Expand All @@ -11,29 +13,25 @@

SRC = Path("src")
EXAMPLES_DIR = SRC / "boilerdaq" / "examples"
EXAMPLES: list[str] = []
EXAMPLES: list[Any] = []
for directory in [EXAMPLES_DIR] + [
path
for path in EXAMPLES_DIR.iterdir()
if path.is_dir() and "__" not in str(path.relative_to(SRC))
]:
EXAMPLES.extend(
[
str(example.relative_to(SRC).with_suffix("")).replace("\\", ".")
for example in sorted(directory.glob("[!__]*.py"))
]
)
for example in sorted(directory.glob("[!__]*.py")):
module = str(example.relative_to(SRC).with_suffix("")).replace("\\", ".")
if module in {"boilerdaq.examples.controlled.set_voltage"}:
marks = [pytest.mark.skip]
elif module in {"boilerdaq.examples.controlled.flux_control"}:
marks = [pytest.mark.xfail]
else:
marks = []
EXAMPLES.append(pytest.param(module, marks=marks))


@pytest.mark.xdist_group(name="hardware")
@pytest.mark.parametrize(
"example",
(
example
for example in EXAMPLES
if "boilerdaq.examples.controlled.set_voltage" not in example
),
)
@pytest.mark.parametrize("example", EXAMPLES)
def test_boilerdaq(example: str):
"""Test examples."""
module = import_module(example)
Expand Down

0 comments on commit 542a80a

Please sign in to comment.