You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated client for NiFI-2.6.0. Fixed augmentation system to correctly pass env vars. Updated contributing guide to explain common issues and how nifi and registry differ on security. Fixed mustache templates for new NiFi security schemes.Fixed make file passing through env vars to client generator (#391)
Copy file name to clipboardExpand all lines: docs/contributing.rst
+172Lines changed: 172 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,178 @@ Ready to contribute? Here's how to set up `nipyapi` for local development.
112
112
113
113
8. Submit a pull request through the GitHub website.
114
114
115
+
Common Mistakes to Avoid
116
+
------------------------
117
+
118
+
When contributing to NiPyAPI, watch out for these frequent pitfalls:
119
+
120
+
**Installation & Environment**
121
+
122
+
* **Bracket quoting in zsh**: Running ``pip install -e .[dev]`` fails in zsh due to glob expansion. Always use quotes: ``pip install -e ".[dev]"`` or use ``make dev-install``.
123
+
* **Wrong Python version**: Project supports Python 3.9-3.12. Using 3.8 (end of life) or 3.13+ (untested) may cause compatibility issues.
124
+
* **Missing virtual environment**: Always activate a virtual environment before installing dependencies to avoid polluting system Python.
125
+
126
+
**Testing**
127
+
128
+
* **Missing NIPYAPI_PROFILE**: Never run ``pytest`` without setting ``NIPYAPI_PROFILE`` environment variable. Always use ``make test NIPYAPI_PROFILE=single-user`` or equivalent.
129
+
* **Services not ready**: Never assume Docker services are immediately ready after ``make up``. Always run ``make wait-ready NIPYAPI_PROFILE=<profile>`` before testing.
130
+
* **Stale certificates**: If you encounter certificate errors, run ``make down`` then ``make certs`` to regenerate fresh certificates. Never run ``make certs`` while containers are running.
131
+
132
+
**Code Quality**
133
+
134
+
* **Modifying generated code**: Never edit files in ``nipyapi/nifi/``, ``nipyapi/registry/``, or ``nipyapi/_version.py``. These are auto-generated and your changes will be overwritten.
135
+
* **Skipping lint checks**: Always run ``make lint`` before committing. Both flake8 and pylint must pass.
136
+
* **Incorrect line length**: Project uses 100-character line limit consistently across all tools (flake8, pylint, black, isort).
137
+
138
+
**NiFi vs Registry Security Differences**
139
+
140
+
**Important:** NiFi and Registry have different security implementations in their OpenAPI specifications:
141
+
142
+
* **NiFi 2.6.0+**: Includes native security schemes (``HTTPBearerJWT``, ``CookieSecureAuthorizationBearer``) in base OpenAPI spec
143
+
* **Registry 2.6.0+**: Has NO security schemes in base OpenAPI spec - requires augmentation
144
+
145
+
**Key implications:**
146
+
147
+
* Registry augmentation scripts (``resources/client_gen/augmentations/registry_security.py``) remain necessary even though NiFi 2.6.0 has native security
148
+
* Both services use the same authentication flow: username/password → JWT token → Bearer auth
149
+
* The template (``configuration.mustache``) handles both cases via hardcoded ``bearerAuth`` fallback plus native scheme aliases
150
+
* Always use ``augmented`` variant when regenerating clients (default) to support both NiFi and Registry
151
+
* NiFi can work without augmentation using the ``base`` variant (2.6.0+), but Registry cannot
152
+
153
+
**Docker & Infrastructure**
154
+
155
+
* **Docker volume caching**: If you experience persistent issues, run ``make clean-docker`` to remove all containers and volumes, then restart the setup process.
156
+
* **Wrong profile for test**: Ensure your ``NIPYAPI_PROFILE`` matches the profile you started with ``make up``. Mixing profiles causes authentication failures.
157
+
158
+
Make Targets Quick Reference
159
+
-----------------------------
160
+
161
+
NiPyAPI uses Makefile targets as the primary automation interface. Run ``make help`` to see all available targets organized by category.
162
+
163
+
**Setup & Installation**
164
+
::
165
+
166
+
make dev-install # Install package with dev dependencies (recommended)
167
+
make docs-install # Install documentation dependencies
168
+
make clean # Remove build, pyc, and temp artifacts
169
+
make clean-all # Nuclear clean: removes ALL including generated code
170
+
171
+
**Testing Workflow**
172
+
::
173
+
174
+
# Basic test workflow
175
+
make certs # Generate certificates (once)
176
+
make up NIPYAPI_PROFILE=single-user # Start Docker services
177
+
make wait-ready NIPYAPI_PROFILE=single-user # Wait for readiness
178
+
make test NIPYAPI_PROFILE=single-user # Run tests
179
+
make down # Stop services
180
+
181
+
# Shortcuts for specific profiles
182
+
make test-su # single-user profile
183
+
make test-ldap # secure-ldap profile
184
+
make test-mtls # secure-mtls profile
185
+
186
+
# Comprehensive testing
187
+
make test-all # Run all automated profiles (single-user, ldap, mtls)
188
+
make coverage # Run tests with coverage report
189
+
190
+
**Code Quality**
191
+
::
192
+
193
+
make lint # Run flake8 + pylint (excludes generated code)
194
+
make flake8 # Run flake8 only
195
+
make pylint # Run pylint only
196
+
make pre-commit # Run pre-commit hooks on all files
197
+
198
+
# Formatting (manual)
199
+
black nipyapi/ && isort nipyapi/ # Auto-format code
200
+
201
+
**Docker Operations**
202
+
::
203
+
204
+
make certs # Generate PKCS12 certificates for secure profiles
205
+
make up NIPYAPI_PROFILE=<profile> # Start specific profile
206
+
make down # Stop all Docker services
207
+
make wait-ready NIPYAPI_PROFILE=<profile> # Wait for services to be ready
208
+
make clean-docker # Comprehensive Docker cleanup
209
+
210
+
# Available profiles: single-user, secure-ldap, secure-mtls, secure-oidc
211
+
212
+
**Build & Documentation**
213
+
::
214
+
215
+
make dist # Build wheel and source distribution
216
+
make check-dist # Validate distribution files
217
+
make test-dist # Test that distribution can be imported
218
+
make docs # Generate Sphinx documentation
219
+
220
+
**Complete Workflows**
221
+
::
222
+
223
+
make sandbox NIPYAPI_PROFILE=single-user # Create sandbox with sample objects
224
+
make rebuild-all # Comprehensive rebuild: clean → certs → APIs → clients → test → build → docs
225
+
226
+
Generated vs Maintained Code
227
+
-----------------------------
228
+
229
+
Understanding which code is generated vs maintained is crucial for contributing:
230
+
231
+
**Generated Code (DO NOT MODIFY)**
232
+
233
+
These files are automatically generated from OpenAPI specifications and should never be edited directly:
234
+
235
+
* ``nipyapi/nifi/`` - NiFi API client
236
+
* ``nipyapi/registry/`` - Registry API client
237
+
* ``nipyapi/_version.py`` - Git version via setuptools-scm
238
+
239
+
**Why this matters:**
240
+
241
+
1. Your changes will be overwritten during the next client generation
242
+
2. These files are excluded from linting (flake8, pylint, black, isort)
0 commit comments