Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ jobs:
build:
name: Build
runs-on:
- ubuntu-latest
- ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.14"] # oldest supported and latest tested
env:
codegen-python-version: "3.9"
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -17,30 +23,20 @@ jobs:
uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
id: setup-python
with:
# The codegen scripts require Python 3.10 or later.
python-version: "3.10"
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
- name: Cache virtualenv (all extras)
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
- name: Run linters and type checkers
uses: ni/python-actions/analyze-project@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
with:
path: .venv
key: nidaqmx-all-extras-and-examples-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install --all-extras --with examples
- name: Run linters
run: poetry run ni-python-styleguide lint
- name: Run mypy (Linux)
run: poetry run mypy
- name: Run mypy (Windows)
run: poetry run mypy --platform win32
install-args: "--all-extras --with examples"
- name: Run Bandit security checks
run: poetry run bandit -c pyproject.toml -r generated/nidaqmx
- name: Generate ni-daqmx files
if: ${{ runner.os == 'Linux' && matrix.python-version == env.codegen-python-version }}
run: |
rm -fr generated/nidaqmx
poetry run python src/codegen --dest generated/nidaqmx
- name: Check for files dirtied by codegen
if: ${{ runner.os == 'Linux' && matrix.python-version == env.codegen-python-version }}
run: git diff --exit-code
6 changes: 4 additions & 2 deletions generated/nidaqmx/_feature_toggles.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""nidaqmx feature toggles."""

# mypy: no-warn-unreachable
from __future__ import annotations

import functools
Expand All @@ -20,8 +21,6 @@

_PREFIX = "NIDAQMX"

_config = AutoConfig(str(get_dotenv_search_path()))

if TYPE_CHECKING:
# Work around decouple's lack of type hints.
def _config(
Expand All @@ -30,6 +29,9 @@ def _config(
cast: Callable[[str], _T] | Undefined = undefined,
) -> _T: ...

else:
_config = AutoConfig(str(get_dotenv_search_path()))


# Based on the recipe at https://docs.python.org/3/howto/enum.html
class _OrderedEnum(Enum):
Expand Down
6 changes: 4 additions & 2 deletions src/handwritten/_feature_toggles.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""nidaqmx feature toggles."""

# mypy: no-warn-unreachable
from __future__ import annotations

import functools
Expand All @@ -20,8 +21,6 @@

_PREFIX = "NIDAQMX"

_config = AutoConfig(str(get_dotenv_search_path()))

if TYPE_CHECKING:
# Work around decouple's lack of type hints.
def _config(
Expand All @@ -30,6 +29,9 @@ def _config(
cast: Callable[[str], _T] | Undefined = undefined,
) -> _T: ...

else:
_config = AutoConfig(str(get_dotenv_search_path()))


# Based on the recipe at https://docs.python.org/3/howto/enum.html
class _OrderedEnum(Enum):
Expand Down