-
Couldn't load subscription status.
- Fork 0
Implement Task AB#3090157 - Create poetry project and generate gRPC stubs #1
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
Merged
mikeprosserni
merged 8 commits into
main
from
users/mprosser/task-3090157-poetry-and-stubs
Apr 18, 2025
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0f20ae1
poetry project and generated gRPC stubs
01d3ec4
add files from github-repo-template
05837fc
fill out workflows, issue template, folder structure, etc
0eec50f
exclude generated stubs from ni-python-styleguide and fix black issues
6964d06
add settings for mypy (excluding generated stub files)
6c2c7ed
add tool.poetry.group.test.dependencies
edf01a2
poetry lock
af5873d
clean up yml and toml files
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Default code owner for nipanel-python | ||
| mikeprosserni |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| name: Bug report | ||
| about: Create a report to help us improve | ||
| title: '' | ||
| labels: 'bug,triage' | ||
| --- | ||
|
|
||
| <!--- | ||
| Thanks for filing an issue! Before you submit, please read the following: | ||
|
|
||
| Search open/closed issues before submitting. Someone may have reported the same issue before. | ||
| --> | ||
|
|
||
| # Bug Report | ||
|
|
||
| <!--- Provide a general summary of the issue here --> | ||
|
|
||
| ## Repro or Code Sample | ||
|
|
||
| <!-- Please provide steps to reproduce the issue and/or a code repository, gist, code snippet or sample files --> | ||
|
|
||
| ## Expected Behavior | ||
|
|
||
| <!--- Tell us what should happen --> | ||
|
|
||
| ## Current Behavior | ||
|
|
||
| <!--- Tell us what happens instead of the expected behavior --> | ||
| <!--- If you are seeing an error, please include the full error message and stack trace --> | ||
| <!--- If applicable, provide screenshots --> | ||
|
|
||
| ## Possible Solution | ||
|
|
||
| <!--- Not obligatory, but suggest a fix/reason for the bug --> | ||
| <!--- Please let us know if you'd be willing to contribute the fix; we'd be happy to work with you --> | ||
|
|
||
| ## Context | ||
|
|
||
| <!--- How has this issue affected you? What are you trying to accomplish? --> | ||
| <!--- Providing context helps us come up with a solution that is most useful in the real world --> | ||
|
|
||
| ## Your Environment | ||
|
|
||
| <!--- Include as many relevant details as possible about the environment you experienced the bug in --> | ||
|
|
||
| * `nipanel` version | ||
| * Python version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| name: Feature request | ||
| about: Suggest an idea for this project | ||
| title: '' | ||
| labels: 'enhancement,triage' | ||
| --- | ||
|
|
||
| <!--- | ||
| Thanks for filing an issue! Before you submit, please read the following: | ||
|
|
||
| Search open/closed issues before submitting. Someone may have requested the same feature before. | ||
| --> | ||
|
|
||
| ## Problem to Solve | ||
|
|
||
| <!--- Provide a clear and concise description of why this feature is wanted or what problem it solves. --> | ||
|
|
||
| ## Proposed Solution | ||
|
|
||
| <!--- Provide a clear and concise description of the feature you're proposing. --> | ||
|
|
||
| <!--- The implementing team may build a list of tasks/sub-issues here: | ||
| ## Tasks | ||
| - [ ] This is a subtask of the feature. (It can be converted to an issue.) | ||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| name: Tech debt | ||
| about: (DEV TEAM ONLY) Non-user-visible improvement to code or development process | ||
| title: '' | ||
| labels: 'tech debt,triage' | ||
| --- | ||
| ## Tech Debt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| name: User story | ||
| about: (DEV TEAM ONLY) A small chunk of work to be done | ||
| title: '(Fully descriptive title)' | ||
| labels: 'user story,triage' | ||
| --- | ||
|
|
||
| <!-- Ensure the title can be understood without the parent item's context, e.g. "nimble-button Angular wrapper" rather than just "Angular wrapper" --> | ||
|
|
||
| ## User Story |
mikeprosserni marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ### What does this Pull Request accomplish? | ||
|
|
||
| TODO: Include high-level description of the changes in this pull request. | ||
|
|
||
| ### Why should this Pull Request be merged? | ||
|
|
||
| TODO: Justify why this contribution should be part of the project. | ||
|
|
||
| ### What testing has been done? | ||
|
|
||
| TODO: Detail what testing has been done to ensure this submission meets requirements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'releases/**' | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| check_nipanel: | ||
| name: Check | ||
| uses: ./.github/workflows/check_nipanel.yml | ||
| run_unit_tests: | ||
| name: Run unit tests | ||
| uses: ./.github/workflows/run_unit_tests.yml | ||
| needs: [check_nipanel] | ||
| report_test_results: | ||
| name: Report test results | ||
| uses: ./.github/workflows/report_test_results.yml | ||
| needs: [run_unit_tests] | ||
| if: always() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - 'releases/**' | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| run_ci: | ||
| name: Run CI | ||
| uses: ./.github/workflows/CI.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Check nipanel | ||
|
|
||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| POETRY_VERSION: 1.8.2 | ||
| PYTHON_VERSION: 3.11.9 | ||
|
|
||
| jobs: | ||
| check_nipanel: | ||
| name: Check nipanel | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repo | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| id: setup-python | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| - name: Set up Poetry | ||
| uses: Gr1N/setup-poetry@v9 | ||
| with: | ||
| poetry-version: ${{ env.POETRY_VERSION }} | ||
| - name: Check for lock changes | ||
| run: poetry check --lock | ||
| - name: Restore cached virtualenv | ||
| uses: actions/cache/restore@v4 | ||
| id: restore-nipanel | ||
| with: | ||
| path: .venv | ||
| key: nipanel-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | ||
| - name: Install nipanel | ||
| run: poetry install -v | ||
| - name: Save cached virtualenv | ||
| uses: actions/cache/save@v4 | ||
| if: steps.restore-nipanel.outputs.cache-hit != 'true' | ||
| with: | ||
| path: .venv | ||
mikeprosserni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| key: ${{ steps.restore-nipanel.outputs.cache-primary-key }} | ||
mikeprosserni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Lint | ||
| run: poetry run ni-python-styleguide lint ./src/nipanel ./tests ./examples | ||
bkeryan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Mypy static analysis (Linux) | ||
| run: poetry run mypy | ||
| - name: Mypy static analysis (Windows) | ||
| run: poetry run mypy --platform win32 | ||
| - name: Bandit security checks | ||
| run: poetry run bandit -c pyproject.toml -r src/nipanel | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Report test results | ||
|
|
||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| report_test_results: | ||
| name: Report test results | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repo | ||
| uses: actions/checkout@v4 | ||
| - name: Download test results | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: test_results | ||
| pattern: test_results_* | ||
| merge-multiple: true | ||
| - name: List downloaded files | ||
| run: ls -lR | ||
| - name: Publish test results | ||
| uses: EnricoMi/publish-unit-test-result-action@v2 | ||
| with: | ||
| files: "test_results/**/*.xml" | ||
| if: always() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Run unit tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| POETRY_VERSION: 1.8.2 | ||
|
|
||
| jobs: | ||
| run_unit_tests: | ||
| name: Run unit tests | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [windows-latest, ubuntu-latest] | ||
| python-version: [3.9, '3.10', 3.11, 3.12, 3.13] | ||
| # Fail-fast skews the pass/fail ratio and seems to make pytest produce | ||
| # incomplete JUnit XML results. | ||
| fail-fast: false | ||
| steps: | ||
| - name: Check out repo | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| id: setup-python | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Set up Poetry | ||
| uses: Gr1N/setup-poetry@v9 | ||
| with: | ||
| poetry-version: ${{ env.POETRY_VERSION }} | ||
| - name: Restore cached virtualenv | ||
| uses: actions/cache/restore@v4 | ||
| id: restore-nipanel | ||
| with: | ||
| path: .venv | ||
| key: nipanel-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | ||
| - name: Install nipanel | ||
| run: poetry install -v | ||
| - name: Save cached virtualenv | ||
| uses: actions/cache/save@v4 | ||
| if: steps.restore-nipanel.outputs.cache-hit != 'true' | ||
| with: | ||
| path: .venv | ||
| key: ${{ steps.restore-nipanel.outputs.cache-primary-key }} | ||
mikeprosserni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Run unit tests and code coverage | ||
| run: poetry run pytest ./tests/unit -v --cov=nipanel --junitxml=test_results/nipanel-${{ matrix.os }}-py${{ matrix.python-version }}.xml | ||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }} | ||
| path: ./test_results/*.xml | ||
| if: always() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Sync issue to Azure DevOps work item | ||
|
|
||
| on: | ||
| issues: | ||
| # Omit "labeled" and "unlabeled" to work around https://github.com/danhellem/github-actions-issue-to-work-item/issues/70 | ||
| types: | ||
| [opened, edited, deleted, closed, reopened, assigned] | ||
| issue_comment: | ||
| types: [created, edited, deleted] | ||
|
|
||
| jobs: | ||
| alert: | ||
| if: ${{ !github.event.issue.pull_request && github.event.issue.title != 'Dependency Dashboard' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Choose work item type | ||
| id: choose_work_item_type | ||
| run: | | ||
| if [ "${{ contains(github.event.issue.labels.*.name, 'enhancement') || contains(github.event.issue.labels.*.name, 'user story') }}" == "true" ]; then | ||
| echo "work_item_type=User Story" >> $GITHUB_OUTPUT | ||
| elif [ "${{ contains(github.event.issue.labels.*.name, 'tech debt') }}" == "true" ]; then | ||
| echo "work_item_type=Technical Debt" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "work_item_type=Bug" >> $GITHUB_OUTPUT | ||
| fi | ||
| - uses: danhellem/[email protected] | ||
| env: | ||
| ado_token: "${{ secrets.AZDO_WORK_ITEM_TOKEN }}" | ||
| github_token: "${{ secrets.GH_REPO_TOKEN }}" | ||
| ado_organization: "ni" | ||
| ado_project: "DevCentral" | ||
| ado_area_path: "DevCentral\\Product RnD\\Platform HW and SW\\SW New Invest and Tech\\ETW\\Python CodeGen" | ||
| ado_wit: "${{ steps.choose_work_item_type.outputs.work_item_type }}" | ||
| ado_new_state: "New" | ||
| ado_active_state: "Active" | ||
| ado_close_state: "Closed" | ||
| ado_bypassrules: true | ||
| log_level: 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Contributing to nipanel-python | ||
|
|
||
| Contributions to nipanel-python are welcome from all! | ||
|
|
||
| nipanel-python is managed via [git](https://git-scm.com), with the canonical upstream | ||
| repository hosted on [GitHub](https://github.com/ni/<reponame>/). | ||
|
|
||
| nipanel-python follows a pull-request model for development. If you wish to | ||
| contribute, you will need to create a GitHub account, fork this project, push a | ||
| branch with your changes to your project, and then submit a pull request. | ||
|
|
||
| Please remember to sign off your commits (e.g., by using `git commit -s` if you | ||
| are using the command line client). This amends your git commit message with a line | ||
| of the form `Signed-off-by: Name Lastname <[email protected]>`. Please | ||
| include all authors of any given commit into the commit message with a | ||
| `Signed-off-by` line. This indicates that you have read and signed the Developer | ||
| Certificate of Origin (see below) and are able to legally submit your code to | ||
| this repository. | ||
|
|
||
| See [GitHub's official documentation](https://help.github.com/articles/using-pull-requests/) for more details. | ||
|
|
||
| # Getting Started | ||
|
|
||
| This is the command to generate the files in /src/ni/pythonpanel/v1/: | ||
| `poetry run python -m grpc_tools.protoc --proto_path=protos --python_out=src/ --grpc_python_out=src/ ni/pythonpanel/v1/python_panel_service.proto` | ||
|
|
||
| # Testing | ||
|
|
||
| - TODO: include testing steps here. | ||
|
|
||
| # Developer Certificate of Origin (DCO) | ||
|
|
||
| Developer's Certificate of Origin 1.1 | ||
|
|
||
| By making a contribution to this project, I certify that: | ||
|
|
||
| (a) The contribution was created in whole or in part by me and I | ||
| have the right to submit it under the open source license | ||
| indicated in the file; or | ||
|
|
||
| (b) The contribution is based upon previous work that, to the best | ||
| of my knowledge, is covered under an appropriate open source | ||
| license and I have the right under that license to submit that | ||
| work with modifications, whether created in whole or in part | ||
| by me, under the same open source license (unless I am | ||
| permitted to submit under a different license), as indicated | ||
| in the file; or | ||
|
|
||
| (c) The contribution was provided directly to me by some other | ||
| person who certified (a), (b) or (c) and I have not modified | ||
| it. | ||
|
|
||
| (d) I understand and agree that this project and the contribution | ||
| are public and that a record of the contribution (including all | ||
| personal information I submit with it, including my sign-off) is | ||
| maintained indefinitely and may be redistributed consistent with | ||
| this project or the open source license(s) involved. | ||
|
|
||
| (taken from [developercertificate.org](https://developercertificate.org/)) | ||
|
|
||
| See [LICENSE](https://github.com/ni/<reponame>/blob/main/LICENSE) | ||
| for details about how \<reponame\> is licensed. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.