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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: nidaqmx-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
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
poetry install --all-extras --with examples
- name: Run linters
run: poetry run ni-python-styleguide lint
- name: Run mypy (Linux)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To contribute to this project, it is recommended that you follow these steps:
1. Ensure you have [poetry](https://python-poetry.org/) [installed](https://python-poetry.org/docs/#installation)
2. Clone the repository using `git clone https://github.com/ni/nidaqmx-python.git`
3. Get the submodules using `git submodule update --init --recursive`
3. Install **nidaqmx** dependencies using `poetry install --all-extras`
3. Install **nidaqmx** dependencies using `poetry install --all-extras --with examples`
4. Run the regression tests on your system (see Testing section). At this point, if any tests fail, do not
begin development. Try to investigate these failures. If you're unable to do so, report an issue
through our [GitHub issues page](http://github.com/ni/nidaqmx-python/issues).
Expand Down
2 changes: 1 addition & 1 deletion examples/digital_out/gen_dig_line_int_clk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from nidaqmx.constants import AcquisitionType, LineGrouping

with nidaqmx.Task() as task:
data: bool = [bool(i % 2) for i in range(1000)]
data = [bool(i % 2) for i in range(1000)]

task.do_channels.add_do_chan("Dev1/port0/line0", line_grouping=LineGrouping.CHAN_PER_LINE)
task.timing.cfg_samp_clk_timing(
Expand Down
9 changes: 5 additions & 4 deletions examples/playrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import numpy as np

import nidaqmx as ni
import nidaqmx
import nidaqmx.system
from nidaqmx.constants import WAIT_INFINITELY


def query_devices():
"""Queries all the device information connected to the local system."""
local = ni.system.System.local()
local = nidaqmx.system.System.local()
for device in local.devices:
print(f"Device Name: {device.name}, Product Type: {device.product_type}")
print("Input channels:", [chan.name for chan in device.ai_physical_chans])
Expand All @@ -35,11 +36,11 @@ def playrec(data, samplerate, input_mapping, output_mapping):
Recorded data

"""
devices = ni.system.System.local().devices
devices = nidaqmx.system.System.local().devices
data = np.asarray(data).T
nsamples = data.shape[1]

with ni.Task() as read_task, ni.Task() as write_task:
with nidaqmx.Task() as read_task, nidaqmx.Task() as write_task:
for i, o in enumerate(output_mapping):
aochan = write_task.ao_channels.add_ao_voltage_chan(
o,
Expand Down
2 changes: 1 addition & 1 deletion examples/system_properties.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Examples for using system properties in DAQmx."""

import nidaqmx
import nidaqmx.system

local_system = nidaqmx.system.System.local()
driver_version = local_system.driver_version
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ requires = ["poetry-core>=2.1,<3.0"]
build-backend = "poetry.core.masonry.api"

[tool.mypy]
files = "generated/,tests/"
files = "examples/,generated/,tests/"
check_untyped_defs = true
namespace_packages = true
warn_redundant_casts = true
Expand All @@ -178,6 +178,8 @@ module = [
"nidaqmx.*",
# https://github.com/ionelmc/pytest-benchmark/issues/212 - Add type annotations
"pytest_benchmark.*",
# https://github.com/adamreeve/npTDMS/issues/301 - Type Hints/Annotations
"nptdms.*",
]
ignore_missing_imports = true

Expand Down