Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a top-level ni-measurement-plugin-sdk meta package #781

Merged
merged 34 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
01098c5
First pass at a top-level package
dixonjoel Jul 9, 2024
5c8fefb
Build and publish the SDK package
dixonjoel Jul 9, 2024
88b7cf9
Lint and fix some dependencies. Delete foo.py. Remove click and mako
dixonjoel Jul 9, 2024
60e6ed5
Reorganize the package hierarchy and pyproject.toml files
dixonjoel Jul 9, 2024
c08d7d2
Fix the docs configuration path
dixonjoel Jul 9, 2024
8abac12
Updated working directories
dixonjoel Jul 9, 2024
72aa74e
Update working directory for nims
dixonjoel Jul 9, 2024
8e03455
Make a copy of color stubs
dixonjoel Jul 9, 2024
c0ef615
Fix lint errors
dixonjoel Jul 9, 2024
bdf62c0
Working directory for docs
dixonjoel Jul 9, 2024
d1debcf
Move scripts into service
dixonjoel Jul 9, 2024
d5916ec
Working directory for docs build
dixonjoel Jul 9, 2024
e2cd51a
Move _docs_source into service
dixonjoel Jul 9, 2024
7c03320
Fix autoapi dir
dixonjoel Jul 9, 2024
8e79ca2
Fix docs directory
dixonjoel Jul 9, 2024
4a9de4d
Update proto path
dixonjoel Jul 9, 2024
b6e4547
Update working directory for service
dixonjoel Jul 9, 2024
87984a4
Move README into sdk folder
dixonjoel Jul 9, 2024
6e6a05d
Update working directory for system tests
dixonjoel Jul 9, 2024
29b22fb
Update SDK package version from tag during publish
dixonjoel Jul 9, 2024
ec38733
Fix copying of .env.simulation with working directory
dixonjoel Jul 9, 2024
8af4b98
Add README to service so poetry install works
dixonjoel Jul 9, 2024
47fe78e
Fix tox working directory
dixonjoel Jul 9, 2024
030fc51
Fix test_results path
dixonjoel Jul 10, 2024
a5e0d1f
Fix typo
dixonjoel Jul 10, 2024
a79ecad
Fix install_examples script
dixonjoel Jul 10, 2024
1520d46
Clean out docs/ directory after building
dixonjoel Jul 10, 2024
f874cd6
Fix caching keys
dixonjoel Jul 10, 2024
ea21e03
Use rm -rf docs
dixonjoel Jul 10, 2024
355af1a
Fix readthedocs configuration path
dixonjoel Jul 10, 2024
8175ba9
Merge remote-tracking branch 'origin/main' into users/jdixon/top-leve…
dixonjoel Jul 10, 2024
4da70f7
Update CNAME for readthedocs
dixonjoel Jul 10, 2024
8b61b19
Update caching keys and locations
dixonjoel Jul 10, 2024
9698408
Update poetry version for readthedocs
dixonjoel Jul 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 14 additions & 2 deletions .github/workflows/Publish_NIMS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ jobs:
- name: Update NIMS package version based on tag name.
run: |
poetry version ${{ steps.vars.outputs.tag }}
working-directory: ./packages/service

- name: Update NIMG package version based on tag name.
run: |
poetry version ${{ steps.vars.outputs.tag }}
working-directory: ./ni_measurement_plugin_sdk_generator
working-directory: ./packages/generator

- name: Update SDK package version based on tag name.
run: |
poetry version ${{ steps.vars.outputs.tag }}
working-directory: ./packages/sdk

- name: Commit file changes
id: commit
Expand Down Expand Up @@ -84,7 +90,13 @@ jobs:
if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }}
run: |
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
working-directory: ./ni_measurement_plugin_sdk_generator
working-directory: ./packages/generator

- name: Build SDK Python package and publish to PyPI
dixonjoel marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }}
run: |
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
working-directory: ./packages/sdk

- name: Create archives of the examples
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
path: 'examples/**/poetry.lock'
# Include the main project's poetry.lock in the hash to detect upstream dependency updates.
key: examples-poetry-lock-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('examples/**/pyproject.toml', 'poetry.lock') }}
key: examples-poetry-lock-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('examples/**/pyproject.toml', 'packages/service/poetry.lock') }}
- name: Lock examples
if: steps.cache-poetry-lock.outputs.cache-hit != 'true'
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check_nimg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./ni_measurement_plugin_sdk_generator
working-directory: ./packages/generator
dixonjoel marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand All @@ -34,8 +34,8 @@ jobs:
uses: actions/cache@v4
id: cache
with:
path: ni_measurement_plugin_sdk_generator/.venv
key: ni-measurement-plugin-sdk-generator-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/generator/.venv
key: ni-measurement-plugin-sdk-generator-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/generator/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-generator
run: poetry install -v
- name: Lint ni-measurement-plugin-sdk-generator
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/check_nims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
check_nims:
name: Check NIMS
runs-on: ubuntu-latest
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./packages/service
dixonjoel marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand All @@ -34,15 +38,15 @@ jobs:
uses: actions/cache/restore@v4
id: restore-nims-all-extras
with:
path: .venv
key: ni-measurement-plugin-sdk-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (all extras)
run: poetry install -v --all-extras
- name: Save cached virtualenv (ni-measurement-plugin-sdk-service, all extras)
uses: actions/cache/save@v4
if: steps.restore-nims-all-extras.outputs.cache-hit != 'true'
with:
path: .venv
path: packages/service/.venv
key: ${{ steps.restore-nims-all-extras.outputs.cache-primary-key }}
- name: Lint ni-measurement-plugin-sdk-service
run: poetry run ni-python-styleguide lint
Expand All @@ -60,23 +64,23 @@ jobs:
uses: actions/cache/restore@v4
id: restore-nims-all-extras-docs
with:
path: .venv
key: ni-measurement-plugin-sdk-service-all-extras-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-all-extras-docs-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (all extras, docs)
run: poetry install -v --all-extras --with docs
- name: Save cached virtualenv (ni-measurement-plugin-sdk-service, all extras, docs)
uses: actions/cache/save@v4
if: steps.restore-nims-all-extras-docs.outputs.cache-hit != 'true'
with:
path: .venv
path: packages/service/.venv
key: ${{ steps.restore-nims-all-extras-docs.outputs.cache-primary-key }}
- name: Build docs and check for errors/warnings
run: |
rm -rf docs
mkdir -p docs
poetry run sphinx-build _docs_source docs -b html -W --keep-going
- name: Revert docs
run: git clean -dfx docs/ && git restore docs/
run: rm -rf docs
- name: Generate gRPC stubs
run: |
find ni_measurement_plugin_sdk_service/_internal/stubs/ -name \*_pb2.py\* -o -name \*_pb2_grpc.py\* -delete
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/run_system_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
- windows
- x64
- rdss-measlinkbot-win-10-${{ matrix.configuration }}
defaults:
run:
# Set the working-directory for all steps in this job.
working-directory: ./packages/service
strategy:
matrix:
configuration: ["py32", "py64"]
Expand All @@ -24,14 +28,15 @@ jobs:
uses: actions/checkout@v4
- name: Copy and rename .env.simulation to .env
run: cp examples/.env.simulation .env
working-directory: ./
- name: Cache virtualenvs
uses: actions/cache@v4
id: cache
with:
path: |
.venv
.tox
key: run-system-tests-${{ runner.os }}-${{ matrix.configuration }}-${{ hashFiles('poetry.lock') }}
packages/service/.venv
packages/service/.tox
key: run-system-tests-${{ runner.os }}-${{ matrix.configuration }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install dependencies
run: poetry install -v
- name: Run system tests
Expand All @@ -40,5 +45,5 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: test_results
path: test_results/*.xml
path: ./packages/service/test_results/*.xml
if: always()
26 changes: 15 additions & 11 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,56 +36,60 @@ jobs:
uses: actions/cache/restore@v4
id: restore-nims-no-extras
with:
path: .venv
key: ni-measurement-plugin-sdk-service-no-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-no-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (no extras)
run: poetry install -v
working-directory: ./packages/service
- name: Save cached virtualenv (ni-measurement-plugin-sdk-service, no extras)
uses: actions/cache/save@v4
if: steps.restore-nims-no-extras.outputs.cache-hit != 'true'
with:
path: .venv
path: packages/service/.venv
key: ${{ steps.restore-nims-no-extras.outputs.cache-primary-key }}
- name: Run unit tests and code coverage (ni-measurement-plugin-sdk-service, no extras)
run: poetry run pytest ./tests/unit -v --cov=ni_measurement_plugin_sdk_service --junitxml=test_results/nims-${{ matrix.os }}-py${{ matrix.python-version}}-no-extras.xml
working-directory: ./packages/service

# ni-measurement-plugin-sdk-service, all extras
- name: Restore cached virtualenv (ni-measurement-plugin-sdk-service, all extras)
uses: actions/cache/restore@v4
id: restore-nims-all-extras
with:
path: .venv
key: ni-measurement-plugin-sdk-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/service/.venv
key: ni-measurement-plugin-sdk-service-all-extras-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/service/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-service (all extras)
run: poetry install -v --all-extras
working-directory: ./packages/service
- name: Save cached ni-measurement-plugin-sdk-service virtualenv (all extras)
uses: actions/cache/save@v4
if: steps.restore-nims-all-extras.outputs.cache-hit != 'true'
with:
path: .venv
path: packages/service/.venv
key: ${{ steps.restore-nims-all-extras.outputs.cache-primary-key }}
- name: Run unit tests and code coverage (ni-measurement-plugin-sdk-service, all extras)
run: poetry run pytest ./tests/unit -v --cov=ni_measurement_plugin_sdk_service --junitxml=test_results/nims-${{ matrix.os }}-py${{ matrix.python-version}}-all-extras.xml
working-directory: ./packages/service

# ni-measurement-plugin-sdk-generator
- name: Restore cached virtualenv (ni-measurement-plugin-sdk-generator)
uses: actions/cache/restore@v4
id: restore-nimg
with:
path: ni_measurement_plugin_sdk_generator/.venv
key: ni-measurement-plugin-sdk-generator-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
path: packages/generator/.venv
key: ni-measurement-plugin-sdk-generator-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('packages/generator/poetry.lock') }}
- name: Install ni-measurement-plugin-sdk-generator
run: poetry install -v
working-directory: ./ni_measurement_plugin_sdk_generator
working-directory: ./packages/generator
- name: Save cached virtualenv (ni-measurement-plugin-sdk-generator)
uses: actions/cache/save@v4
if: steps.restore-nimg.outputs.cache-hit != 'true'
with:
path: ni_measurement_plugin_sdk_generator/.venv
path: packages/generator/.venv
key: ${{ steps.restore-nimg.outputs.cache-primary-key }}
- name: Run tests and code coverage (ni-measurement-plugin-sdk-generator)
run: poetry run pytest -v --cov=ni_measurement_plugin_sdk_generator --junitxml=test_results/nimg-${{ matrix.os }}-py${{ matrix.python-version}}.xml
working-directory: ./ni_measurement_plugin_sdk_generator
working-directory: ./packages/generator

- name: Upload test results
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ build:
python: "3.9"
jobs:
post_create_environment:
- pip install poetry==1.2.2
- pip install poetry==1.8.2
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
post_install:
- poetry install --with docs

sphinx:
configuration: _docs_source/conf.py
configuration: packages/service/_docs_source/conf.py
2 changes: 1 addition & 1 deletion docs/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
measurementlink-python.readthedocs.io
measurement-plugin-python.readthedocs.io
23 changes: 23 additions & 0 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Measurement Plug-In SDK for Python
---

## Introduction

Measurement Plug-In SDK for Python (`ni-measurement-plugin-sdk`) is a
tool for generating and writing reusable measurement plug-ins using gRPC services.

The purpose of this package is as a meta-package that depends on `ni-measurement-plugin-sdk-generator`
and `ni-measurement-plugin-sdk-service` so as to easily install all the things needed for the
Measurement Plug-In SDK.

For installation and usage, see [Measurement Plug-In SDK for Python (`ni-measurement-plugin-sdk-service`)](https://pypi.org/project/ni-measurement-plugin-sdk-service/).

---

## Dependencies

- Python >= 3.8 [(3.9 recommended)](https://www.python.org/downloads/release/python-3913/)
- [mako >= 1.2.1, < 2.x](https://pypi.org/project/Mako/1.2.1/)
- [click >= 8.1.3](https://pypi.org/project/click/8.1.3/)

---
1 change: 1 addition & 0 deletions packages/sdk/ni_measurement_plugin_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Measurement Plugin SDK for Python."""
Loading
Loading