From f09f59bcc617b46618d85443f1f2f0185e8d0e45 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 13:53:47 +0000 Subject: [PATCH 1/3] chore(deps): update dependency streamlit to v1.50.0 --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 87609df..a13fa14 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3054,14 +3054,14 @@ files = [ [[package]] name = "streamlit" -version = "1.49.1" +version = "1.50.0" description = "A faster way to build and share data apps" optional = false python-versions = "!=3.9.7,>=3.9" groups = ["main", "examples"] files = [ - {file = "streamlit-1.49.1-py3-none-any.whl", hash = "sha256:ad7b6d0dc35db168587acf96f80378249467fc057ed739a41c511f6bf5aa173b"}, - {file = "streamlit-1.49.1.tar.gz", hash = "sha256:6f213f1e43f035143a56f58ad50068d8a09482f0a2dad1050d7e7e99a9689818"}, + {file = "streamlit-1.50.0-py3-none-any.whl", hash = "sha256:9403b8f94c0a89f80cf679c2fcc803d9a6951e0fba542e7611995de3f67b4bb3"}, + {file = "streamlit-1.50.0.tar.gz", hash = "sha256:87221d568aac585274a05ef18a378b03df332b93e08103fffcf3cd84d852af46"}, ] [package.dependencies] From 6abbb11aeb9462e65ab646eeeea42ecb4170ab82 Mon Sep 17 00:00:00 2001 From: Mike Prosser Date: Tue, 14 Oct 2025 16:16:46 -0500 Subject: [PATCH 2/3] add some copilot instructions --- .github/copilot-instructions.md | 180 ++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..95b7859 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,180 @@ +# Copilot Instructions for nipanel-python + +## Repository Overview + +**nipanel** is a Python package that provides support for creating and controlling measurement and visualization panels. It's developed by NI and enables Python applications to create Streamlit-based panels that can be served and controlled via gRPC services. + +### Key Repository Information +- **Language**: Python (3.9+) +- **Package Manager**: Poetry 2.1+ +- **Framework**: Uses Streamlit for panel UI, gRPC for communication +- **Size**: Medium-sized repository (~1300 lines of code in src/) +- **Architecture**: Client-server model with Python panel service and Streamlit frontend +- **Testing**: Comprehensive test suite with unit, integration, and acceptance tests + +## Build and Validation Commands + +**CRITICAL**: Always run commands in this exact order for successful builds and validation. + +### Environment Setup +```powershell +# 1. Verify Poetry is installed (required version 2.1+) +poetry --version + +# 2. Install project dependencies (ALWAYS run first) +poetry install + +# 3. For examples and development work +poetry install --with examples + +# 4. For documentation work +poetry install --with docs +``` + +### Development Workflow Commands +Follow this sequence when making changes: + +```powershell +# 1. Run linting (shows warnings but continues) +poetry run nps lint + +# 2. Apply automatic formatting fixes +poetry run nps fix + +# 3. Run static type checking (must pass) +poetry run mypy + +# 4. Run security analysis (must pass) +poetry run bandit -c pyproject.toml -r src/nipanel + +# 5. Run all tests (must pass) +poetry run pytest -v + +# 6. Run only unit tests (faster feedback) +poetry run pytest ./tests/unit -v + +# 7. Run tests with coverage +poetry run pytest ./tests/unit -v --cov=nipanel +``` + +### Documentation Build +```powershell +# Build documentation (may fail due to external SSL cert issues - this is expected) +poetry run sphinx-build docs docs/_build --builder html --fail-on-warning +``` + +### Runtime Requirements +- **Python**: 3.9+ (excludes 3.9.7 due to Streamlit incompatibility) +- **Poetry**: 2.1+ required for build system +- **Virtual Environment**: Configured in-project (`.venv/` directory) + +## Project Layout and Architecture + +### Source Code Structure +``` +src/nipanel/ # Main package directory +├── __init__.py # Public API exports +├── _streamlit_panel.py # Core StreamlitPanel class +├── _panel_client.py # gRPC client for panel communication +├── _panel_value_accessor.py # Value management for panels +├── _streamlit_panel_initializer.py # Panel creation utilities +├── _convert.py # Type conversion utilities +├── controls/ # Streamlit UI control components +├── converters/ # Type conversion modules +├── panel_refresh/ # Panel refresh functionality +└── streamlit_refresh/ # Streamlit-specific refresh logic +``` + +### Configuration Files +- **pyproject.toml**: Main project configuration, dependencies, tool settings +- **poetry.toml**: Poetry configuration (sets `in-project = true` for venv) +- **.github/workflows/**: Complete CI/CD pipeline + +### Test Structure +``` +tests/ +├── unit/ # Unit tests (primary test suite) +├── integration/ # Integration tests +├── acceptance/ # End-to-end acceptance tests +├── utils/ # Test utilities and fakes +└── conftest.py # Pytest configuration and fixtures +``` + +### Examples +``` +examples/ +├── hello/ # Basic panel example +├── all_types/ # Demonstrates all supported data types +├── simple_graph/ # Graph visualization example +├── nidaqmx/ # Hardware integration examples +└── performance_checker/ # Performance monitoring example +``` + +## CI/CD Pipeline + +The repository uses a comprehensive GitHub Actions pipeline: + +1. **check_nipanel.yml**: Runs on Windows, Ubuntu, macOS with Python 3.9, 3.13 + - Linting with `poetry run nps lint` + - Type checking with `poetry run mypy` + - Security scanning with `poetry run bandit -c pyproject.toml -r src/nipanel` + +2. **run_unit_tests.yml**: Cross-platform testing (Windows, Ubuntu) with Python 3.9-3.13 + - Unit tests: `poetry run pytest ./tests/unit -v --cov=nipanel --junitxml=test_results/nipanel-{os}-py{version}.xml` + +3. **check_docs.yml**: Documentation validation + - Lock file verification: `poetry check --lock` + - Documentation build: `poetry run sphinx-build docs docs/_build -b html -W` + +### Key Dependencies +- **Core Runtime**: grpcio, protobuf, streamlit, nitypes, numpy, debugpy +- **NI Packages**: ni-grpc-extensions, ni-measurementlink-discovery-v1-client, ni-protobuf-types, ni-panels-v1-proto +- **Development Tools**: ni-python-styleguide, mypy, bandit, pytest + +## Architecture Overview + +**nipanel** implements a client-server architecture: + +1. **Python Application**: Uses nipanel API to create and control panels +2. **Panel Service**: Separate gRPC service (PythonPanelService - external dependency) +3. **Streamlit Frontend**: Web-based UI for the panels +4. **Communication**: gRPC for Python ↔ Service, HTTP for Service ↔ Streamlit + +### Core Classes +- `StreamlitPanel`: Main panel interface +- `PanelValueAccessor`: Manages panel state and values +- `create_streamlit_panel()`: Factory function for panel creation + +## Validation Steps + +### Pre-commit Validation (replicate CI locally) +```powershell +# Complete validation sequence +poetry install +poetry run nps lint +poetry run nps fix +poetry run mypy +poetry run bandit -c pyproject.toml -r src/nipanel +poetry run pytest -v +``` + +### Common Issues and Solutions + +1. **Poetry Lock Issues**: Run `poetry check --lock` to verify lock file consistency +2. **Import Warnings**: flake8_import_order pkg_resources warnings are expected and harmless +3. **Documentation SSL Errors**: External inventory fetch failures are known issues +4. **Python 3.9.7**: Excluded due to Streamlit incompatibility - use different Python 3.9.x version + +### File System Requirements +- Virtual environment created in `.venv/` (configured in poetry.toml) +- Test results written to `test_results/` directory +- Documentation built to `docs/_build/` + +## Trust These Instructions + +These instructions are comprehensive and tested. Only perform additional searches if: +- Commands fail unexpectedly +- You need to understand specific implementation details not covered here +- You're working with files not mentioned in this overview + +The build and test commands listed here are the authoritative source - they match exactly what the CI pipeline runs and have been validated to work correctly. \ No newline at end of file From ca08aa0a27b18795efcfd1e3cfad56d987d82bbd Mon Sep 17 00:00:00 2001 From: Mike Prosser Date: Tue, 14 Oct 2025 16:16:46 -0500 Subject: [PATCH 3/3] add some copilot instructions --- .github/copilot-instructions.md | 180 ++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..95b7859 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,180 @@ +# Copilot Instructions for nipanel-python + +## Repository Overview + +**nipanel** is a Python package that provides support for creating and controlling measurement and visualization panels. It's developed by NI and enables Python applications to create Streamlit-based panels that can be served and controlled via gRPC services. + +### Key Repository Information +- **Language**: Python (3.9+) +- **Package Manager**: Poetry 2.1+ +- **Framework**: Uses Streamlit for panel UI, gRPC for communication +- **Size**: Medium-sized repository (~1300 lines of code in src/) +- **Architecture**: Client-server model with Python panel service and Streamlit frontend +- **Testing**: Comprehensive test suite with unit, integration, and acceptance tests + +## Build and Validation Commands + +**CRITICAL**: Always run commands in this exact order for successful builds and validation. + +### Environment Setup +```powershell +# 1. Verify Poetry is installed (required version 2.1+) +poetry --version + +# 2. Install project dependencies (ALWAYS run first) +poetry install + +# 3. For examples and development work +poetry install --with examples + +# 4. For documentation work +poetry install --with docs +``` + +### Development Workflow Commands +Follow this sequence when making changes: + +```powershell +# 1. Run linting (shows warnings but continues) +poetry run nps lint + +# 2. Apply automatic formatting fixes +poetry run nps fix + +# 3. Run static type checking (must pass) +poetry run mypy + +# 4. Run security analysis (must pass) +poetry run bandit -c pyproject.toml -r src/nipanel + +# 5. Run all tests (must pass) +poetry run pytest -v + +# 6. Run only unit tests (faster feedback) +poetry run pytest ./tests/unit -v + +# 7. Run tests with coverage +poetry run pytest ./tests/unit -v --cov=nipanel +``` + +### Documentation Build +```powershell +# Build documentation (may fail due to external SSL cert issues - this is expected) +poetry run sphinx-build docs docs/_build --builder html --fail-on-warning +``` + +### Runtime Requirements +- **Python**: 3.9+ (excludes 3.9.7 due to Streamlit incompatibility) +- **Poetry**: 2.1+ required for build system +- **Virtual Environment**: Configured in-project (`.venv/` directory) + +## Project Layout and Architecture + +### Source Code Structure +``` +src/nipanel/ # Main package directory +├── __init__.py # Public API exports +├── _streamlit_panel.py # Core StreamlitPanel class +├── _panel_client.py # gRPC client for panel communication +├── _panel_value_accessor.py # Value management for panels +├── _streamlit_panel_initializer.py # Panel creation utilities +├── _convert.py # Type conversion utilities +├── controls/ # Streamlit UI control components +├── converters/ # Type conversion modules +├── panel_refresh/ # Panel refresh functionality +└── streamlit_refresh/ # Streamlit-specific refresh logic +``` + +### Configuration Files +- **pyproject.toml**: Main project configuration, dependencies, tool settings +- **poetry.toml**: Poetry configuration (sets `in-project = true` for venv) +- **.github/workflows/**: Complete CI/CD pipeline + +### Test Structure +``` +tests/ +├── unit/ # Unit tests (primary test suite) +├── integration/ # Integration tests +├── acceptance/ # End-to-end acceptance tests +├── utils/ # Test utilities and fakes +└── conftest.py # Pytest configuration and fixtures +``` + +### Examples +``` +examples/ +├── hello/ # Basic panel example +├── all_types/ # Demonstrates all supported data types +├── simple_graph/ # Graph visualization example +├── nidaqmx/ # Hardware integration examples +└── performance_checker/ # Performance monitoring example +``` + +## CI/CD Pipeline + +The repository uses a comprehensive GitHub Actions pipeline: + +1. **check_nipanel.yml**: Runs on Windows, Ubuntu, macOS with Python 3.9, 3.13 + - Linting with `poetry run nps lint` + - Type checking with `poetry run mypy` + - Security scanning with `poetry run bandit -c pyproject.toml -r src/nipanel` + +2. **run_unit_tests.yml**: Cross-platform testing (Windows, Ubuntu) with Python 3.9-3.13 + - Unit tests: `poetry run pytest ./tests/unit -v --cov=nipanel --junitxml=test_results/nipanel-{os}-py{version}.xml` + +3. **check_docs.yml**: Documentation validation + - Lock file verification: `poetry check --lock` + - Documentation build: `poetry run sphinx-build docs docs/_build -b html -W` + +### Key Dependencies +- **Core Runtime**: grpcio, protobuf, streamlit, nitypes, numpy, debugpy +- **NI Packages**: ni-grpc-extensions, ni-measurementlink-discovery-v1-client, ni-protobuf-types, ni-panels-v1-proto +- **Development Tools**: ni-python-styleguide, mypy, bandit, pytest + +## Architecture Overview + +**nipanel** implements a client-server architecture: + +1. **Python Application**: Uses nipanel API to create and control panels +2. **Panel Service**: Separate gRPC service (PythonPanelService - external dependency) +3. **Streamlit Frontend**: Web-based UI for the panels +4. **Communication**: gRPC for Python ↔ Service, HTTP for Service ↔ Streamlit + +### Core Classes +- `StreamlitPanel`: Main panel interface +- `PanelValueAccessor`: Manages panel state and values +- `create_streamlit_panel()`: Factory function for panel creation + +## Validation Steps + +### Pre-commit Validation (replicate CI locally) +```powershell +# Complete validation sequence +poetry install +poetry run nps lint +poetry run nps fix +poetry run mypy +poetry run bandit -c pyproject.toml -r src/nipanel +poetry run pytest -v +``` + +### Common Issues and Solutions + +1. **Poetry Lock Issues**: Run `poetry check --lock` to verify lock file consistency +2. **Import Warnings**: flake8_import_order pkg_resources warnings are expected and harmless +3. **Documentation SSL Errors**: External inventory fetch failures are known issues +4. **Python 3.9.7**: Excluded due to Streamlit incompatibility - use different Python 3.9.x version + +### File System Requirements +- Virtual environment created in `.venv/` (configured in poetry.toml) +- Test results written to `test_results/` directory +- Documentation built to `docs/_build/` + +## Trust These Instructions + +These instructions are comprehensive and tested. Only perform additional searches if: +- Commands fail unexpectedly +- You need to understand specific implementation details not covered here +- You're working with files not mentioned in this overview + +The build and test commands listed here are the authoritative source - they match exactly what the CI pipeline runs and have been validated to work correctly. \ No newline at end of file