I do not have 3.22 installed yet, so not tested in that version. I have tested this with 3.20.3 installed with the new OSGeo4W installer. If it doesn't work for you I will delete this answer.
Tested workflow is:
Save the following batch file (e.g. pyqgis_grass78.bat):
@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat"
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;C:\OSGeo4W\apps\Qt5\bin
path %PATH%;C:\OSGeo4W\apps\Python39\Scripts
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
set GDAL_FILENAME_IS_UTF8=YES
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python39
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins
cmd.exe
Save the following script as a .py file (e.g. r_clump_test.py):
import sys
from qgis.core import QgsApplication
QgsApplication.setPrefixPath('C:/OSGeo4W/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
sys.path.append('C:\OSGeo4W\apps\qgis\python\plugins')
import processing
from processing.core.Processing import Processing
Processing.initialize()
processing.algorithmHelp('grass7:r.clump')
Place the .bat and .py files in the same directory, double click the batch file, then at the command prompt type: "python r_clump_test.py" (without the quotes) and hit enter.
The output (for me) was:
r.clump (grass7:r.clump)
Recategorizes data in a raster map by grouping cells that form physically discrete areas into unique categories.
---------------- Input parameters
input: Input layer
Parameter type: QgsProcessingParameterRasterLayer
Accepted data types:
- str: layer ID
- str: layer name
- str: layer source
- QgsProperty
- QgsRasterLayer
title: Title for output raster map
Parameter type: QgsProcessingParameterString
Accepted data types:
- str
- QgsProperty
-d: Clump also diagonal cells
Parameter type: QgsProcessingParameterBoolean
Accepted data types:
- bool
- int
- str
- QgsProperty
output: Clumps
Parameter type: QgsProcessingParameterRasterDestination
Accepted data types:
- str
- QgsProperty
- QgsProcessingOutputLayerDefinition
threshold: Threshold to identify similar cells
Parameter type: QgsProcessingParameterNumber
Accepted data types:
- int
- float
- QgsProperty
GRASS_REGION_PARAMETER: GRASS GIS 7 region extent
Parameter type: QgsProcessingParameterExtent
Accepted data types:
- str: as comma delimited list of x min, x max, y min, y max. E.g. '4,10,101,105'
- str: layer ID. Extent of layer is used.
- str: layer name. Extent of layer is used.
- str: layer source. Extent of layer is used.
- QgsMapLayer: Extent of layer is used
- QgsProcessingFeatureSourceDefinition: Extent of source is used
- QgsProperty
- QgsRectangle
- QgsReferencedRectangle
- QgsGeometry: bounding box of geometry is used
GRASS_REGION_CELLSIZE_PARAMETER: GRASS GIS 7 region cellsize (leave 0 for default)
Parameter type: QgsProcessingParameterNumber
Accepted data types:
- int
- float
- QgsProperty
GRASS_RASTER_FORMAT_OPT: Output Rasters format options (createopt)
Parameter type: QgsProcessingParameterString
Accepted data types:
- str
- QgsProperty
GRASS_RASTER_FORMAT_META: Output Rasters format metadata options (metaopt)
Parameter type: QgsProcessingParameterString
Accepted data types:
- str
- QgsProperty
---------------- Outputs
output: <QgsProcessingOutputRasterLayer>
Clumps