Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
Report Bugs
Report bugs at https://github.com/Chaffelson/nipyapi/issues.
If you are reporting a bug, please include:
Your operating system name and version.
Any details about your local setup that might be helpful in troubleshooting.
Detailed steps to reproduce the bug.
Fix Bugs
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation
Nipyapi could always use more documentation, whether as part of the official Nipyapi docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback
The best way to send feedback is to file an issue at https://github.com/Chaffelson/nipyapi/issues.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!
Ready to contribute? Here’s how to set up nipyapi for local development.
Fork the nipyapi repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:Chaffelson/nipyapi.git
Create and activate a Python 3.9+ virtual environment (venv or conda), then install dev extras:
# using venv $ python -m venv .venv && source .venv/bin/activate $ cd nipyapi/ $ pip install -e ".[dev]" # or using conda $ conda create -n nipyapi-dev python=3.11 -y $ conda activate nipyapi-dev $ pip install -e ".[dev]"
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
You may want to leverage the provided Docker profiles for testing and development
Install the latest version of Docker
Use the provided Docker Compose configuration in resources/docker/compose.yml and run tests via Makefile:
# generate local test certificates (run once or after cleanup) $ make certs # bring up single-user profile and wait for readiness $ make up NIPYAPI_PROFILE=single-user $ make wait-ready NIPYAPI_PROFILE=single-user # run tests (conftest resolves URLs, credentials, and TLS for the profile) $ make test # bring everything down when done $ make down
When you’re done making changes, run the test suites for all profiles:
# convenience shortcuts $ make test-all
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Common Mistakes to Avoid
When contributing to NiPyAPI, watch out for these frequent pitfalls:
Installation & Environment
Bracket quoting in zsh: Running
pip install -e .[dev]fails in zsh due to glob expansion. Always use quotes:pip install -e ".[dev]"or usemake dev-install.Wrong Python version: Project supports Python 3.9-3.12. Using 3.8 (end of life) or 3.13+ (untested) may cause compatibility issues.
Missing virtual environment: Always activate a virtual environment before installing dependencies to avoid polluting system Python.
Testing
Missing NIPYAPI_PROFILE: Never run
pytestwithout settingNIPYAPI_PROFILEenvironment variable. Always usemake test NIPYAPI_PROFILE=single-useror equivalent.Services not ready: Never assume Docker services are immediately ready after
make up. Always runmake wait-ready NIPYAPI_PROFILE=<profile>before testing.Stale certificates: If you encounter certificate errors, run
make downthenmake certsto regenerate fresh certificates. Never runmake certswhile containers are running.
Code Quality
Modifying generated code: Never edit files in
nipyapi/nifi/,nipyapi/registry/, ornipyapi/_version.py. These are auto-generated and your changes will be overwritten.Skipping lint checks: Always run
make lintbefore committing. Both flake8 and pylint must pass.Incorrect line length: Project uses 100-character line limit consistently across all tools (flake8, pylint, black, isort).
NiFi vs Registry Security Differences
Important: NiFi and Registry have different security implementations in their OpenAPI specifications:
NiFi 2.6.0+: Includes native security schemes (
HTTPBearerJWT,CookieSecureAuthorizationBearer) in base OpenAPI specRegistry 2.6.0+: Has NO security schemes in base OpenAPI spec - requires augmentation
Key implications:
Registry augmentation scripts (
resources/client_gen/augmentations/registry_security.py) remain necessary even though NiFi 2.6.0 has native securityBoth services use the same authentication flow: username/password → JWT token → Bearer auth
The template (
configuration.mustache) handles both cases via hardcodedbearerAuthfallback plus native scheme aliasesAlways use
augmentedvariant when regenerating clients (default) to support both NiFi and RegistryNiFi can work without augmentation using the
basevariant (2.6.0+), but Registry cannot
Docker & Infrastructure
Docker volume caching: If you experience persistent issues, run
make clean-dockerto remove all containers and volumes, then restart the setup process.Wrong profile for test: Ensure your
NIPYAPI_PROFILEmatches the profile you started withmake up. Mixing profiles causes authentication failures.
Make Targets Quick Reference
NiPyAPI uses Makefile targets as the primary automation interface. Run make help to see all available targets organized by category.
Setup & Installation
make dev-install # Install package with dev dependencies (recommended)
make docs-install # Install documentation dependencies
make clean # Remove build, pyc, and temp artifacts
make clean-all # Nuclear clean: removes ALL including generated code
Testing Workflow
# Basic test workflow
make certs # Generate certificates (once)
make up NIPYAPI_PROFILE=single-user # Start Docker services
make wait-ready NIPYAPI_PROFILE=single-user # Wait for readiness
make test NIPYAPI_PROFILE=single-user # Run tests
make down # Stop services
# Shortcuts for specific profiles
make test-su # single-user profile
make test-ldap # secure-ldap profile
make test-mtls # secure-mtls profile
# Comprehensive testing
make test-all # Run all automated profiles (single-user, ldap, mtls)
make coverage # Run tests with coverage report
Code Quality
make lint # Run flake8 + pylint (excludes generated code)
make flake8 # Run flake8 only
make pylint # Run pylint only
make pre-commit # Run pre-commit hooks on all files
# Formatting (manual)
black nipyapi/ && isort nipyapi/ # Auto-format code
Docker Operations
make certs # Generate PKCS12 certificates for secure profiles
make up NIPYAPI_PROFILE=<profile> # Start specific profile
make down # Stop all Docker services
make wait-ready NIPYAPI_PROFILE=<profile> # Wait for services to be ready
make clean-docker # Comprehensive Docker cleanup
# Available profiles: single-user, secure-ldap, secure-mtls, secure-oidc
Build & Documentation
make dist # Build wheel and source distribution
make check-dist # Validate distribution files
make test-dist # Test that distribution can be imported
make docs # Generate Sphinx documentation
Complete Workflows
make sandbox NIPYAPI_PROFILE=single-user # Create sandbox with sample objects
make rebuild-all # Comprehensive rebuild: clean → certs → APIs → clients → test → build → docs
Generated vs Maintained Code
Understanding which code is generated vs maintained is crucial for contributing:
Generated Code (DO NOT MODIFY)
These files are automatically generated from OpenAPI specifications and should never be edited directly:
nipyapi/nifi/- NiFi API clientnipyapi/registry/- Registry API clientnipyapi/_version.py- Git version via setuptools-scm
Why this matters:
Your changes will be overwritten during the next client generation
These files are excluded from linting (flake8, pylint, black, isort)
Test coverage doesn’t include generated code
Pull requests should not modify these paths
Maintained Code (Where to Contribute)
Focus your contributions on these core modules:
nipyapi/canvas.py- Canvas management functionsnipyapi/config.py- Configuration and endpointsnipyapi/parameters.py- Parameter context operationsnipyapi/profiles.py- Profile management systemnipyapi/security.py- Authentication and securitynipyapi/system.py- System-level operationsnipyapi/utils.py- Utility functionsnipyapi/versioning.py- Version control operationstests/- Test suite (always add tests for new features)examples/- Example scripts and usage patternsdocs/- Documentation (RST files)
Regenerating Clients
If you need to update the generated clients (e.g., for a new NiFi version):
# Set target NiFi version
export NIFI_VERSION=2.5.0
# Fetch and generate
make fetch-openapi # Fetch specs from running NiFi
make gen-clients # Generate Python clients
# Test with new clients
make test-all
Augmentation System
The project includes an augmentation system for fixing OpenAPI spec issues:
Base specs:
resources/client_gen/api_defs/nifi-<version>.jsonAugmentations:
resources/client_gen/augmentations/*.pyAugmented specs:
resources/client_gen/api_defs/*-<version>.augmented.json
If you find spec issues, contribute fixes to the augmentation scripts rather than modifying generated code.
Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
The pull request should include tests.
If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
The pull request should pass lint and all three profile test suites (use make lint and make test-su, make test-ldap, make test-mtls). Exceptions (e.g., docs-only changes) should note why profile tests were skipped.
Pull requests should be created against ‘main’ branch for new features or work with NiFi-2.x, or maint-0.x for critical patches to NiFi-1.x featuers.