Skip to content

Commit

Permalink
ci: Use nodeenv to install node during tox runs, and install node wit…
Browse files Browse the repository at this point in the history
…h nodeenv during initial contributor setup (#278)
  • Loading branch information
nfelt14 authored Aug 15, 2024
1 parent a9eed0f commit 0da6c42
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ repos:
always_run: true
args: [audit, --json, --ignore-code=CVE-2019-8341]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: ac97362543353002a47d6cae8918b25444d102df # frozen: v0.5.7
rev: 718fbf5fa5fb8cbe6aeac32a863271695104cd5d # frozen: v0.6.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mkdocs-spellcheck==1.1.0 ; python_version >= "3.8" and python_version < "4.0"
mkdocstrings==0.25.2 ; python_version >= "3.8" and python_version < "4.0"
mkdocstrings-python==1.10.5 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
nodeenv==1.9.1 ; python_version >= "3.8" and python_version < "4.0"
packaging==24.1 ; python_version >= "3.8" and python_version < "4.0"
pathspec==0.12.1 ; python_version >= "3.8" and python_version < "4.0"
platformdirs==4.2.2 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -41,9 +42,9 @@ python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "4.0
pyyaml==6.0.2 ; python_version >= "3.8" and python_version < "4.0"
pyyaml-env-tag==0.1 ; python_version >= "3.8" and python_version < "4.0"
requests==2.32.3 ; python_version >= "3.8" and python_version < "4.0"
setuptools==72.1.0 ; python_version >= "3.8" and python_version < "4.0"
setuptools==72.2.0 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
soupsieve==2.5 ; python_version >= "3.8" and python_version < "4.0"
soupsieve==2.6 ; python_version >= "3.8" and python_version < "4.0"
symspellpy==6.7.7 ; python_version >= "3.8" and python_version < "4.0"
termcolor==2.4.0 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ matplotlib = [
{python = "3.8", version = "^3.7"}
]
memory-profiler = "^0.61.0"
nodeenv = "^1.9.1"
pip = "^24.0"
poetry = "^1.8.0"
poetry-audit-plugin = "^0.4.0"
Expand All @@ -111,10 +112,10 @@ pre-commit = [
]
pyclean = "^3.0.0"
pylint = "3.2.6"
pyright = "1.1.375"
pyright = "1.1.376"
pyroma = "^4.2"
python-semantic-release = "^9.6.0"
ruff = "0.5.7"
ruff = "0.6.0"
toml-sort = "^0.23.0"
tox = "^4.0"
tox-gh-actions = "^3.1.0"
Expand All @@ -140,6 +141,7 @@ mkdocs-section-index = "^0.3.9"
mkdocs-spellcheck = "^1.1.0"
mkdocstrings = "^0.25.0"
mkdocstrings-python = "^1.10.2"
nodeenv = "^1.9.1"
pygments = "^2.17.2"
pymdown-extensions = "^10.8.1"
symspellpy = "^6.7.7"
Expand All @@ -158,7 +160,7 @@ pytest-env = "^1.1.3"
pytest-github-report = "^0.0.1"
pytest-html = "^4.1.1"
pytest-order = "^1.2.1"
ruff = "0.5.7"
ruff = "0.6.0"
tomli = "^2.0.1"

[tool.poetry.scripts]
Expand Down Expand Up @@ -465,6 +467,7 @@ basepython = {env:DOC_PYTHON_VERSION}
deps =
-rdocs/requirements.txt
commands_pre =
nodeenv --python-virtualenv --clean-src
commands =
python -c "import shutil; shutil.rmtree('.results_{envname}', ignore_errors=True)"
mkdocs --verbose build --site-dir .results_{envname}
Expand All @@ -475,6 +478,7 @@ deps =
-rdocs/requirements.txt
-rtests/requirements.txt
commands_pre =
nodeenv --python-virtualenv --clean-src
commands =
pytest -v -k "test_docs" --showlocals --junitxml={tox_root}/.results_{envname}/results.xml --self-contained-html --html={tox_root}/.results_{envname}/results.html
"""
5 changes: 3 additions & 2 deletions scripts/contributor_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ def main() -> None:
commands_to_send = (
f"{python_executable} -m pip install -U pip wheel poetry",
f"{python_executable} -m poetry install",
f"{python_executable} -m nodeenv --python-virtualenv --clean-src",
f"{python_executable} -m pre_commit install",
f"{python_executable} -m tox -vve tests",
f"{python_executable} -m tox -e tests",
)
for command in commands_to_send:
_run_cmd_in_subprocess(command)
Expand All @@ -146,7 +147,7 @@ def main() -> None:
"Unable to set up the environment. Please run this script from a "
"standard Python installation, not a virtual environment."
)
raise SystemExit(msg) # noqa: TRY200,B904
raise SystemExit(msg) # noqa: B904
finally:
os.chdir(starting_dir)

Expand Down
2 changes: 1 addition & 1 deletion src/tm_devices/components/dm_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def __parse_config_file(
options_list = list(options_mapping)
valid_options = set(get_type_hints(DMConfigOptions))
msg = f"Invalid configuration options found: {list(set(options_list) - valid_options)}"
raise KeyError(msg) # noqa: TRY200,B904
raise KeyError(msg) # noqa: B904
devices_list = data.get("devices", [])
return options, devices_list

Expand Down
2 changes: 1 addition & 1 deletion src/tm_devices/helpers/constants_and_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __post_init__(self) -> None: # noqa: PLR0912, C901
object.__setattr__(self, "connection_type", ConnectionTypes(self.connection_type))
except ValueError as error:
# this is from an invalid enum name
raise TypeError(*error.args) # noqa: TRY200,B904
raise TypeError(*error.args) # noqa: B904

# Validate the GPIB board number
if (
Expand Down
6 changes: 3 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ pytest-order==1.2.1 ; python_version >= "3.8" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "4.0"
pytz==2024.1 ; python_version >= "3.8" and python_version < "4.0"
requests==2.32.3 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.5.7 ; python_version >= "3.8" and python_version < "4.0"
setuptools==72.1.0 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.6.0 ; python_version >= "3.8" and python_version < "4.0"
setuptools==72.2.0 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
soupsieve==2.5 ; python_version >= "3.8" and python_version < "4.0"
soupsieve==2.6 ; python_version >= "3.8" and python_version < "4.0"
tabledata==1.3.3 ; python_version >= "3.8" and python_version < "4.0"
tcolorpy==0.1.6 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "4.0"
Expand Down

0 comments on commit 0da6c42

Please sign in to comment.