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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ All notable changes to this project will be documented in this file.
* Adopt ni-python-styleguide for hand-written code.
* Upgrade to Poetry 2.x and migrate `pyproject.toml` format.
* Add support for Python 3.14.
* Add https://github.com/ni/ni-apis as a submodule of nidaqmx-python.

* ### Known Issues
* ...
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ more details.
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. Fork the repository on GitHub.
3. Install **nidaqmx** dependencies using ``poetry install``
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`
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).
5. Write new tests that demonstrate your bug or feature. Ensure that these new tests fail.
6. Make your change.
7. Once the necessary changes are done, update the auto-generated code using ``poetry run python src/codegen --dest generated/nidaqmx``. This will ensure that the latest files are present in the ``generated`` folder.
7. Once the necessary changes are done, update the auto-generated code using `poetry run python src/codegen --dest generated/nidaqmx`. This will ensure that the latest files are present in the ``generated`` folder.
> **Note**
> The codegen scripts require Python 3.9 or later.
8. Run all the regression tests again (including the tests you just added), and confirm that they all
Expand Down
8 changes: 5 additions & 3 deletions src/codegen/stub_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def add_init_files(stubs_path: pathlib.Path, proto_path: pathlib.Path):
"""Add __init__.py files to generated file directories."""
for dir in stubs_path.rglob(""):
if not is_relative_to(dir, proto_path) and dir.is_dir():
init_path = dir / "__init__.py"
print(f"Creating {init_path}")
init_path.write_bytes(b'"""Auto generated gRPC files."""\n')
python_files = list(dir.glob("*.py"))
if python_files:
init_path = dir / "__init__.py"
print(f"Creating {init_path}")
init_path.write_bytes(b'"""Auto generated gRPC files."""\n')