Advanced Installation

Advanced

This page is intended for advanced users who need greater control over project dependencies. Most users should use the default installation instead.

Slim Installation

The full feature installation will install pwfdf-api with several optional geospatial libraries (pyogrio, pyproj, shapely), which are used to parse GIS vector files when searching for assessments in custom geospatial areas. However, some users may wish to install pwfdf-api without these optional libraries. Common use cases include: (1) Deploying to a resource-constrained environment (such as a Docker image or AWS lambda), and (2) avoiding compatibility issues with GDAL or PROJ backends. You can implement this slim installation by installing pwfdf-api without the [gis] extras:

pip install pwfdf-api -i https://code.usgs.gov/api/v4/groups/859/-/packages/pypi/simple

Note that the slim installation does not support parsing GIS file geometries (and will raise an ImportError if you attempt to do so). However, you can still implement custom geospatial searches by passing latitude and longitude coordinates directly. For example:

# Supported (uses raw coordinates)
pwfdf assessments --bbox -121,32,-119,34

# Not supported (cannot parse GIS file)
pwfdf assessments --bbox my-geometry.shp
from pwfdf_api import assessments

# Supported (uses raw coordinates)
assessments(bbox=[-121, 32, -119, 34])

# Not supported (cannot parse GIS file)
assessments(bbox="my-geometry.shp")

The following table summarizes the differences between the full and slim installations:

Installation

Supports parsing GIS file geometries

Dependencies

Full

Yes

pyogrio, pyproj, shapely, requests, typer, logset

Slim

No

requests, typer, logset

Building from Lock

If pwfdf-api breaks due to changes in a dependency library, then you can use uv to install pwfdf-api from known working dependencies. This method requires you install uv in addition to the usual prerequisites.

To use this method, you should first clone the pwfdf-api repository at the desired release. For example, if you have git installed, then you can clone the 2.0.0 release to the current directory using:

git clone https://code.usgs.gov/ghsc/lhp/pwfdf-api.git --branch 2.0.0

Next, use uv to install pwfdf-api from the uv.lock file:

uv install

The uv.lock file records the dependencies used to test the pwfdf-api, so represents a collection of known-working dependencies.